aspnetcore/build/repo.targets

57 lines
2.5 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<Import Project="common.props" />
<PropertyGroup>
<DependencyBuildDirectory>$(RepositoryRoot).deps\build\</DependencyBuildDirectory>
<PrepareDependsOn>
$(PrepareDependsOn);
UpdateNuGetConfig
</PrepareDependsOn>
<CompileDependsOn Condition="'$(BUILD_PACKAGE_CACHE)' == 'true'">
$(CompileDependsOn);
BuildPackageCache
</CompileDependsOn>
</PropertyGroup>
<Target Name="UpdateNuGetConfig">
<UpdatePackageSource
NuGetConfigPath="$(RepositoryRoot)NuGet.config"
SourceName="Dependencies"
SourceUri="$(DependencyBuildDirectory)"
Condition="Exists('$(DependencyBuildDirectory)')" />
</Target>
<Target Name="BuildPackageCache">
<GetOSPlatform>
<!-- Returns {Linux, macOS, Windows} -->
<Output TaskParameter="PlatformName" PropertyName="OSPlatform" />
</GetOSPlatform>
<PropertyGroup>
<MetaPackagePath>$(RepositoryRoot)src\Microsoft.AspNetCore.All\</MetaPackagePath>
<MetaPackageFile>$(MetaPackagePath)Microsoft.AspNetCore.All.csproj</MetaPackageFile>
<WorkingDirectory>$(MetaPackagePath)bin\work</WorkingDirectory>
<OutputPath>$(MetaPackagePath)bin\packageCache\</OutputPath>
<OutputZip Condition="'$(OSPlatform)' == 'Windows'">$(RepositoryRoot)artifacts\AspNetCorePackageCache.win.zip</OutputZip>
<OutputZip Condition="'$(OSPlatform)' == 'Linux'">$(RepositoryRoot)artifacts\AspNetCorePackageCache.linux.zip</OutputZip>
<OutputZip Condition="'$(OSPlatform)' == 'macOS'">$(RepositoryRoot)artifacts\AspNetCorePackageCache.osx.zip</OutputZip>
</PropertyGroup>
<ItemGroup>
<RIDs Include="win7-x64" Condition="'$(OSPlatform)' == 'Windows'" />
<RIDs Include="win7-x86" Condition="'$(OSPlatform)' == 'Windows'" />
<RIDs Include="linux-x64" Condition="'$(OSPlatform)' == 'Linux'" />
<RIDs Include="osx.10.12-x64" Condition="'$(OSPlatform)' == 'macOS'" />
</ItemGroup>
<RemoveDir Directories="$(OutputPath)" />
<RemoveDir Directories="$(WorkingDirectory)-%(RIDs.Identity)\" />
<Exec Command="dotnet store --manifest $(MetaPackageFile) --configuration Release --framework netcoreapp2.0 --runtime %(RIDs.Identity) --output $(OutputPath) --framework-version 2.0.0-* --working-dir $(WorkingDirectory)-%(RIDs.Identity)\" />
<ItemGroup>
<PackageCacheFiles Include="$(OutputPath)**\*" />
</ItemGroup>
<ZipArchive File="$(OutputZip)" SourceFiles="@(PackageCacheFiles)" WorkingDirectory="$(OutputPath)" />
</Target>
</Project>