AspNetOutputCache/tools/NuProj.targets

129 строки
4.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
DEFAULTS
Those can be overriden.
-->
<PropertyGroup>
<OutDir Condition=" '$(OutDir)' == ''" >$(MSBuildProjectDirectory)\bin\</OutDir>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(MSBuildProjectDirectory)\obj\</IntermediateOutputPath>
<NuSpecPath Condition=" '$(NuSpecPath)' == '' ">$(IntermediateOutputPath)$(Id).nuspec</NuSpecPath>
<NuProjTasksPath Condition=" '$(NuProjTasksPath)' == '' ">$(MSBuildThisFileDirectory)NuProj.Tasks.dll</NuProjTasksPath>
<NuGetToolPath Condition=" '$(NuGetToolPath)' == '' ">$(MSBuildThisFileDirectory)</NuGetToolPath>
<NuGetToolExe Condition=" '$(NuGetToolExe)' == '' ">NuGet.exe</NuGetToolExe>
</PropertyGroup>
<!--
OUPUT PATH
This property isn't passed to NuGet.exe - it's implicit. However, we need to know the ouput path
at several occasions (e.g. incremental build or clean up) so we want a central spot to capture it.
-->
<PropertyGroup>
<NuGetOuputPath>$(OutDir)$(Id).$(Version).nupkg</NuGetOuputPath>
</PropertyGroup>
<!--
MSBuildAllProjects is used to keep track of all projects the build depends on.
We make all targets depending on it to make sure everything rebuilds.
-->
<PropertyGroup>
<MSBuildAllProjects Condition="Exists('$(MSBuildProjectFullPath)')">$(MSBuildAllProjects);$(MSBuildProjectFullPath)</MSBuildAllProjects>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<!--
CUSTOM TASKS
-->
<UsingTask TaskName="GenerateNuSpec" AssemblyFile="$(NuProjTasksPath)" />
<UsingTask TaskName="NuGetPack" AssemblyFile="$(NuProjTasksPath)" />
<!--
CONVERT ITEMS
-->
<Target Name="ConvertItems">
<CreateItem Include="@(Library)"
AdditionalMetadata="TargetPath=lib\%(Library.TargetFramework)">
<Output TaskParameter="Include"
ItemName="File"/>
</CreateItem>
<CreateItem Include="@(Content)"
AdditionalMetadata="TargetPath=content\%(Content.TargetPath)">
<Output TaskParameter="Include"
ItemName="File"/>
</CreateItem>
</Target>
<!--
GENERATE NU SPEC
-->
<Target Name="GenerateNuSpec"
Inputs="$(MSBuildAllProjects)"
Outputs="$(NuSpecPath)"
DependsOnTargets="ConvertItems">
<GenerateNuSpec OutputFileName="$(NuSpecPath)"
Id="$(Id)"
Version="$(Version)"
Title="$(Title)"
Authors="$(Authors)"
Owners="$(Owners)"
Description="$(Description)"
ReleaseNotes="$(ReleaseNotes)"
Summary="$(Summary)"
Language="$(Language)"
ProjectUrl="$(ProjectUrl)"
IconUrl="$(IconUrl)"
LicenseUrl="$(LicenseUrl)"
Copyright="$(Copyright)"
RequireLicenseAcceptance="$(RequireLicenseAcceptance)"
Tags="$(Tags)"
Dependencies="@(Dependency)"
References="@(Reference)"
FrameworkReferences="@(FrameworkReference)"
Files="@(File)"/>
</Target>
<!--
CREATE PACKAGE
-->
<Target Name="CreatePackage"
Inputs="$(MSBuildAllProjects);
$(NuSpecPath);
@(File)"
Outputs="$(NuGetOuputPath)"
DependsOnTargets="GenerateNuSpec">
<MakeDir Directories="$(OutDir)"
Condition="!Exists('$(OutDir)')" />
<NuGetPack OutputDirectory="$(OutDir)"
ToolPath="$(NuGetToolPath)"
ToolExe="$(NuGetToolExe)"
NuSpecPath="$(NuSpecPath)"/>
</Target>
<!--
STANDARD BUILD TARGETS
-->
<Target Name="Clean">
<ItemGroup>
<_ToBeDeleted Include="$(NuSpecPath)" />
<_ToBeDeleted Include="$(NuGetOuputPath)" />
</ItemGroup>
<Delete Files="@(_ToBeDeleted)" />
</Target>
<Target Name="Build" DependsOnTargets="CreatePackage" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
</Project>