mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
Merge branch 'unstable' of https://git01.codeplex.com/z3 into unstable
This commit is contained in:
commit
a9c4470a6b
|
@ -1785,7 +1785,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
|
||||||
|
@ -1800,49 +1800,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)
|
||||||
|
@ -1851,7 +1834,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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue