From 05569be49f13c64b23497c5af223125f9789cf6c Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 25 Oct 2012 12:40:48 -0700 Subject: [PATCH] checkpoint Signed-off-by: Leonardo de Moura --- scripts/mk_make.py | 4 +- scripts/mk_util.py | 89 +++++- scripts/update-version.sh | 20 -- src/api/dll/dll.rc | 101 ------ src/api/dll/dll.vcxproj | 629 -------------------------------------- src/api/dll/resource.h | 14 - 6 files changed, 90 insertions(+), 767 deletions(-) delete mode 100644 scripts/update-version.sh delete mode 100644 src/api/dll/dll.rc delete mode 100644 src/api/dll/dll.vcxproj delete mode 100644 src/api/dll/resource.h diff --git a/scripts/mk_make.py b/scripts/mk_make.py index 6114fc79b..95946946f 100644 --- a/scripts/mk_make.py +++ b/scripts/mk_make.py @@ -63,8 +63,10 @@ add_lib('api', ['portfolio', 'user_plugin']) add_exe('shell', ['api', 'sat', 'extra_cmds'], exe_name='z3') add_exe('test', ['api', 'fuzzing'], exe_name='test-z3') add_dll('api_dll', ['api', 'sat', 'extra_cmds'], 'api/dll', dll_name='z3') +add_dot_net_dll('dotnet', ['api_dll'], 'bindings/dotnet/Microsoft.Z3', dll_name='Microsoft.Z3', assembly_info_dir='Properties') +add_dot_net_dll('dotnetV3', ['api_dll'], 'bindings/dotnet/Microsoft.Z3V3', dll_name='Microsoft.Z3V3') mk_auto_src() update_version(4, 2, 0, 0) -mk_makefile() +# mk_makefile() diff --git a/scripts/mk_util.py b/scripts/mk_util.py index ab07b9f6a..d4593166f 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -230,6 +230,10 @@ class Component: def main_component(self): return False + # Return true if the component contains an AssemblyInfo.cs file that needs to be updated. + def has_assembly_info(self): + return False + class LibComponent(Component): def __init__(self, name, path, deps): Component.__init__(self, name, path, deps) @@ -350,6 +354,28 @@ class DLLComponent(Component): def main_component(self): return True +class DotNetDLLComponent(Component): + def __init__(self, name, dll_name, path, deps, assembly_info_dir): + Component.__init__(self, name, path, deps) + if dll_name == None: + dll_name = name + if assembly_info_dir == None: + assembly_info_dir = "." + self.dll_name = dll_name + self.assembly_info_dir = assembly_info_dir + + def mk_makefile(self, out): + if IS_WINDOW: + # TODO + return + + def main_component(self): + return IS_WINDOW + + def has_assembly_info(self): + return True + + def reg_component(name, c): global _Id, _Components, _ComponentNames, _Name2Component c.id = _Id @@ -372,6 +398,10 @@ def add_dll(name, deps=[], path=None, dll_name=None): c = DLLComponent(name, dll_name, path, deps) reg_component(name, c) +def add_dot_net_dll(name, deps=[], path=None, dll_name=None, assembly_info_dir=None): + c = DotNetDLLComponent(name, dll_name, path, deps, assembly_info_dir) + reg_component(name, c) + # Copy configuration correct file to BUILD_DIR def cp_config_mk(): if IS_WINDOW: @@ -441,7 +471,8 @@ def mk_pat_db(): def update_version(major, minor, build, revision): if not ONLY_MAKEFILES: mk_version_dot_h(major, minor, build, revision) - + update_all_assembly_infos(major, minor, build, revision) + # Update files with the version number def mk_version_dot_h(major, minor, build, revision): c = _Name2Component['util'] @@ -453,4 +484,58 @@ def mk_version_dot_h(major, minor, build, revision): fout.write('#define Z3_REVISION_NUMBER %s\n' % revision) if VERBOSE: print "Generated '%s/version.h'" % c.src_dir - + +# Update version number in AssemblyInfo.cs files +def update_all_assembly_infos(major, minor, build, revision): + for c in _Components: + if c.has_assembly_info(): + assembly = '%s/%s/AssemblyInfo.cs' % (c.src_dir, c.assembly_info_dir) + if os.path.exists(assembly): + # It is a CS file + update_assembly_info_version(assembly, + major, minor, build, revision, False) + else: + assembly = '%s/%s/AssemblyInfo.cpp' % (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/%s'" % (c.src_dir, c.assembly_info_dir)) + + +# Update version number in the given AssemblyInfo.cs files +def update_assembly_info_version(assemblyinfo, major, minor, build, revision, is_cpp=False): + if is_cpp: + ver_pat = re.compile('[assembly:AssemblyVersionAttribute\("[\.\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') + tmp = '%s.new' % assemblyinfo + fout = open(tmp, 'w') + num_updates = 0 + for line in fin: + if ver_pat.match(line): + if is_cpp: + 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 + elif fver_pat.match(line): + if is_cpp: + 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 + 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() + shutil.move(tmp, assemblyinfo) + if VERBOSE: + print "Updated %s" % assemblyinfo diff --git a/scripts/update-version.sh b/scripts/update-version.sh deleted file mode 100644 index 151fad6b9..000000000 --- a/scripts/update-version.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Update Z3 version -# - -if [ $# -ne 1 ]; then - echo "Usage: update-version.sh MAJOR.MINOR.BUILD.REVISION" -fi - -sd edit lib/version.h -sd edit release.cmd -sd edit shell/shell.rc -sd edit dll/dll.rc -sd edit shell/main.cpp -sd edit Z3Inspector/Properties/AssemblyInfo.cs -sd edit Microsoft.Z3/Properties/AssemblyInfo.cs -sd edit Microsoft.Z3V3/AssemblyInfo.cpp - -scripts/perl scripts/update-version.pl "$1" diff --git a/src/api/dll/dll.rc b/src/api/dll/dll.rc deleted file mode 100644 index 5f00cfb37..000000000 --- a/src/api/dll/dll.rc +++ /dev/null @@ -1,101 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,2,0,0 - PRODUCTVERSION 4,2,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "Z3 Dynamic Link Library" - VALUE "FileVersion" "4,2,0,0" - VALUE "InternalName", "Z3 DLL" - VALUE "LegalCopyright", "(c) Microsoft Corporation. All rights reserved." - VALUE "OriginalFilename", "z3.dll" - VALUE "ProductName", "Z3" - VALUE "ProductVersion", "4,2,0,0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/api/dll/dll.vcxproj b/src/api/dll/dll.vcxproj deleted file mode 100644 index 0b49c1479..000000000 --- a/src/api/dll/dll.vcxproj +++ /dev/null @@ -1,629 +0,0 @@ - - - - - commercial - Win32 - - - commercial - x64 - - - Debug - Win32 - - - Debug - x64 - - - external_64 - Win32 - - - external_64 - x64 - - - external - Win32 - - - external - x64 - - - release_mt - Win32 - - - release_mt - x64 - - - Release - Win32 - - - Release - x64 - - - trace - Win32 - - - trace - x64 - - - - {0BF8CB94-61C7-4545-AE55-C58D858AA8B6} - dll - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - $(SolutionDir)$(Configuration)\ - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - $(Configuration)\ - false - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - z3 - - - - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - false - - - MachineX86 - - - - - X64 - - - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - MachineX64 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - MachineX86 - - - - - X64 - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - MachineX64 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - MachineX86 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - MachineX86 - - - - - X64 - - - _AMD64_;WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - MachineX64 - - - - - X64 - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - MachineX64 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - $(TargetDir)$(TargetName).lib - MachineX86 - - - - - X64 - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - $(TargetDir)$(TargetName).lib - MachineX64 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - MachineX86 - - - - - X64 - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - MachineX64 - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - false - - - MachineX86 - - - - - X64 - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - $(OutDir)z3.dll - z3.def - true - $(TargetDir)z3_dll.pdb - Windows - true - true - MachineX64 - - - - - - - - - - - - - - - - - {4a7e5a93-19d8-4382-8950-fb2edec7a76e} - false - - - - - - \ No newline at end of file diff --git a/src/api/dll/resource.h b/src/api/dll/resource.h deleted file mode 100644 index 1bf905c58..000000000 --- a/src/api/dll/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by dll.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif