Permalink
Browse files

- added NuGetPack target for build script

  • Loading branch information...
1 parent fc20032 commit b869e5ea89581607eb39e77e2b6c70a3fa0a52d1 @desunit desunit committed Sep 19, 2012
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <id>StackExpress.Redis</id>
+ <title>C# Redis client for the Redis NoSQL DB</title>
+ <version>$version$</version>
+ <authors>Demis Bellot</authors>
+ <owners>Demis Bellot</owners>
+ <description>
+ C# Redis Client for the worlds fastest distributed NoSQL datastore. Byte[], String and POCO Typed clients.
+ Thread-Safe Basic and Pooled client managers included.
+ </description>
+ <projectUrl>https://github.com/ServiceStack/ServiceStack.Redis</projectUrl>
+ <licenseUrl>https://github.com/ServiceStack/ServiceStack.Redis/blob/master/LICENSE</licenseUrl>
+ <iconUrl>http://www.servicestack.net/logo-100x100.png</iconUrl>
+ <tags>Redis NoSQL Client Distributed Cache PubSub Messaging Transactions</tags>
+ <language>en-US</language>
+ <copyright>StackExpress 2012 and contributors</copyright>
+ <dependencies>
+ <dependency id="ServiceStack.Common" />
+ </dependencies>
+ </metadata>
+</package>
View
@@ -5,4 +5,11 @@ if "%target%" == "" (
set target=UnitTestsWithoutIntegration
)
+if "%target%" == "NuGetPack" (
+ if "%BUILD_NUMBER%" == "" (
+ echo BUILD_NUMBER environment variable is not set.
+ exit;
+ )
+)
+
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild Build\Build.proj /target:%target% /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false
View
@@ -1,11 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Default"
xmlns='http://schemas.microsoft.com/developer/msbuild/2003' ToolsVersion="4.0">
+ <Import Project="$(MSBuildProjectDirectory)/Build.tasks" />
+
+ <PropertyGroup>
+ <MajorVersion>3</MajorVersion>
+ <MinorVersion>9</MinorVersion>
+ <PatchVersion>$(BUILD_NUMBER)</PatchVersion>
+ </PropertyGroup>
<PropertyGroup>
<BuildSolutionDir>$(MSBuildProjectDirectory)/..</BuildSolutionDir>
+ <SourcesDir>$(BuildSolutionDir)/src</SourcesDir>
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
+ <NuGetPath>$(BuildSolutionDir)/src/.nuget/nuget.exe</NuGetPath>
+ <NuGetPackageDir>$(BuildSolutionDir)/NuGet/</NuGetPackageDir>
+ <NuGetBasePath>$(MSBuildProjectDirectory)</NuGetBasePath>
+ <NuGetPackageLibDir>$(BuildSolutionDir)/NuGet/lib</NuGetPackageLibDir>
+ <NuGetPackageDescription>$(BuildSolutionDir)/NuGet/stackexpress.redis.nuspec</NuGetPackageDescription>
+ <Version>$(MajorVersion).$(MinorVersion).$(PatchVersion).0</Version>
+ <UnstableTag Condition="$(RELEASE) == ''">-unstable</UnstableTag>
+ <PackageVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)$(UnstableTag)</PackageVersion>
</PropertyGroup>
+
+ <ItemGroup>
+ <NugetPackageFilesToDelete Include="$(NuGetPackageDir)/*.nupkg"/>
+ </ItemGroup>
+
+
<PropertyGroup>
<DoBuildSolutionsDependsOn>
BeforeBuildSolutions;
@@ -33,4 +56,26 @@
Properties="Configuration=$(Configuration)" />
</Target>
+ <Target Name="NuGetPack">
+
+ <!-- Update Versino -->
+ <ItemGroup>
+ <RegexTransform Include="$(SourcesDir)/**/AssemblyInfo.cs">
+ <Find>\d+\.\d+\.\d+\.\d+</Find>
+ <ReplaceWith>$(Version)</ReplaceWith>
+ </RegexTransform>
+ </ItemGroup>
+
+ <RegexTransform Items="@(RegexTransform)" />
+
+ <Delete Files="@(NugetPackageFilesToDelete)" />
+
+ <MSBuild Projects="$(BuildSolutionDir)/src/ServiceStack.Redis/ServiceStack.Redis.csproj"
+ Targets="Build"
+ Properties="BuildPackage=true;Version=$(PackageVersion);OutputPath=$(NuGetPackageDir)/lib/net35;Configuration=$(Configuration)" />
+
+ <Exec Command="&quot;$(NuGetPath)&quot; pack &quot;$(NuGetPackageDescription)&quot; -OutputDirectory &quot;$(NuGetPackageDir)&quot; -Version $(PackageVersion)"
+ LogStandardErrorAsError="true" />
+
+ </Target>
</Project>
View
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Go" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <UsingTask TaskName="RegexTransform" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <Items ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
+ </ParameterGroup>
+ <Task>
+ <Using Namespace="System.IO" />
+ <Using Namespace="System.Text.RegularExpressions" />
+ <Using Namespace="Microsoft.Build.Framework" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ foreach(ITaskItem item in Items) {
+ string fileName = item.GetMetadata("FullPath");
+ string find = item.GetMetadata("Find");
+ string replaceWith = item.GetMetadata("ReplaceWith");
+
+ if(!File.Exists(fileName)) {
+ Log.LogError(null, null, null, null, 0, 0, 0, 0, String.Format("Could not find version file: {0}", fileName), new object[0]);
+ }
+ string content = File.ReadAllText(fileName);
+ File.WriteAllText(
+ fileName,
+ Regex.Replace(
+ content,
+ find,
+ replaceWith
+ )
+ );
+ }
+ ]]></Code>
+ </Task>
+ </UsingTask>
+</Project>
View
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <solution>
+ <add key="disableSourceControlIntegration" value="true" />
+ </solution>
+</configuration>
View
Binary file not shown.
View
@@ -0,0 +1,77 @@
+<?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>
+ </PropertyGroup>
+
+ <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>
+ <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>
+ <PackagesDir>$(SolutionDir)packages</PackagesDir>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- NuGet command -->
+ <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <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>
+
+ <!-- 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>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
+ <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="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(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="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ Condition=" '$(OS)' != 'Windows_NT' " />
+
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true"
+ Condition=" '$(OS)' == 'Windows_NT' " />
+ </Target>
+</Project>

0 comments on commit b869e5e

Please sign in to comment.