Universe/build/RepositoryBuild.targets

72 строки
3.6 KiB
XML

<Project>
<Target Name="_BuildRepositories" DependsOnTargets="GenerateLineup">
<ItemGroup>
<BatchedRepository Include="$(MSBuildProjectFullPath)">
<BuildGroup>%(RepositoryToBuildInOrder.Order)</BuildGroup>
<Repository>%(RepositoryToBuildInOrder.Identity)</Repository>
<AdditionalProperties>
RepositoryToBuild=%(RepositoryToBuildInOrder.Identity);
BuildRepositoryRoot=$([MSBuild]::NormalizeDirectory(%(RepositoryToBuildInOrder.RootPath)))
</AdditionalProperties>
</BatchedRepository>
</ItemGroup>
<PropertyGroup>
<BatchBuilds Condition="$(BuildInParallel) AND '$(CompileOnly)'=='true'">true</BatchBuilds>
<BatchBuilds Condition="'$(BatchBuilds)'==''">false</BatchBuilds>
</PropertyGroup>
<MSBuild
Projects="@(BatchedRepository)"
BuildInParallel="$(BatchBuilds)"
StopOnFirstFailure="true"
Targets="_BuildRepository"
Properties="BuildGroup=%(BatchedRepository.BuildGroup);BuildNumber=$(BuildNumber)" />
</Target>
<Target Name="_BuildRepository">
<PropertyGroup>
<!-- If there are duplicate properties, the properties which are defined later in the order would override the earlier ones -->
<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>$(_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)*" />
<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>