aspnetcore/build/RepositoryBuild.targets

89 строки
4.8 KiB
XML

<Project>
<Target Name="_BuildRepositories" Condition=" @(RepositoryBuildOrder->Count()) != 0 ">
<ItemGroup>
<BatchedRepository Include="$(MSBuildProjectFullPath)">
<BuildGroup>%(RepositoryBuildOrder.Order)</BuildGroup>
<Repository>%(RepositoryBuildOrder.Identity)</Repository>
<AdditionalProperties>
RepositoryToBuild=%(RepositoryBuildOrder.Identity);
BuildRepositoryRoot=$([MSBuild]::NormalizeDirectory(%(RepositoryBuildOrder.RootPath)))
</AdditionalProperties>
</BatchedRepository>
</ItemGroup>
<PropertyGroup>
<BatchBuilds Condition="$(BuildInParallel) AND '$(CompileOnly)'=='true'">true</BatchBuilds>
<BatchBuilds Condition="'$(BatchBuilds)'==''">false</BatchBuilds>
</PropertyGroup>
<ItemGroup>
<PinnedArtifactInfo Include="@(ArtifactInfo)" Condition="'$(BuildGraphOf)' == ''" />
</ItemGroup>
<!-- If we are building a sub-graph, we need to re-examine the list of artifacts that will actual build. -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetArtifactInfo"
Properties="RepositoryRoot=$(SubmoduleRoot)%(RepositoryBuildOrder.Identity)\;Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
Condition="'$(BuildGraphOf)' != ''">
<Output TaskParameter="TargetOutputs" ItemName="PinnedArtifactInfo" />
</MSBuild>
<MSBuild
Projects="@(BatchedRepository)"
BuildInParallel="$(BatchBuilds)"
StopOnFirstFailure="true"
Targets="_BuildRepository"
Properties="BuildGroup=%(BatchedRepository.BuildGroup);BuildNumber=$(BuildNumber);IsFinalBuild=$(IsFinalBuild);Configuration=$(Configuration)" />
</Target>
<Target Name="_BuildRepository">
<PropertyGroup>
<!-- Should reduce allowable package feeds to only nuget.org. -->
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:AspNetUniverseBuildOffline=true</RepositoryBuildArguments>
<!-- If there are duplicate properties, the properties which are defined later in the order would override the earlier ones -->
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcePropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:Configuration=$(Configuration)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /noconsolelogger '/l:RepoTasks.FlowLogger,$(MSBuildThisFileDirectory)tasks\bin\publish\RepoTasks.dll;Summary;FlowId=$(RepositoryToBuild)'</RepositoryBuildArguments>
<BuildArguments>/t:CleanArtifacts $(_RepositoryBuildTargets) $(RepositoryBuildArguments)</BuildArguments>
<RepositoryArtifactsRoot>$(BuildRepositoryRoot)artifacts</RepositoryArtifactsRoot>
<RepositoryArtifactsBuildDirectory>$(RepositoryArtifactsRoot)\build\</RepositoryArtifactsBuildDirectory>
<RepositoryArtifactsMSBuildDirectory>$(RepositoryArtifactsRoot)\msbuild\</RepositoryArtifactsMSBuildDirectory>
<_BuildScriptToExecute Condition="'$(OS)'!='Windows_NT'">build.sh</_BuildScriptToExecute>
<_BuildScriptToExecute Condition="'$(OS)'=='Windows_NT'">build.cmd</_BuildScriptToExecute>
</PropertyGroup>
<Message Text="============ Building $(RepositoryToBuild) ============" Importance="High" />
<!-- Copy Korebuild lock file to individual repos to align version if the repo doesn't already have one -->
<Message Text="Copying KoreBuild lockfile from Universe to repository $(BuildRepositoryRoot)"/>
<Copy SourceFiles="$(RepositoryRoot)korebuild-lock.txt" DestinationFolder="$(BuildRepositoryRoot)" />
<Exec
Command="./$(_BuildScriptToExecute) -Path $(BuildRepositoryRoot) $(BuildArguments)"
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(RepositoryRoot)" />
<ItemGroup>
<RepositoryArtifacts Include="$(RepositoryArtifactsBuildDirectory)*" />
<RepositorySymbolNupkgs Include="$(RepositoryArtifactsBuildDirectory)*.symbols.nupkg" />
<RepositoryNupkgs Include="$(RepositoryArtifactsBuildDirectory)*.nupkg" Exclude="@(RepositorySymbolNupkgs)" />
<RepositoryMSBuildArtifacts Include="$(RepositoryArtifactsMSBuildDirectory)**\*.*" />
</ItemGroup>
<Copy
SourceFiles="@(RepositoryArtifacts)"
DestinationFolder="$(BuildDir)" />
<Move
SourceFiles="@(RepositoryMSBuildArtifacts)"
DestinationFolder="$(ArtifactsDir)msbuild\$(RepositoryToBuild)\%(RecursiveDir)" />
<Message Text="============ Done building $(RepositoryToBuild) ============" Importance="High" />
</Target>
</Project>