Skip to content

Commit add2f44

Browse files
author
John Gozde
committed
Add prerelease support to package script.
Script also includes libzmq-version.txt, which contains the version of libzmq packaged with the assembly.
1 parent f53e4e9 commit add2f44

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROJ = src/build.proj
2-
FLAGS = /property:OperatingPlatform=Unix
2+
FLAGS = /property:OperatingPlatform=Unix /property:NetFramework=Mono
33
XBUILD = xbuild /tv:4.0
44

55
VERSION =

package.cmd

+17-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ set MSBUILD_EXE=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\msbuild
55
set NUGET_EXE=src\.nuget\nuget.exe
66
set NUSPEC=src\.nuget\clrzmq.nuspec
77
set VERSION_INFO_CS=src\Shared\VersionInfo.cs
8+
set LIBZMQVER_TXT=src\libzmq-version.txt
89

910
:version
1011
set /p VERSION=Enter version (e.g. 1.0):
1112
set /p BUILD=Enter a build (e.g. 11234):
1213
set /p REVISION=Enter a revision (e.g. 7):
13-
set /p MATURITY=Enter maturity (e.g. Alpha, Beta, RC, Release, etc.):
14+
set /p MATURITY=Enter maturity (e.g. alpha1, rc1, or blank for Release):
15+
set /p LIBZMQVER=Enter libzmq version (e.g. 3.1.1, 21571cf):
16+
17+
if not defined MATURITY (
18+
set MATURITY=Release
19+
set PRERELEASE=
20+
) else (
21+
set PRERELEASE=-%MATURITY%
22+
)
1423

1524
:: Shared version info
1625
move %VERSION_INFO_CS% %VERSION_INFO_CS%.bak
@@ -21,12 +30,17 @@ echo [assembly: AssemblyFileVersion("%VERSION%.%BUILD%.%REVISION%")] >> %VERSION
2130
echo [assembly: AssemblyInformationalVersion("%VERSION%.%BUILD%.%REVISION% %MATURITY%")] >> %VERSION_INFO_CS%
2231
echo [assembly: AssemblyConfiguration("%MATURITY%")] >> %VERSION_INFO_CS%
2332

33+
:: libzmq version info
34+
echo %LIBZMQVER% > %LIBZMQVER_TXT%
35+
2436
%MSBUILD_EXE% src\build.proj /target:Package /Property:Configuration=Release /Property:SignAssembly=true
2537

26-
%NUGET_EXE% Pack %NUSPEC% -Version %VERSION%.%REVISION% -OutputDirectory publish -BasePath .
38+
%NUGET_EXE% Pack %NUSPEC% -Version %VERSION%.%REVISION%%PRERELEASE% -OutputDirectory publish -BasePath .
39+
copy LICENSE publish
2740

2841
:: Clean up
2942
move %VERSION_INFO_CS%.bak %VERSION_INFO_CS%
43+
del %LIBZMQVER_TXT%
3044

3145
endlocal
32-
if errorlevel 1 pause else exit
46+
if %ERRORLEVEL% GTR 0 pause else exit

src/.nuget/clrzmq.nuspec

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<file src="publish\clrzmq*.dll" target="lib\net40" />
1919
<file src="publish\*.pdb" target="lib\net40" />
2020
<file src="publish\*.xml" target="lib\net40" />
21+
<file src="src\libzmq-version.txt"/>
2122
<file src="LICENSE"/>
2223
</files>
2324
</package>

src/build.proj

+13-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
<Platform Condition="'$(Platform)' == ''">x86</Platform>
1010
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
1111
<MSpecOptions Condition="'$(MSpecOptions)' == ''"></MSpecOptions>
12-
<KeyFileProperty Condition="'$(SignAssembly)' == 'true'">KeyOriginatorFile=Shared\clrzmq.snk</KeyFileProperty>
12+
<KeyFile>Shared\clrzmq.snk</KeyFile>
13+
<KeyFileProperty Condition="'$(SignAssembly)' == 'true'">KeyOriginatorFile=$(KeyFile)</KeyFileProperty>
1314
<OperatingPlatform Condition="'$(OperatingPlatform)' == ''">Windows</OperatingPlatform>
15+
<NetFramework Condition="'$(NetFramework)' == ''">NET</NetFramework>
1416
<SolutionSuffix Condition="'$(OperatingPlatform)' == 'Unix'">.Mono</SolutionSuffix>
1517
</PropertyGroup>
1618

@@ -22,7 +24,7 @@
2224
<Optimize Condition="'$(Configuration)' != 'Debug'">true</Optimize>
2325

2426
<Constants Condition="'$(OperatingPlatform)' == 'Windows'"></Constants>
25-
<Constants Condition="'$(OperatingPlatform)' == 'Unix'">UNIX</Constants>
27+
<Constants Condition="'$(OperatingPlatform)' == 'Unix'">UNIX;MONO</Constants>
2628
</PropertyGroup>
2729

2830
<ItemGroup>
@@ -46,10 +48,9 @@
4648
</ItemGroup>
4749

4850
<ItemGroup>
49-
<BuildOutput Include="$(BuildDir)\*.*" />
50-
5151
<ZeroMQSources Include="ZeroMQ\**\*.cs;Shared\*.cs" Exclude="ZeroMQ\**\Platform.*.cs" />
5252
<ZeroMQSources Include="ZeroMQ\**\Platform.$(OperatingPlatform).cs" />
53+
<ZeroMQSources Include="ZeroMQ\**\Platform.$(NetFramework).cs" />
5354

5455
<Resources Include="$(LibDir)\x64\libzmq.dll">
5556
<Platform>x64</Platform>
@@ -90,6 +91,9 @@
9091
</Target>
9192

9293
<Target Name="Package">
94+
<RemoveDir Directories="$(BuildDir)" />
95+
<MakeDir Directories="$(BuildDir)" />
96+
9397
<Csc Sources="@(ZeroMQSources)"
9498
DocumentationFile="$(BuildDir)\clrzmq.xml"
9599
OutputAssembly="$(BuildDir)\clrzmq.dll"
@@ -98,10 +102,14 @@
98102
DebugType="$(DebugType)"
99103
PdbFile="$(BuildDir)\clrzmq.pdb"
100104
Optimize="$(Optimize)"
101-
KeyFile="Shared\clrzmq.snk"
105+
KeyFile="$(KeyFile)"
102106
DefineConstants="$(Constants)"
103107
/>
104108

109+
<ItemGroup>
110+
<BuildOutput Include="$(BuildDir)\*.*;$(SolutionDir)\*.txt" />
111+
</ItemGroup>
112+
105113
<RemoveDir Directories="$(PackageDir)" />
106114
<MakeDir Directories="$(PackageDir)" />
107115
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(PackageDir)" ContinueOnError="false" />

0 commit comments

Comments
 (0)