Mercurial > silverbladetech
annotate Library/.nuget/NuGet.targets @ 121:8f94475d3146 tip
final code
author | stevenh7776 |
---|---|
date | Thu, 31 May 2012 15:35:26 +0100 |
parents | aef06698d9e2 |
children |
rev | line source |
---|---|
43
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="utf-8"?> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 <PropertyGroup> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 <!-- Windows specific commands --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 <NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 <PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 <PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 <!-- We need to launch nuget.exe with the mono command if we're not on windows --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 <NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 <PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 <PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 <!-- NuGet command --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 <PackageSources>""</PackageSources> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 <!-- Enable the restore command to run before builds --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 <!-- Property that enables building a package from a project --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 <!-- Commands --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 <!-- Make the build depend on restore packages --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 <BuildDependsOn Condition="$(RestorePackages) == 'true'"> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 RestorePackages; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 $(BuildDependsOn); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 </BuildDependsOn> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 <!-- Make the build depend on restore packages --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 <BuildDependsOn Condition="$(BuildPackage) == 'true'"> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 $(BuildDependsOn); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45 BuildPackage; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 </BuildDependsOn> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 </PropertyGroup> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 <Target Name="CheckPrerequisites"> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 <!-- Raise an error if we're unable to locate nuget.exe --> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" /> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 </Target> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites"> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55 <Exec Command="$(RestoreCommand)" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" /> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
58 <Exec Command="$(RestoreCommand)" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
59 LogStandardErrorAsError="true" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
60 Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" /> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
61 </Target> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
62 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
63 <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites" Condition=" '$(OS)' != 'Windows_NT' "> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
64 <Exec Command="$(BuildCommand)" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
65 Condition=" '$(OS)' != 'Windows_NT' " /> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
66 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
67 <Exec Command="$(BuildCommand)" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
68 LogStandardErrorAsError="true" |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
69 Condition=" '$(OS)' == 'Windows_NT' " /> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
70 </Target> |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
71 </Project> |