mirror of
https://github.com/Z3Prover/z3
synced 2025-06-07 06:33:23 +00:00
Move AssemblyInfo.cs AssemblyInfo. Update mk_util.py to generate AssemblyInfo.cs instead of modifying it.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
0f13ec6e42
commit
efb6b2453e
2 changed files with 50 additions and 68 deletions
|
@ -1822,7 +1822,7 @@ def update_version():
|
||||||
raise MKException("set_version(major, minor, build, revision) must be used before invoking update_version()")
|
raise MKException("set_version(major, minor, build, revision) must be used before invoking update_version()")
|
||||||
if not ONLY_MAKEFILES:
|
if not ONLY_MAKEFILES:
|
||||||
mk_version_dot_h(major, minor, build, revision)
|
mk_version_dot_h(major, minor, build, revision)
|
||||||
update_all_assembly_infos(major, minor, build, revision)
|
mk_all_assembly_infos(major, minor, build, revision)
|
||||||
mk_def_files()
|
mk_def_files()
|
||||||
|
|
||||||
# Update files with the version number
|
# Update files with the version number
|
||||||
|
@ -1837,49 +1837,32 @@ def mk_version_dot_h(major, minor, build, revision):
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print("Generated '%s'" % os.path.join(c.src_dir, 'version.h'))
|
print("Generated '%s'" % os.path.join(c.src_dir, 'version.h'))
|
||||||
|
|
||||||
# Update version number in AssemblyInfo.cs files
|
# Generate AssemblyInfo.cs files with the right version numbers by using AssemblyInfo files as a template
|
||||||
def update_all_assembly_infos(major, minor, build, revision):
|
def mk_all_assembly_infos(major, minor, build, revision):
|
||||||
for c in get_components():
|
for c in get_components():
|
||||||
if c.has_assembly_info():
|
if c.has_assembly_info():
|
||||||
assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo.cs')
|
assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo')
|
||||||
if os.path.exists(assembly):
|
if os.path.exists(assembly):
|
||||||
# It is a CS file
|
# It is a CS file
|
||||||
update_assembly_info_version(assembly,
|
mk_assembly_info_version(assembly, major, minor, build, revision)
|
||||||
major, minor, build, revision, False)
|
|
||||||
else:
|
else:
|
||||||
assembly = os.path.join(c.src_dir, c.assembly_info_dir, 'AssemblyInfo.cs')
|
raise MKException("Failed to find assembly info file 'AssemblyInfo' at '%s'" % os.path.join(c.src_dir, c.assembly_info_dir))
|
||||||
if os.path.exists(assembly):
|
|
||||||
# It is a cpp file
|
|
||||||
update_assembly_info_version(assembly,
|
|
||||||
major, minor, build, revision, True)
|
|
||||||
else:
|
|
||||||
raise MKException("Failed to find assembly info file at '%s'" % os.path.join(c.src_dir, c.assembly_info_dir))
|
|
||||||
|
|
||||||
|
|
||||||
# Update version number in the given AssemblyInfo.cs files
|
# Generate version number in the given 'AssemblyInfo.cs' file using 'AssemblyInfo' as a template.
|
||||||
def update_assembly_info_version(assemblyinfo, major, minor, build, revision, is_cpp=False):
|
def mk_assembly_info_version(assemblyinfo, major, minor, build, revision):
|
||||||
if is_cpp:
|
ver_pat = re.compile('[assembly: AssemblyVersion\("[\.\d]*"\) *')
|
||||||
ver_pat = re.compile('[assembly:AssemblyVersionAttribute\("[\.\d]*"\) *')
|
fver_pat = re.compile('[assembly: AssemblyFileVersion\("[\.\d]*"\) *')
|
||||||
fver_pat = re.compile('[assembly:AssemblyFileVersionAttribute\("[\.\d]*"\) *')
|
|
||||||
else:
|
|
||||||
ver_pat = re.compile('[assembly: AssemblyVersion\("[\.\d]*"\) *')
|
|
||||||
fver_pat = re.compile('[assembly: AssemblyFileVersion\("[\.\d]*"\) *')
|
|
||||||
fin = open(assemblyinfo, 'r')
|
fin = open(assemblyinfo, 'r')
|
||||||
tmp = '%s.new' % assemblyinfo
|
tmp = '%s.cs' % assemblyinfo
|
||||||
fout = open(tmp, 'w')
|
fout = open(tmp, 'w')
|
||||||
num_updates = 0
|
num_updates = 0
|
||||||
for line in fin:
|
for line in fin:
|
||||||
if ver_pat.match(line):
|
if ver_pat.match(line):
|
||||||
if is_cpp:
|
fout.write('[assembly: AssemblyVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision))
|
||||||
fout.write('[assembly:AssemblyVersionAttribute("%s.%s.%s.%s")];\n' % (major, minor, build, revision))
|
|
||||||
else:
|
|
||||||
fout.write('[assembly: AssemblyVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision))
|
|
||||||
num_updates = num_updates + 1
|
num_updates = num_updates + 1
|
||||||
elif fver_pat.match(line):
|
elif fver_pat.match(line):
|
||||||
if is_cpp:
|
fout.write('[assembly: AssemblyFileVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision))
|
||||||
fout.write('[assembly:AssemblyFileVersionAttribute("%s.%s.%s.%s")];\n' % (major, minor, build, revision))
|
|
||||||
else:
|
|
||||||
fout.write('[assembly: AssemblyFileVersion("%s.%s.%s.%s")]\n' % (major, minor, build, revision))
|
|
||||||
num_updates = num_updates + 1
|
num_updates = num_updates + 1
|
||||||
else:
|
else:
|
||||||
fout.write(line)
|
fout.write(line)
|
||||||
|
@ -1888,7 +1871,6 @@ def update_assembly_info_version(assemblyinfo, major, minor, build, revision, is
|
||||||
assert num_updates == 2, "unexpected number of version number updates"
|
assert num_updates == 2, "unexpected number of version number updates"
|
||||||
fin.close()
|
fin.close()
|
||||||
fout.close()
|
fout.close()
|
||||||
shutil.move(tmp, assemblyinfo)
|
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print("Updated '%s'" % assemblyinfo)
|
print("Updated '%s'" % assemblyinfo)
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Permissions;
|
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
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Z3 .NET Interface")]
|
[assembly: AssemblyTitle("Z3 .NET Interface")]
|
||||||
[assembly: AssemblyDescription(".NET Interface to the Z3 Theorem Prover")]
|
[assembly: AssemblyDescription(".NET Interface to the Z3 Theorem Prover")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Microsoft Corporation")]
|
[assembly: AssemblyCompany("Microsoft Corporation")]
|
||||||
[assembly: AssemblyProduct("Z3")]
|
[assembly: AssemblyProduct("Z3")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2006")]
|
[assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2006")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// 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
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("4853ed71-2078-40f4-8117-bc46646bce0e")]
|
[assembly: Guid("4853ed71-2078-40f4-8117-bc46646bce0e")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// 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:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("4.2.0.0")]
|
// [assembly: AssemblyVersion("4.2.0.0")]
|
||||||
[assembly: AssemblyVersion("4.3.2.0")]
|
[assembly: AssemblyVersion("4.3.2.0")]
|
||||||
[assembly: AssemblyFileVersion("4.3.2.0")]
|
[assembly: AssemblyFileVersion("4.3.2.0")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue