dotnet-installer/build/Prepare.targets
William Lee 221ab05346 Use one build definition to produce all Linux distro specific packages (#7615)
By using `./build.sh /t:AllLiuxDistrosNativeInstaller`

Make a sandbox folder after compile step and copy compiled artifact to it. Since the content will be Linux generic, use package step with Docker in different distros.
After finishing all the distro specific packaging, upload all of them at once

Publish to debian only support all distro

Improve perf of AllLiuxDistrosNativeInstaller, by copying more cache in to sandbox

There will be a retry if package command failed
2017-09-14 13:33:46 -07:00

144 lines
6.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.DotNet.Cli.tasks" />
<Import Project="prepare/CheckPrereqs.targets" />
<Target Name="Prepare"
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages;IsolateArtifactsFromDirectoryBuildFiles;CreatePropsForNextStage" />
<Target Name="Init"
DependsOnTargets="PrintBuildInfo;
SetTelemetryProfile;
BuildDotnetCliBuildFramework;
CheckPrereqs;">
</Target>
<Target Name="SandBoxPrepare"
DependsOnTargets="PrintBuildInfo;
CheckPrereqs;
DownloadHostAndSharedFxArtifacts;
IsolateArtifactsFromDirectoryBuildFiles;
CreatePropsForNextStage">
</Target>
<Target Name="PrintBuildInfo">
<Message Text="Host info - Rid: $(HostRid), OSName: $(HostOSName)" Importance="High" />
<Message Text="Build info - Rid: $(Rid), Architecture: $(Architecture), OSName: $(OSName)" Importance="High" />
<Message Text="If you intended to use a different Rid, Architecture, or OSName run the following command to generate your build state:" Importance="High" />
<Message Text="dotnet msbuild build.proj /p:Architecture=Architecture /p:Rid=Rid /p:OSName=OSName /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles" Importance="High" />
</Target>
<Target Name="SetTelemetryProfile"
DependsOnTargets="BuildDotnetCliBuildFramework" >
<SetEnvVar Name="DOTNET_CLI_TELEMETRY_PROFILE" Value="$(DOTNET_CLI_TELEMETRY_PROFILE);https://github.com/dotnet/cli;$(CommitHash)" />
</Target>
<Target Name="DownloadHostAndSharedFxArtifacts">
<PropertyGroup>
<OverwriteExtractionDestination>%(_DownloadAndExtractItem.OverwriteDestination)</OverwriteExtractionDestination>
<OverwriteExtractionDestination Condition="'$(OverwriteExtractionDestination)' == ''">True</OverwriteExtractionDestination>
</PropertyGroup>
<DownloadFile Condition=" '@(_DownloadAndExtractItem)' != '' "
Uri="%(_DownloadAndExtractItem.Url)"
DestinationPath="%(_DownloadAndExtractItem.DownloadFileName)" />
<ZipFileExtractToDirectory Condition=" '%(_DownloadAndExtractItem.ExtractDestination)' != '' AND $([System.String]::new('%(_DownloadAndExtractItem.DownloadFileName)').EndsWith('.zip')) "
SourceArchive="%(_DownloadAndExtractItem.DownloadFileName)"
DestinationDirectory="%(_DownloadAndExtractItem.ExtractDestination)"
OverwriteDestination="$(OverwriteExtractionDestination)" />
<TarGzFileExtractToDirectory Condition=" '%(_DownloadAndExtractItem.ExtractDestination)' != '' AND $([System.String]::new('%(_DownloadAndExtractItem.DownloadFileName)').EndsWith('.tar.gz')) "
SourceArchive="%(_DownloadAndExtractItem.DownloadFileName)"
DestinationDirectory="%(_DownloadAndExtractItem.ExtractDestination)"
OverwriteDestination="$(OverwriteExtractionDestination)" />
</Target>
<Target Name="RestoreSrcPackages"
DependsOnTargets="SetupRestoreSrcPackagesInputsOutputs;Init"
Inputs="@(RestoreSrcPackagesInput)"
Outputs="@(RestoreSrcPackagesInput->'%(RelativeDir)/obj/project.assets.json');@(RestoreSrcPackagesInput->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.props');@(RestoreSrcPackagesInput->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.targets')">
<CallTarget Targets="CleanSrcLockFiles" />
<DotNetRestore ToolPath="$(PreviousStageDirectory)"
ProjectPath="&quot;%(RestoreSrcPackagesInput.FullPath)&quot;" />
</Target>
<Target Name="CleanSrcLockFiles" >
<ItemGroup>
<SrcLockFiles Include="$(RepoRoot)/src/**/project.assets.json;$(RepoRoot)/src/**/*.csproj.nuget.g.props;$(RepoRoot)/src/**/*.csproj.nuget.g.targets" />
</ItemGroup>
<Delete Files="@(SrcLockFiles)" />
</Target>
<Target Name="SetupRestoreSrcPackagesInputsOutputs">
<ItemGroup>
<RestoreSrcPackagesInput Include="$(RepoRoot)/src/**/*.csproj" Exclude="$(RepoRoot)/src/**/%24projectName%24.csproj"/>
</ItemGroup>
</Target>
<Target Name="RestoreToolsPackages"
DependsOnTargets="SetupRestoreToolsPackagesInputsOutputs;Init"
Inputs="@(RestoreToolsPackagesInput)"
Outputs="@(RestoreToolsPackagesInput->'%(RelativeDir)/obj/project.assets.json');@(RestoreToolsPackagesInput->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.props');@(RestoreToolsPackagesInput->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.targets')">
<CallTarget Targets="CleanToolsLockFiles" />
<DotNetRestore ToolPath="$(PreviousStageDirectory)"
ProjectPath="&quot;%(RestoreToolsPackagesInput.FullPath)&quot;"
AdditionalParameters="/p:UsePortableLinuxSharedFramework=$(UsePortableLinuxSharedFramework)" />
</Target>
<Target Name="CleanToolsLockFiles" >
<ItemGroup>
<ToolsLockFiles Include="$(RepoRoot)/tools/**/project.assets.json;$(RepoRoot)/tools/**/*.csproj.nuget.g.props;$(RepoRoot)/tools/**/*.csproj.nuget.g.targets" />
</ItemGroup>
<Delete Files="@(ToolsLockFiles)" />
</Target>
<Target Name="SetupRestoreToolsPackagesInputsOutputs">
<ItemGroup>
<RestoreToolsPackagesInput Include="$(RepoRoot)/tools/**/*.csproj" />
</ItemGroup>
</Target>
<Target Name="IsolateArtifactsFromDirectoryBuildFiles">
<Copy SourceFiles="$(RepoRoot)TestAssets\Directory.Build.props"
DestinationFolder ="$(RepoRoot)bin"
SkipUnchangedFiles="true" />
</Target>
<Target Name="CreatePropsForNextStage">
<PropertyGroup>
<NextStagePropsContent>
&lt;Project&gt;
&lt;PropertyGroup&gt;
&lt;PreviousStageDirectory&gt;$(OutputDirectory)&lt;/PreviousStageDirectory&gt;
&lt;PreviousStageDotnet&gt;$(DotnetInOutputDirectory)&lt;/PreviousStageDotnet&gt;
&lt;CliOuterBuildStage&gt;$(CliBuildStage)&lt;/CliOuterBuildStage&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</NextStagePropsContent>
<ExistingNextStagePropsContent Condition=" Exists('$(NextStagePropsPath)') ">
$([System.IO.File]::ReadAllText($(NextStagePropsPath)))
</ExistingNextStagePropsContent>
<ShouldOverwriteNextStagePropsFile>false</ShouldOverwriteNextStagePropsFile>
<ShouldOverwriteNextStagePropsFile
Condition=" '$(ExistingNextStagePropsContent.Trim())' != '$(NextStagePropsContent.Trim())' ">true</ShouldOverwriteNextStagePropsFile>
</PropertyGroup>
<WriteLinesToFile File="$(NextStagePropsPath)"
Lines="$(NextStagePropsContent)"
Condition=" '$(ShouldOverwriteNextStagePropsFile)' == 'true' "
Overwrite="true" />
</Target>
</Project>