dotnet-installer/build/SandBoxAndPackage.proj
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

79 lines
No EOL
4.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Layout" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(RepoRoot)/Directory.Build.props" />
<PropertyGroup>
<SandBoxFolderName>bin/WorkingCopy</SandBoxFolderName>
<RelativeSandBoxPackageOutputFolder>$(SandBoxFolderName)/RelativeSandBoxPackageOutputFolder</RelativeSandBoxPackageOutputFolder>
<SandBoxRepoRoot>$(RepoRoot)/$(SandBoxFolderName)/$(LinuxDistrosNeedNativeInstaller)</SandBoxRepoRoot>
<NugetCacheFolderName>.nuget</NugetCacheFolderName>
<RelativeCompileOutputPath>bin/2</RelativeCompileOutputPath>
</PropertyGroup>
<ItemGroup>
<MirrorOfRepoRootForTools Include="$(RepoRoot)/**/*.*" Exclude="$(RepoRoot)/$(SandBoxFolderName)/**/*.*;$(RepoRoot)/nuget/**/*.*;$(RepoRoot)/bin/**/*.*" />
<ArtifactsToPackage Include="$(RepoRoot)/$(RelativeCompileOutputPath)/$(Rid)/**/*.*"/>
<LocalDirectoryBuildpropsToPreventFurtherLookUpForIt Include="$(RepoRoot)/bin/Directory.Build.props"/>
<ToolsCacheToSpeedUp Include="$(RepoRoot)/$(RelativeCLIBuildBinaries)/**/*.*"/>
<NugetCacheToSpeedUp Include="$(RepoRoot)/$(NugetCacheFolderName)/**/*.*" />
</ItemGroup>
<Target Name="SandBoxAndPackage" DependsOnTargets="PackageWithDocker;CopyPackageResult"/>
<Target Name="PrepareSandBox" >
<Copy
SourceFiles="@(MirrorOfRepoRootForTools)"
DestinationFiles="@(MirrorOfRepoRootForTools -> '$(SandBoxRepoRoot)/%(RecursiveDir)%(Filename)%(Extension)')"/>
<Exec Command="sh -c 'cd $(SandBoxRepoRoot) &amp;&amp; git clean -fxd'"/>
<Copy
SourceFiles="@(ArtifactsToPackage)"
DestinationFiles="@(ArtifactsToPackage -> '$(SandBoxRepoRoot)/$(RelativeCompileOutputPath)/$(Rid)/%(RecursiveDir)%(Filename)%(Extension)')"/>
<Copy
SourceFiles="@(LocalDirectoryBuildpropsToPreventFurtherLookUpForIt)"
DestinationFiles="@(LocalDirectoryBuildpropsToPreventFurtherLookUpForIt -> '$(SandBoxRepoRoot)/$(RelativeCompileOutputPath)/$(Rid)/%(RecursiveDir)%(Filename)%(Extension)')"/>
<Copy
SourceFiles="@(ToolsCacheToSpeedUp)"
DestinationFiles="@(ToolsCacheToSpeedUp -> '$(SandBoxRepoRoot)/$(RelativeCLIBuildBinaries)/%(RecursiveDir)%(Filename)%(Extension)')"/>
<Copy
SourceFiles="@(NugetCacheToSpeedUp)"
DestinationFiles="@(NugetCacheToSpeedUp -> '$(SandBoxRepoRoot)/$(NugetCacheFolderName)/%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
<Target Name="PackageWithDocker" DependsOnTargets="PrepareSandBox">
<PropertyGroup>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(SandBoxRepoRoot)/build.sh</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) --configuration $(BuildConfiguration)</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) --docker $(DockerFolder)</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) --skip-prereqs</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) /target:GenerateInstallersAndCopyOutOfSandBox</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandToInvokeBuildScriptInDockerToPackageInSandBox>$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) /p:RelativeSandBoxPackageOutputFolder=$(RelativeSandBoxPackageOutputFolder)</CommandToInvokeBuildScriptInDockerToPackageInSandBox>
<CommandExitCodeFirstTime>0</CommandExitCodeFirstTime>
<PipeStderrToStdoutToCatchFirstFailure>2&gt;&amp;1</PipeStderrToStdoutToCatchFirstFailure>
</PropertyGroup>
<Exec Command="$(CommandToInvokeBuildScriptInDockerToPackageInSandBox) $(PipeStderrToStdoutToCatchFirstFailure)" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ExitCode" PropertyName="CommandExitCodeFirstTime"/>
</Exec>
<PropertyGroup>
<ShouldRetryDueToFirstTimeFailed Condition=" '$(CommandExitCodeFirstTime)' != '0' ">true</ShouldRetryDueToFirstTimeFailed>
</PropertyGroup>
<Exec Condition=" '$(ShouldRetryDueToFirstTimeFailed)' == 'true' " Command="$(CommandToInvokeBuildScriptInDockerToPackageInSandBox)" />
</Target >
<Target Name="CopyPackageResult">
<ItemGroup>
<SandboxPackageResultFiles Include="$(SandBoxRepoRoot)/$(RelativeSandBoxPackageOutputFolder)/**/*.*"/>
</ItemGroup>
<Copy
SourceFiles="@(SandboxPackageResultFiles)"
DestinationFolder="$(InstallerOutputDirectory)/%(RecursiveDir)"/>
</Target >
</Project>