3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 00:55:31 +00:00

Merge branch 'master' into polysat

This commit is contained in:
Jakob Rath 2022-09-23 17:14:26 +02:00
commit 1df749ad33
368 changed files with 12363 additions and 6152 deletions

View file

@ -22,6 +22,22 @@ jobs:
python scripts\mk_win_dist.py
--${{parameters.BuildArchitecture}}-only
--dotnet-key=$(Build.SourcesDirectory)/resources/z3.snk
- task: CopyFiles@2
displayName: 'Collect Symbols'
inputs:
sourceFolder: dist
contents: '**/*.pdb'
targetFolder: '$(Build.ArtifactStagingDirectory)/symbols'
# Publish symbol archive to match nuget package
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server
- task: PublishSymbols@2
inputs:
symbolsFolder: '$(Build.ArtifactStagingDirectory)/symbols'
searchPattern: '**/*.pdb'
indexSources: false # Github sources not supported
publishSymbols: true
symbolServerType: TeamServices
detailedLog: true
- task: EsrpCodeSigning@1
displayName: Sign
inputs:

View file

@ -12,7 +12,7 @@ stages:
- job: UbuntuDoc
displayName: "Ubuntu Doc build"
pool:
vmImage: "Ubuntu-latest"
vmImage: "ubuntu-latest"
steps:
# TODO setup emscripten with no-install, then run
- script: npm --prefix=src/api/js ci

View file

@ -886,8 +886,7 @@ def mk_hpp_from_pyg(pyg_file, output_dir):
hpp = os.path.join(dirname, '%s.hpp' % class_name)
out = open(hpp, 'w')
out.write('// Automatically generated file\n')
out.write('#ifndef __%s_HPP_\n' % class_name.upper())
out.write('#define __%s_HPP_\n' % class_name.upper())
out.write('#pragma once\n')
out.write('#include "util/params.h"\n')
if export:
out.write('#include "util/gparams.h"\n')
@ -919,7 +918,6 @@ def mk_hpp_from_pyg(pyg_file, output_dir):
out.write(' %s %s() const { return p.%s("%s", %s); }\n' %
(TYPE2CTYPE[param[1]], to_c_method(param[0]), TYPE2GETTER[param[1]], param[0], pyg_default_as_c_literal(param)))
out.write('};\n')
out.write('#endif\n')
out.close()
OUTPUT_HPP_FILE.append(hpp)

View file

@ -21,7 +21,8 @@ def mk_dir(d):
if not os.path.exists(d):
os.makedirs(d)
os_info = { 'ubuntu-18' : ('so', 'linux-x64'),
os_info = { 'ubuntu-latest' : ('so', 'linux-x64'),
'ubuntu-18' : ('so', 'linux-x64'),
'ubuntu-20' : ('so', 'linux-x64'),
'glibc-2.31' : ('so', 'linux-x64'),
'x64-win' : ('dll', 'win-x64'),

View file

@ -8,7 +8,7 @@
from mk_util import *
def init_version():
set_version(4, 11, 0, 0)
set_version(4, 11, 3, 0) # express a default build version or pick up ci build version
# Z3 Project definition
def init_project_def():
@ -27,7 +27,7 @@ def init_project_def():
add_lib('params', ['util'])
add_lib('smt_params', ['params'], 'smt/params')
add_lib('grobner', ['ast', 'dd', 'simplex'], 'math/grobner')
add_lib('sat', ['util', 'dd', 'grobner'])
add_lib('sat', ['params', 'util', 'dd', 'grobner'])
add_lib('nlsat', ['polynomial', 'sat'])
add_lib('lp', ['util', 'nlsat', 'grobner', 'interval', 'smt_params'], 'math/lp')
add_lib('rewriter', ['ast', 'polynomial', 'automata', 'params'], 'ast/rewriter')
@ -38,7 +38,7 @@ def init_project_def():
add_lib('substitution', ['ast', 'rewriter'], 'ast/substitution')
add_lib('parser_util', ['ast'], 'parsers/util')
add_lib('proofs', ['rewriter', 'util'], 'ast/proofs')
add_lib('solver', ['model', 'tactic', 'proofs'])
add_lib('solver', ['params', 'model', 'tactic', 'proofs'])
add_lib('cmd_context', ['solver', 'rewriter', 'params'])
add_lib('smt2parser', ['cmd_context', 'parser_util'], 'parsers/smt2')
add_lib('pattern', ['normal_forms', 'smt2parser', 'rewriter'], 'ast/pattern')
@ -87,7 +87,7 @@ def init_project_def():
API_files = ['z3_api.h', 'z3_ast_containers.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_fixedpoint.h', 'z3_optimization.h', 'z3_fpa.h', 'z3_spacer.h']
add_lib('api', ['portfolio', 'realclosure', 'opt'],
includes2install=['z3.h', 'z3_v1.h', 'z3_macros.h'] + API_files)
add_lib('extra_cmds', ['cmd_context', 'subpaving_tactic', 'qe', 'arith_tactics'], 'cmd_context/extra_cmds')
add_lib('extra_cmds', ['cmd_context', 'subpaving_tactic', 'qe', 'euf', 'arith_tactics'], 'cmd_context/extra_cmds')
add_exe('shell', ['api', 'sat', 'extra_cmds', 'opt'], exe_name='z3')
add_exe('test', ['polysat','api', 'fuzzing', 'simplex', 'sat_smt'], exe_name='test-z3', install=False)
_libz3Component = add_dll('api_dll', ['api', 'sat', 'extra_cmds'], 'api/dll',

View file

@ -91,6 +91,7 @@ TRACE = False
PYTHON_ENABLED=False
DOTNET_CORE_ENABLED=False
DOTNET_KEY_FILE=getenv("Z3_DOTNET_KEY_FILE", None)
ASSEMBLY_VERSION=getenv("Z2_ASSEMBLY_VERSION", None)
JAVA_ENABLED=False
ML_ENABLED=False
PYTHON_INSTALL_ENABLED=False
@ -540,15 +541,33 @@ def find_c_compiler():
raise MKException('C compiler was not found. Try to set the environment variable CC with the C compiler available in your system.')
def set_version(major, minor, build, revision):
global VER_MAJOR, VER_MINOR, VER_BUILD, VER_TWEAK, GIT_DESCRIBE
global ASSEMBLY_VERSION, VER_MAJOR, VER_MINOR, VER_BUILD, VER_TWEAK, GIT_DESCRIBE
# We need to give the assembly a build specific version
# global version overrides local default expression
if ASSEMBLY_VERSION is not None:
versionSplits = ASSEMBLY_VERSION.split('.')
if len(versionSplits) > 3:
VER_MAJOR = versionSplits[0]
VER_MINOR = versionSplits[1]
VER_BUILD = versionSplits[2]
VER_TWEAK = versionSplits[3]
print("Set Assembly Version (BUILD):", VER_MAJOR, VER_MINOR, VER_BUILD, VER_TWEAK)
return
# use parameters to set up version if not provided by script args
VER_MAJOR = major
VER_MINOR = minor
VER_BUILD = build
VER_TWEAK = revision
# update VER_TWEAK base on github
if GIT_DESCRIBE:
branch = check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
VER_TWEAK = int(check_output(['git', 'rev-list', '--count', 'HEAD']))
print("Set Assembly Version (DEFAULT):", VER_MAJOR, VER_MINOR, VER_BUILD, VER_TWEAK)
def get_version():
return (VER_MAJOR, VER_MINOR, VER_BUILD, VER_TWEAK)
@ -666,6 +685,7 @@ def display_help(exit_code):
print(" --optimize generate optimized code during linking.")
print(" --dotnet generate .NET platform bindings.")
print(" --dotnet-key=<file> sign the .NET assembly using the private key in <file>.")
print(" --assembly-version=<x.x.x.x> provide version number for build")
print(" --java generate Java bindings.")
print(" --ml generate OCaml bindings.")
print(" --js generate JScript bindings.")
@ -700,14 +720,14 @@ def display_help(exit_code):
# Parse configuration option for mk_make script
def parse_options():
global VERBOSE, DEBUG_MODE, IS_WINDOWS, VS_X64, ONLY_MAKEFILES, SHOW_CPPS, VS_PROJ, TRACE, VS_PAR, VS_PAR_NUM
global DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, JAVA_ENABLED, ML_ENABLED, STATIC_LIB, STATIC_BIN, PREFIX, GMP, PYTHON_PACKAGE_DIR, GPROF, GIT_HASH, GIT_DESCRIBE, PYTHON_INSTALL_ENABLED, PYTHON_ENABLED
global DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, ASSEMBLY_VERSION, JAVA_ENABLED, ML_ENABLED, STATIC_LIB, STATIC_BIN, PREFIX, GMP, PYTHON_PACKAGE_DIR, GPROF, GIT_HASH, GIT_DESCRIBE, PYTHON_INSTALL_ENABLED, PYTHON_ENABLED
global LINUX_X64, SLOW_OPTIMIZE, LOG_SYNC, SINGLE_THREADED
global GUARD_CF, ALWAYS_DYNAMIC_BASE, IS_ARCH_ARM64
try:
options, remainder = getopt.gnu_getopt(sys.argv[1:],
'b:df:sxa:hmcvtnp:gj',
['build=', 'debug', 'silent', 'x64', 'arm64=', 'help', 'makefiles', 'showcpp', 'vsproj', 'guardcf',
'trace', 'dotnet', 'dotnet-key=', 'staticlib', 'prefix=', 'gmp', 'java', 'parallel=', 'gprof', 'js',
'trace', 'dotnet', 'dotnet-key=', 'assembly-version=', 'staticlib', 'prefix=', 'gmp', 'java', 'parallel=', 'gprof', 'js',
'githash=', 'git-describe', 'x86', 'ml', 'optimize', 'pypkgdir=', 'python', 'staticbin', 'log-sync', 'single-threaded'])
except:
print("ERROR: Invalid command line option")
@ -745,6 +765,8 @@ def parse_options():
DOTNET_CORE_ENABLED = True
elif opt in ('--dotnet-key'):
DOTNET_KEY_FILE = arg
elif opt in ('--assembly-version'):
ASSEMBLY_VERSION = arg
elif opt in ('--staticlib'):
STATIC_LIB = True
elif opt in ('--staticbin'):
@ -1694,7 +1716,9 @@ class DotNetDLLComponent(Component):
key = "<AssemblyOriginatorKeyFile>%s</AssemblyOriginatorKeyFile>" % self.key_file
key += "\n<SignAssembly>true</SignAssembly>"
version = get_version_string(3)
version = get_version_string(4)
print("Version output to csproj:", version)
core_csproj_str = """<Project Sdk="Microsoft.NET.Sdk">
@ -1702,7 +1726,7 @@ class DotNetDLLComponent(Component):
<TargetFramework>netstandard1.4</TargetFramework>
<LangVersion>8.0</LangVersion>
<DefineConstants>$(DefineConstants);DOTNET_CORE</DefineConstants>
<DebugType>portable</DebugType>
<DebugType>full</DebugType>
<AssemblyName>Microsoft.Z3</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>Microsoft.Z3</PackageId>
@ -2826,6 +2850,9 @@ def update_version():
minor = VER_MINOR
build = VER_BUILD
revision = VER_TWEAK
print("UpdateVersion:", get_full_version_string(major, minor, build, revision))
if major is None or minor is None or build is None or revision is None:
raise MKException("set_version(major, minor, build, revision) must be used before invoking update_version()")
if not ONLY_MAKEFILES:

View file

@ -24,6 +24,7 @@ BUILD_X86_DIR=os.path.join('build-dist', 'x86')
VERBOSE=True
DIST_DIR='dist'
FORCE_MK=False
ASSEMBLY_VERSION=None
DOTNET_CORE_ENABLED=True
DOTNET_KEY_FILE=None
JAVA_ENABLED=True
@ -62,6 +63,7 @@ def display_help():
print(" -s, --silent do not print verbose messages.")
print(" -b <sudir>, --build=<subdir> subdirectory where x86 and x64 Z3 versions will be built (default: build-dist).")
print(" -f, --force force script to regenerate Makefiles.")
print(" --assembly-version assembly version for dll")
print(" --nodotnet do not include .NET bindings in the binary distribution files.")
print(" --dotnet-key=<file> strongname sign the .NET assembly with the private key in <file>.")
print(" --nojava do not include Java bindings in the binary distribution files.")
@ -74,7 +76,7 @@ def display_help():
# Parse configuration option for mk_make script
def parse_options():
global FORCE_MK, JAVA_ENABLED, ZIP_BUILD_OUTPUTS, GIT_HASH, DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, PYTHON_ENABLED, X86ONLY, X64ONLY
global FORCE_MK, JAVA_ENABLED, ZIP_BUILD_OUTPUTS, GIT_HASH, DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, ASSEMBLY_VERSION, PYTHON_ENABLED, X86ONLY, X64ONLY
path = BUILD_DIR
options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:hsf', ['build=',
'help',
@ -83,6 +85,7 @@ def parse_options():
'nojava',
'nodotnet',
'dotnet-key=',
'assembly-version=',
'zip',
'githash',
'nopython',
@ -102,6 +105,8 @@ def parse_options():
FORCE_MK = True
elif opt == '--nodotnet':
DOTNET_CORE_ENABLED = False
elif opt == '--assembly-version':
ASSEMBLY_VERSION = arg
elif opt == '--nopython':
PYTHON_ENABLED = False
elif opt == '--dotnet-key':
@ -131,8 +136,10 @@ def mk_build_dir(path, x64):
opts = ["python", os.path.join('scripts', 'mk_make.py'), parallel, "-b", path]
if DOTNET_CORE_ENABLED:
opts.append('--dotnet')
if not DOTNET_KEY_FILE is None:
if DOTNET_KEY_FILE is not None:
opts.append('--dotnet-key=' + DOTNET_KEY_FILE)
if ASSEMBLY_VERSION is not None:
opts.append('--assembly-version=' + ASSEMBLY_VERSION)
if JAVA_ENABLED:
opts.append('--java')
if x64:
@ -196,6 +203,7 @@ def mk_z3s():
def get_z3_name(x64):
major, minor, build, revision = get_version()
print("Assembly version:", major, minor, build, revision)
if x64:
platform = "x64"
else:
@ -299,9 +307,10 @@ def cp_licenses():
cp_license(False)
def init_flags():
global DOTNET_KEY_FILE, JAVA_ENABLED, PYTHON_ENABLED
global DOTNET_KEY_FILE, JAVA_ENABLED, PYTHON_ENABLED, ASSEMBLY_VERSION
mk_util.DOTNET_CORE_ENABLED = True
mk_util.DOTNET_KEY_FILE = DOTNET_KEY_FILE
mk_util.ASSEMBLY_VERSION = ASSEMBLY_VERSION
mk_util.JAVA_ENABLED = JAVA_ENABLED
mk_util.PYTHON_ENABLED = PYTHON_ENABLED
mk_util.ALWAYS_DYNAMIC_BASE = True

View file

@ -1,14 +1,13 @@
variables:
Major: '4'
Minor: '11'
Patch: '0'
NightlyVersion: $(Major).$(Minor).$(Patch).$(Build.BuildId)-$(Build.DefinitionName)
Patch: '3'
AssemblyVersion: $(Major).$(Minor).$(Patch).$(Build.BuildId)
NightlyVersion: $(AssemblyVersion)-$(Build.DefinitionName)
stages:
- stage: Build
jobs:
- job: Mac
displayName: "Mac Build"
pool:
@ -23,7 +22,6 @@ stages:
artifactName: 'Mac'
targetPath: $(Build.ArtifactStagingDirectory)
- job: MacArm64
displayName: "Mac ARM64 Build"
pool:
@ -37,7 +35,6 @@ stages:
artifactName: 'MacArm64'
targetPath: $(Build.ArtifactStagingDirectory)
- job: Ubuntu
displayName: "Ubuntu build"
pool:
@ -55,7 +52,7 @@ stages:
- job: UbuntuDoc
displayName: "Ubuntu Doc build"
pool:
vmImage: "Ubuntu-latest"
vmImage: "ubuntu-latest"
steps:
- script: sudo apt-get install ocaml opam libgmp-dev
- script: opam init -y
@ -76,6 +73,7 @@ stages:
eval `opam config env`
cd doc
python mk_api_doc.py --mld --z3py-package-path=../build/python/z3
python mk_params_doc.py
mkdir api/html/ml
ocamldoc -html -d api/html/ml -sort -hide Z3 -I $( ocamlfind query zarith ) -I ../build/api/ml ../build/api/ml/z3enums.mli ../build/api/ml/z3.mli
cd ..
@ -92,7 +90,7 @@ stages:
name: ManyLinux
displayName: "ManyLinux build"
pool:
vmImage: "Ubuntu-18.04"
vmImage: "ubuntu-latest"
container: "quay.io/pypa/manylinux2010_x86_64:latest"
steps:
- script: $(python) scripts/mk_unix_dist.py --nodotnet --nojava
@ -111,7 +109,7 @@ stages:
# name: MuslLinux
# displayName: "MuslLinux build"
# pool:
# vmImage: "Ubuntu-18.04"
# vmImage: "ubuntu-latest"
# container: "quay.io/pypa/musllinux_1_1_x86_64:latest"
# steps:
# - script: $(python) scripts/mk_unix_dist.py --nodotnet --nojava
@ -123,7 +121,6 @@ stages:
# artifactName: '$(name)Build'
# targetPath: $(Build.ArtifactStagingDirectory)
- job: Windows32
displayName: "Windows 32-bit build"
pool:
@ -134,6 +131,7 @@ stages:
script:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 &
python scripts\mk_win_dist.py
--assembly-version=$(AssemblyVersion)
--x86-only
--dotnet-key=$(Build.SourcesDirectory)/resources/z3.snk
--zip
@ -146,6 +144,22 @@ stages:
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: 'Windows32'
- task: CopyFiles@2
displayName: 'Collect Symbols'
inputs:
sourceFolder: dist
contents: '**/*.pdb'
targetFolder: '$(Build.ArtifactStagingDirectory)/symbols'
# Publish symbol archive to match nuget package
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server
- task: PublishSymbols@2
inputs:
symbolsFolder: '$(Build.ArtifactStagingDirectory)/symbols'
searchPattern: '**/*.pdb'
indexSources: false # Github not supported
publishSymbols: true
symbolServerType: TeamServices
detailedLog: true
- job: Windows64
displayName: "Windows 64-bit build"
@ -157,6 +171,7 @@ stages:
script:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 &
python scripts\mk_win_dist.py
--assembly-version=$(AssemblyVersion)
--x64-only
--dotnet-key=$(Build.SourcesDirectory)/resources/z3.snk
--zip
@ -169,8 +184,22 @@ stages:
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: 'Windows64'
- task: CopyFiles@2
displayName: 'Collect Symbols'
inputs:
sourceFolder: dist
contents: '**/*.pdb'
targetFolder: '$(Build.ArtifactStagingDirectory)/symbols'
# Publish symbol archive to match nuget package
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server
- task: PublishSymbols@2
inputs:
symbolsFolder: '$(Build.ArtifactStagingDirectory)/symbols'
searchPattern: '**/*.pdb'
indexSources: false # Github not supported
publishSymbols: true
symbolServerType: TeamServices
detailedLog: true
- stage: Package
jobs:
@ -506,7 +535,7 @@ stages:
- task: GitHubRelease@0
continueOnError: true
inputs:
gitHubConnection: Z3GitHub
gitHubConnection: Z3Prover
repositoryName: 'Z3Prover/z3'
action: 'delete'
# target: '$(Build.SourceVersion)'
@ -515,7 +544,7 @@ stages:
- task: GitHubRelease@0
continueOnError: true
inputs:
gitHubConnection: Z3GitHub
gitHubConnection: Z3Prover
repositoryName: 'Z3Prover/z3'
action: 'create'
# target: '$(Build.SourceVersion)'
@ -555,15 +584,16 @@ stages:
displayName: 'NuGet Nightly x64 push'
inputs:
command: push
publishVstsFeed: 'Z3Nightly'
publishVstsFeed: 'Z3Build/Z3-Nightly-Builds'
packagesToPush: $(Agent.TempDirectory)/x64/*.nupkg
allowPackageConflicts: true
- task: NuGetCommand@2
displayName: 'NuGet Nightly x86 push'
inputs:
command: push
publishVstsFeed: 'Z3Nightly'
publishVstsFeed: 'Z3Build/Z3-Nightly-Builds'
packagesToPush: $(Agent.TempDirectory)/x86/*.nupkg
allowPackageConflicts: true
# TBD: run regression tests on generated binaries.

View file

@ -6,7 +6,7 @@
trigger: none
variables:
ReleaseVersion: '4.11.0'
ReleaseVersion: '4.11.3'
stages:
@ -56,8 +56,6 @@ stages:
artifactName: 'MacArm64'
targetPath: $(Build.ArtifactStagingDirectory)
- job: UbuntuBuild
displayName: "Ubuntu build"
pool:
@ -87,11 +85,10 @@ stages:
artifactName: 'UbuntuBuild'
targetPath: $(Build.ArtifactStagingDirectory)
- job: UbuntuDoc
displayName: "Ubuntu Doc build"
pool:
vmImage: "Ubuntu-latest"
vmImage: "ubuntu-latest"
steps:
- script: sudo apt-get install ocaml opam libgmp-dev
- script: opam init -y
@ -112,6 +109,7 @@ stages:
eval `opam config env`
cd doc
python mk_api_doc.py --mld --z3py-package-path=../build/python/z3
python mk_params_doc.py
mkdir api/html/ml
ocamldoc -html -d api/html/ml -sort -hide Z3 -I $( ocamlfind query zarith ) -I ../build/api/ml ../build/api/ml/z3enums.mli ../build/api/ml/z3.mli
cd ..
@ -168,6 +166,7 @@ stages:
ReleaseVersion: $(ReleaseVersion)
BuildArchitecture: 'x86'
# Creates Z3 packages in various formats
- stage: Package
jobs:
@ -485,7 +484,7 @@ stages:
path: $(Agent.TempDirectory)
- task: GitHubRelease@0
inputs:
gitHubConnection: Z3GitHub
gitHubConnection: Z3Prover
repositoryName: $(Build.Repository.Name)
action: 'create'
target: '$(Build.SourceVersion)'
@ -498,7 +497,7 @@ stages:
isDraft: true
isPreRelease: true
# Enable on release (after fixing Nuget key)
- job: NuGetPublish
condition: eq(1,0)
displayName: "Publish to NuGet.org"
@ -518,7 +517,6 @@ stages:
nuGetFeedType: External
publishFeedCredentials: $(NugetZ3)
packagesToPush: $(Agent.TempDirectory)/*.nupkg
# Enable on release:
- job: PyPIPublish

View file

@ -776,6 +776,13 @@ def mk_java(java_src, java_dir, package_name):
java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "I");\n')
java_wrapper.write(' jenv->SetIntField(a%s, fid, (jint) _a%s);\n' % (i, i))
java_wrapper.write(' }\n')
elif param_type(param) == STRING:
java_wrapper.write(' {\n')
java_wrapper.write(' jclass mc = jenv->GetObjectClass(a%s);\n' % i)
java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "Ljava/lang/String;");')
java_wrapper.write(' jstring fval = jenv->NewStringUTF(_a%s);\n' % i)
java_wrapper.write(' jenv->SetObjectField(a%s, fid, fval);\n' % i)
java_wrapper.write(' }\n')
else:
java_wrapper.write(' {\n')
java_wrapper.write(' jclass mc = jenv->GetObjectClass(a%s);\n' % i)