From 7941074fd116ea300cac8d2369a7c489b12e3e19 Mon Sep 17 00:00:00 2001 From: Andrew Helwer Date: Sat, 6 Oct 2018 18:22:55 -0700 Subject: [PATCH] Added packaging directions, removed linkresource flag --- package/Microsoft.Z3.x64.nuspec | 22 +++++++++++++++++ package/Microsoft.Z3.x64.targets | 12 ++++++++++ package/PackageCreationDirections.md | 36 ++++++++++++++++++++++++++++ scripts/mk_util.py | 3 --- src/api/dotnet/CMakeLists.txt | 5 ---- 5 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 package/Microsoft.Z3.x64.nuspec create mode 100644 package/Microsoft.Z3.x64.targets create mode 100644 package/PackageCreationDirections.md diff --git a/package/Microsoft.Z3.x64.nuspec b/package/Microsoft.Z3.x64.nuspec new file mode 100644 index 000000000..95d594dfb --- /dev/null +++ b/package/Microsoft.Z3.x64.nuspec @@ -0,0 +1,22 @@ + + + + Microsoft.Z3.x64 + $(releaseVersion) + © Microsoft Corporation. All rights reserved. + Microsoft + Microsoft,Z3Prover + $(iconUrlFromReleaseCommit) + https://github.com/Z3Prover/z3 + $(licenseUrlFromReleaseCommit) + + true + Z3 is a constraint/SMT solver and theorem prover from Microsoft Research. + smt constraint solver theorem prover + + diff --git a/package/Microsoft.Z3.x64.targets b/package/Microsoft.Z3.x64.targets new file mode 100644 index 000000000..772ed2ff7 --- /dev/null +++ b/package/Microsoft.Z3.x64.targets @@ -0,0 +1,12 @@ + + + + + + false + libz3.dll + PreserveNewest + + + + diff --git a/package/PackageCreationDirections.md b/package/PackageCreationDirections.md new file mode 100644 index 000000000..930ba14f7 --- /dev/null +++ b/package/PackageCreationDirections.md @@ -0,0 +1,36 @@ +# Z3 NuGet packaging + +## Creation + + 1. After tagging a commit for release, sign Microsoft.Z3.dll and libz3.dll (both x86 and x64 versions) with Microsoft's Authenticode certificate + 2. Test the signed DLLs with the `Get-AuthenticodeSignature` PowerShell commandlet + 3. Create the following directory structure for the x64 package (for x86, substitute the "x64" strings for "x86" and use x86 DLLs): + ``` + +-- Microsoft.Z3.x64 + | +-- Microsoft.Z3.x64.nuspec + | +-- lib + | +-- net40 + | +-- Microsoft.Z3.dll + | +-- build + | +-- Microsoft.Z3.x64.targets + | +-- libz3.dll + ``` + 4. Open the nuspec file and fill in the appropriate macro values (note that for all URLs, preserve link integrity by linking to a specific commit): + * $(releaseVersion) - the Z3 version being released in this package + * $(iconUrlFromReleaseCommit) - URL for the Z3 icon file + * $(licenseUrlFromReleaseCommit) - URL for the Z3 repo license + * $(releaseCommitHash) - hash of the release commit + 5. Run `nuget pack Microsoft.Z3.x64\Microsoft.Z3.x64.nuspec` + 6. Test the resulting nupkg file (described below) then submit the package for signing before uploading to NuGet.org + +## Testing + + 1. Create a directory on your machine at C:\nuget-test-source + 2. Put the Microsoft.Z3.x64.nupkg file in the directory + 3. Open Visual Studio 2017, create a new C# project, then right click the project and click "Manage NuGet packages" + 4. Add a new package source - your C:\nuget-test-source directory + 5. Find the Microsoft.Z3.x64 package, ensuring in preview window that icon is present and all fields correct + 6. Install the Microsoft.Z3.x64 package, ensuring you are asked to accept the license + 7. Build your project. Check the output directory to ensure both Microsoft.Z3.dll and libz3.dll are present + 8. Import Microsoft.Z3 to your project then add a simple line of code like `using (var ctx = new Context()) { }`; build then run your project to ensure the assemblies load properly + \ No newline at end of file diff --git a/scripts/mk_util.py b/scripts/mk_util.py index ebe017739..471edd7cb 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -1668,9 +1668,6 @@ class DotNetDLLComponent(Component): '/noconfig', '/nostdlib+', '/reference:mscorlib.dll', - # Under mono this isn't neccessary as mono will search the system - # library paths for libz3.so - '/linkresource:{}.dll'.format(get_component(Z3_DLL_COMPONENT).dll_name), ] ) diff --git a/src/api/dotnet/CMakeLists.txt b/src/api/dotnet/CMakeLists.txt index 50f643c8d..20621e4fc 100644 --- a/src/api/dotnet/CMakeLists.txt +++ b/src/api/dotnet/CMakeLists.txt @@ -147,11 +147,6 @@ if (DOTNET_TOOLCHAIN_IS_WINDOWS) "/nostdlib+" "/reference:mscorlib.dll" ) - # FIXME: This flag only works when the working directory of csc.exe is - # the directory containing the ``libz3`` target. I can't get this to work - # correctly with multi-configuration generators (i.e. Visual Studio) so - # just don't set the flag for now. - #list(APPEND CSC_FLAGS "/linkresource:$") elseif (DOTNET_TOOLCHAIN_IS_MONO) # We need to give the assembly a strong name so that it can be installed # into the GAC.