Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade to NuGet 2.0.

- Import libzmq as a solution-level package.
  • Loading branch information...
commit ef1120ebe9037bbd850b618e185ff99f0e4311e8 1 parent 930bd19
@jgoz jgoz authored
View
1  .gitignore
@@ -12,7 +12,6 @@ lib-*
# NuGet-related
packages
-nuget.exe
# User Settings
*.suo
View
2  README.md
@@ -106,7 +106,7 @@ clrzmq depends on `libzmq.dll`, which will be retrieved automatically via NuGet.
If you want to use a custom build of `libzmq.dll`, perform the following steps:
-1. Delete or rename the `src/ZeroMQ/packages.config` file. This prevent the NuGet package from being retrieved.
+1. Delete or rename the `src/.nuget/packages.config` file. This prevent the NuGet package from being retrieved.
2. Remove any folders matching `src/packages/libzmq-*` that may have been downloaded previously.
3. Copy the 32-bit and 64-bit (if applicable) build of `libzmq.dll` to `lib/x86` and `lib/x64`, respectively.
View
7 nuget.sh
@@ -1,13 +1,6 @@
#!/bin/sh
NUGET_EXE=src/.nuget/nuget.exe
-NUGET_BOOTSTRAPPER_EXE=src/.nuget/nuget-bootstrap.exe
PACKAGE_DIR=src/packages
-if [ ! -e $NUGET_EXE ]; then
- mono --runtime=v4.0 $NUGET_BOOTSTRAPPER_EXE
- mv $NUGET_BOOTSTRAPPER_EXE $NUGET_EXE
- mv ${NUGET_BOOTSTRAPPER_EXE}.old $NUGET_BOOTSTRAPPER_EXE
-fi
-
find . -name 'packages.config' -exec mono --runtime=v4.0 $NUGET_EXE install '{}' -o $PACKAGE_DIR \;
View
BIN  src/.nuget/NuGet.exe
Binary file not shown
View
208 src/.nuget/NuGet.targets
@@ -1,62 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
- <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
- <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
- <NuGetBootstrapExePath>$(NuGetToolsPath)\nuget-bootstrap.exe</NuGetBootstrapExePath>
- <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
- <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
- <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
-
- <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
- <PackageSources>""</PackageSources>
-
- <!-- Enable the restore command to run before builds -->
- <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
-
- <!-- Property that enables building a package from a project -->
- <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
-
- <!-- Commands -->
- <RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
- <BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
-
- <!-- Make the build depend on restore packages -->
- <BuildDependsOn Condition="$(RestorePackages) == 'true'">
- RestorePackages;
- $(BuildDependsOn);
- </BuildDependsOn>
-
- <!-- Make the build depend on restore packages -->
- <BuildDependsOn Condition="$(BuildPackage) == 'true'">
- $(BuildDependsOn);
- BuildPackage;
- </BuildDependsOn>
- </PropertyGroup>
-
- <Target Name="InstallNuGet">
- <Exec Command="$(NuGetBootstrapExePath)"></Exec>
- <Move SourceFiles="$(NuGetBootstrapExePath)" DestinationFiles="$(NuGetExePath)" />
- <Move SourceFiles="$(NuGetBootstrapExePath).old" DestinationFiles="$(NuGetBootstrapExePath)" />
- </Target>
-
- <Target Name="CheckPrerequisites">
- <!-- Raise an error if we're unable to locate nuget.exe -->
- <Error Condition="!Exists('$(NuGetBootstrapExePath)')" Text="Unable to locate '$(NuGetBootstrapExePath)'" />
- <CallTarget Targets="InstallNuGet" Condition="!Exists('$(NuGetExePath)')" />
- </Target>
-
- <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(RestoreCommand)"
- LogStandardErrorAsError="true"
- Condition="Exists('$(PackagesConfig)')"
- WorkingDirectory="$(NuGetToolsPath)" />
- </Target>
-
- <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(BuildCommand)"
- LogStandardErrorAsError="true"
- WorkingDirectory="$(NuGetToolsPath)" />
- </Target>
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
+
+ <!-- Download NuGet.exe if it does not already exist -->
+ <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
+ </PropertyGroup>
+
+ <ItemGroup Condition=" '$(PackageSources)' == '' ">
+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+ <!--
+ <PackageSource Include="https://nuget.org/api/v2/" />
+ <PackageSource Include="https://my-nuget-source/nuget/" />
+ -->
+ </ItemGroup>
+
+ <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
+ <!-- Windows specific commands -->
+ <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
+ <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
+ <SolutionPackagesConfig>$([System.IO.Path]::Combine($(NuGetToolsPath), "packages.config"))</SolutionPackagesConfig>
+ <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
+ <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
+ <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
+ <PackagesConfig>packages.config</PackagesConfig>
+ <SolutionPackagesConfig>$(NuGetToolsPath)\packages.config</SolutionPackagesConfig>
+ <PackagesDir>$(SolutionDir)packages</PackagesDir>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- NuGet command -->
+ <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
+
+ <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
+ <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
+
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <!-- Commands -->
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand>
+ <RestoreSolutionCommand>$(NuGetCommand) install "$(SolutionPackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreSolutionCommand>
+ <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ <SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
+ <SetEnvironmentVariable EnvKey="EnableNuGetPackageRestore" EnvValue="true" />
+ <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
+ </Target>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
+
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="RestoreSolutionPackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreSolutionCommand)"
+ Condition="'$(OS)' != 'Windows_NT' And Exists('$(SolutionPackagesConfig)')" />
+
+ <Exec Command="$(RestoreSolutionCommand)"
+ LogStandardErrorAsError="true"
+ Condition="'$(OS)' == 'Windows_NT' And Exists('$(SolutionPackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ Condition=" '$(OS)' != 'Windows_NT' " />
+
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true"
+ Condition=" '$(OS)' == 'Windows_NT' " />
+ </Target>
+
+ <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <OutputFilename ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Reference Include="System.Core" />
+ <Using Namespace="System" />
+ <Using Namespace="System.IO" />
+ <Using Namespace="System.Net" />
+ <Using Namespace="Microsoft.Build.Framework" />
+ <Using Namespace="Microsoft.Build.Utilities" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ try {
+ OutputFilename = Path.GetFullPath(OutputFilename);
+
+ Log.LogMessage("Downloading latest version of NuGet.exe...");
+ WebClient webClient = new WebClient();
+ webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
+
+ return true;
+ }
+ catch (Exception ex) {
+ Log.LogErrorFromException(ex);
+ return false;
+ }
+ ]]>
+ </Code>
+ </Task>
+ </UsingTask>
+
+ <UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <EnvKey ParameterType="System.String" Required="true" />
+ <EnvValue ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Using Namespace="System" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ try {
+ Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
+ }
+ catch {
+ }
+ ]]>
+ </Code>
+ </Task>
+ </UsingTask>
</Project>
View
BIN  src/.nuget/nuget-bootstrap.exe
Binary file not shown
View
0  src/ZeroMQ/packages.config → src/.nuget/packages.config
File renamed without changes
View
17 src/build.proj
@@ -1,6 +1,4 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
-
- <Import Project="$(SolutionDir)CustomTasks.targets" />
<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)' == ''">.</SolutionDir>
@@ -17,6 +15,9 @@
<NetFramework Condition="'$(NetFramework)' == ''">NET</NetFramework>
<SolutionSuffix Condition="'$(OperatingPlatform)' == 'Unix'">.Mono</SolutionSuffix>
</PropertyGroup>
+
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
+ <Import Project="$(SolutionDir)\CustomTasks.targets" />
<PropertyGroup>
<DebugType Condition="'$(Configuration)' == 'Debug'">full</DebugType>
@@ -28,7 +29,7 @@
<Constants Condition="'$(OperatingPlatform)' == 'Windows'"></Constants>
<Constants Condition="'$(OperatingPlatform)' == 'Unix'">UNIX;MONO</Constants>
</PropertyGroup>
-
+
<ItemGroup>
<CleanFiles Include="$(BuildDir)" />
<CleanFiles Include="$(SolutionDir)\**\bin\$(Configuration)\**" />
@@ -43,12 +44,12 @@
<OutputFiles Include="$(SolutionDir)\**\bin\$(Configuration)\*.xml" />
<OutputFiles Include="$(LibDir)\$(Platform)\*.dll" />
</ItemGroup>
-
+
<ItemGroup>
<ZeroMQSources Include="ZeroMQ\**\*.cs;Shared\*.cs" Exclude="ZeroMQ\**\Platform.*.cs" />
<ZeroMQSources Include="ZeroMQ\**\Platform.$(OperatingPlatform).cs" />
<ZeroMQSources Include="ZeroMQ\**\Platform.$(NetFramework).cs" />
-
+
<Resources Include="$(LibDir)\x64\libzmq.dll">
<Platform>x64</Platform>
</Resources>
@@ -68,8 +69,8 @@
<Target Name="Initialize" DependsOnTargets="Clean">
<MakeDir Directories="$(BuildDir)" />
</Target>
-
- <Target Name="Compile" DependsOnTargets="Initialize">
+
+ <Target Name="Compile" DependsOnTargets="Initialize;RestoreSolutionPackages">
<MSBuild Projects="clrzmq$(SolutionSuffix).sln" Targets="Build" Properties="Configuration=$(Configuration);Platform=$(Platform);$(KeyFileProperty);RestorePackages=true" />
</Target>
@@ -91,7 +92,7 @@
<Exec Condition="'$(OperatingPlatform)' == 'Windows'" Command="$(MSpecExe) $(MSpecOptions) %(TestAssembly.Identity)" />
<!--<Exec Condition="'$(OperatingPlatform)' == 'Unix'" Command="$(MSpecExe) $(MSpecOptions) %(TestAssembly.Identity)" />-->
</Target>
-
+
<Target Name="Build" DependsOnTargets="Test">
<Copy SourceFiles="@(OutputFiles)" DestinationFolder="$(BuildDir)" ContinueOnError="true" />
</Target>
View
3  src/clrzmq.sln
@@ -47,7 +47,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{193968
ProjectSection(SolutionItems) = preProject
.nuget\clrzmq.nuspec = .nuget\clrzmq.nuspec
.nuget\libzmq.nuspec = .nuget\libzmq.nuspec
- .nuget\nuget-bootstrap.exe = .nuget\nuget-bootstrap.exe
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Please sign in to comment.
Something went wrong with that request. Please try again.