diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 4b6a1e1f6..3cf8022cd 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -1535,7 +1535,7 @@ class DotNetDLLComponent(Component): ] ) if DEBUG_MODE: - cscCmdLine.extend( ['/define:DEBUG;TRACE', + cscCmdLine.extend( ['"/define:DEBUG;TRACE"', # Needs to be quoted due to ``;`` being a shell command separator '/debug+', '/debug:full', '/optimize-' @@ -1916,7 +1916,7 @@ class DotNetExampleComponent(ExampleComponent): ExampleComponent.__init__(self, name, path) def is_example(self): - return IS_WINDOWS + return is_dotnet_enabled() def mk_makefile(self, out): if DOTNET_ENABLED: @@ -1935,9 +1935,11 @@ class DotNetExampleComponent(ExampleComponent): out.write(' /platform:x86') for csfile in get_cs_files(self.ex_dir): out.write(' ') - # HACK - win_ex_dir = self.to_ex_dir.replace('/', '\\') - out.write(os.path.join(win_ex_dir, csfile)) + # HACK: I'm not really sure why csc on Windows need to be + # given Windows style paths (``\``) here. I thought Windows + # supported using ``/`` as a path separator... + relative_path = self.to_ex_dir.replace('/', os.path.sep) + out.write(os.path.join(relative_path, csfile)) out.write('\n') out.write('_ex_%s: %s\n\n' % (self.name, exefile)) @@ -2548,42 +2550,23 @@ def mk_version_dot_h(major, minor, build, revision): if VERBOSE: print("Generated '%s'" % os.path.join(c.src_dir, 'version.h')) -# Generate AssemblyInfo.cs files with the right version numbers by using AssemblyInfo files as a template +# Generate AssemblyInfo.cs files with the right version numbers by using ``AssemblyInfo.cs.in`` files as a template def mk_all_assembly_infos(major, minor, build, revision): for c in get_components(): if c.has_assembly_info(): - assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo') - if os.path.exists(assembly): - # It is a CS file - mk_assembly_info_version(assembly, major, minor, build, revision) + assembly_info_template = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo.cs.in') + assembly_info_output = assembly_info_template[:-3] + assert assembly_info_output.endswith('.cs') + if os.path.exists(assembly_info_template): + configure_file(assembly_info_template, assembly_info_output, + { 'VER_MAJOR': str(major), + 'VER_MINOR': str(minor), + 'VER_BUILD': str(build), + 'VER_REVISION': str(revision), + } + ) else: - raise MKException("Failed to find assembly info file 'AssemblyInfo' at '%s'" % os.path.join(c.src_dir, c.assembly_info_dir)) - - -# Generate version number in the given 'AssemblyInfo.cs' file using 'AssemblyInfo' as a template. -def mk_assembly_info_version(assemblyinfo, major, minor, build, revision): - ver_pat = re.compile('[assembly: AssemblyVersion\("[\.\d]*"\) *') - fver_pat = re.compile('[assembly: AssemblyFileVersion\("[\.\d]*"\) *') - fin = open(assemblyinfo, 'r') - tmp = '%s.cs' % assemblyinfo - fout = open(tmp, 'w') - num_updates = 0 - for line in fin: - if ver_pat.match(line): - fout.write('[assembly: AssemblyVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision)) - num_updates = num_updates + 1 - elif fver_pat.match(line): - fout.write('[assembly: AssemblyFileVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision)) - num_updates = num_updates + 1 - else: - fout.write(line) - # if VERBOSE: - # print("%s version numbers updated at '%s'" % (num_updates, assemblyinfo)) - assert num_updates == 2, "unexpected number of version number updates" - fin.close() - fout.close() - if VERBOSE: - print("Updated '%s'" % assemblyinfo) + raise MKException("Failed to find assembly template info file '%s'" % assembly_info_template) ADD_TACTIC_DATA=[] ADD_PROBE_DATA=[] diff --git a/src/api/dotnet/Properties/AssemblyInfo b/src/api/dotnet/Properties/AssemblyInfo.cs.in similarity index 80% rename from src/api/dotnet/Properties/AssemblyInfo rename to src/api/dotnet/Properties/AssemblyInfo.cs.in index 4afbb4a26..e5a85f16f 100644 --- a/src/api/dotnet/Properties/AssemblyInfo +++ b/src/api/dotnet/Properties/AssemblyInfo.cs.in @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Z3 .NET Interface")] @@ -12,12 +12,12 @@ using System.Security.Permissions; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("Z3")] -[assembly: AssemblyCopyright("Copyright (C) 2006-2014 Microsoft Corporation")] +[assembly: AssemblyCopyright("Copyright (C) 2006-2015 Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,12 +27,12 @@ using System.Security.Permissions; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("4.2.0.0")] -[assembly: AssemblyVersion("4.3.2.0")] -[assembly: AssemblyFileVersion("4.3.2.0")] +[assembly: AssemblyVersion("@VER_MAJOR@.@VER_MINOR@.@VER_BUILD@.@VER_REVISION@")] +[assembly: AssemblyFileVersion("@VER_MAJOR@.@VER_MINOR@.@VER_BUILD@.@VER_REVISION@")]