Use Traversal SDK to build tools (#19362)

This commit is contained in:
Viktor Hofer 2024-04-09 21:04:36 +02:00 committed by GitHub
parent f325827a2d
commit 4dc3002d4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 289 additions and 249 deletions

View file

@ -1,11 +1,32 @@
<Project Sdk="Microsoft.Build.Traversal">
<Project Sdk="Microsoft.Build.Traversal" InitialTargets="PrintInfo">
<!-- Default targets and parallelization -->
<ItemDefinitionGroup>
<ProjectReference>
<Test>false</Test>
<Publish>false</Publish>
<BuildInParallel>false</BuildInParallel>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="$(ToolsDir)init-build.proj" BuildInParallel="false" />
<ProjectReference Include="$(RepoProjectsDir)$(RootRepo).proj" BuildInParallel="false" />
<!-- Pre-build: Init tools-->
<ProjectReference Include="$(RepositoryEngineeringDir)init-cross-build.proj"
Condition="'$(BuildOS)' != 'windows' and '$(CrossBuild)' == 'true' and '$(ROOTFS_DIR)' == ''"
BuildInParallel="true" />
<ProjectReference Include="$(RepositoryEngineeringDir)init-poison.proj"
Condition="'$(EnablePoison)' == 'true'"
BuildInParallel="true" />
<ProjectReference Include="$(ToolsDir)tools.proj" BuildInParallel="true" />
<ProjectReference Include="$(RepoProjectsDir)$(RootRepo).proj" />
<!-- Post-build: Source-only validation, packaging and publishing -->
<ProjectReference Include="$(RepositoryEngineeringDir)finish-source-only.proj" Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<ProjectReference Include="$(RepositoryEngineeringDir)publish.proj" />
</ItemGroup>
<Target Name="PrintInfo" BeforeTargets="Build">
<Target Name="PrintInfo">
<PropertyGroup>
<BuildModeInfoText Condition="'$(DotNetBuildSourceOnly)' == 'true'">source-build</BuildModeInfoText>
<BuildModeInfoText Condition="'$(DotNetBuildSourceOnly)' != 'true'">non-source-build</BuildModeInfoText>
@ -15,27 +36,6 @@
<Message Text="Build Environment: $(TargetArchitecture) $(Configuration) $(TargetOS) $(TargetRid)" Importance="high" />
</Target>
<!-- Create a merge manifest from the individual repository manifest files. -->
<UsingTask TaskName="Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests" AssemblyFile="$(MicrosoftDotNetUnifiedBuildTasksAssembly)" TaskFactory="TaskHostFactory" />
<Target Name="MergeAssetManifests" AfterTargets="Build">
<PropertyGroup>
<MergedAssetManifestOutputPath>$(ArtifactsDir)VerticalManifest.xml</MergedAssetManifestOutputPath>
</PropertyGroup>
<ItemGroup>
<RepoAssetManifest Include="$(AssetManifestsIntermediateDir)\**\*.xml" />
</ItemGroup>
<!-- It's OK for the VmrBuildNumber to be empty -->
<Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests
AssetManifest="@(RepoAssetManifest)"
MergedAssetManifestOutputPath="$(MergedAssetManifestOutputPath)"
VmrBuildNumber="$(BUILD_BUILDNUMBER)" />
</Target>
<Import Project="$(RepositoryEngineeringDir)build.sourcebuild.targets" Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<!-- Intentionally below the import to appear at the end. -->
<Target Name="LogBuildOutputFolders"
AfterTargets="Build">
<Message Importance="high" Text="Shipping packages are located in '$(ArtifactsShippingPackagesDir)'." />

View file

@ -234,7 +234,7 @@ function Build {
if [ "$test" != "true" ]; then
"$CLI_ROOT/dotnet" build-server shutdown
"$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/tools/init-build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.binlog" -flp:LogFile="$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.log" /t:ExtractToolsetPackages,BuildMSBuildSdkResolver $properties
"$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/init-source-only.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.binlog" $properties
# kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver
"$CLI_ROOT/dotnet" build-server shutdown
fi

View file

@ -36,6 +36,7 @@ mode='validate'
logLevel='Debug'
propsDir=''
packagesDir=''
restoreSources=''
dotnetSdk=$defaultDotnetSdk
positional_args=()
@ -114,10 +115,9 @@ function ParseBinaryArgs
# Check the packages directory
if [ -z "$packagesDir" ]; then
# Use dotnet-public and dotnet-libraries feeds as the default packages source feeds
export ARTIFACTS_PATH="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json"
restoreSources="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json"
else
packagesDir=$(realpath ${packagesDir})
export ARTIFACTS_PATH=$packagesDir
restoreSources=$(realpath ${packagesDir})
fi
}
@ -125,7 +125,7 @@ function RunBinaryTool
{
targetDir="$REPO_ROOT"
outputDir="$REPO_ROOT/artifacts/log/binary-report"
BinaryToolCommand=""$dotnetSdk/dotnet" run --project "$BINARY_TOOL" -c Release "$mode" "$targetDir" -o "$outputDir" -ab "$allowedBinariesFile" -l "$logLevel""
BinaryToolCommand=""$dotnetSdk/dotnet" run --project "$BINARY_TOOL" -c Release --property:RestoreSources="$restoreSources" "$mode" "$targetDir" -o "$outputDir" -ab "$allowedBinariesFile" -l "$logLevel""
if [ -n "$packagesDir" ]; then
BinaryToolCommand=""$BinaryToolCommand" -p CustomPackageVersionsProps="$packagesDir/PackageVersions.props""
@ -136,4 +136,4 @@ function RunBinaryTool
}
ParseBinaryArgs
RunBinaryTool
RunBinaryTool

View file

@ -1,4 +1,14 @@
<Project>
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj" />
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj" />
</ItemGroup>
<!-- After building, generate a prebuilt usage report. -->
<Target Name="ReportPrebuiltUsage"
@ -145,7 +155,7 @@
<Target Name="CreatePrebuiltsTarballIfPrebuiltsExist"
DependsOnTargets="DetermineSourceBuiltSdkVersion"
Condition="'@(PrebuiltFile->Count())' != '0'">
Condition="'@(PrebuiltFile)' != ''">
<PropertyGroup>
<PrebuiltsTarball>$(ArtifactsAssetsDir)$(SourceBuiltPrebuiltsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</PrebuiltsTarball>
<PrebuiltsTarballWorkingDir>$(ResultingPrebuiltPackagesDir)</PrebuiltsTarballWorkingDir>
@ -158,7 +168,7 @@
</Target>
<Target Name="ErrorOnPrebuilts"
Condition="'@(PrebuiltFile->Count())' != '0' AND '$(SkipErrorOnPrebuilts)' != 'true'">
Condition="'@(PrebuiltFile)' != '' and '$(SkipErrorOnPrebuilts)' != 'true'">
<Error Text="@(PrebuiltFile->Count()) Prebuilts Exist" />
</Target>

View file

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>
<Target Name="GenerateRootFs"
AfterTargets="Build">
<PropertyGroup>
<ArmEnvironmentVariables Condition="'$(ArmEnvironmentVariables)' == ''">ROOTFS_DIR=$(ArtifactsObjDir)crossrootfs/arm</ArmEnvironmentVariables>
<ArmEnvironmentVariables Condition="'$(Platform)' == 'armel'">ROOTFS_DIR=$(ArtifactsObjDir)crossrootfs/armel</ArmEnvironmentVariables>
</PropertyGroup>
<Exec Command="$(RepositoryEngineeringDir)common/cross/build-rootfs.sh"
EnvironmentVariables="$(ArmEnvironmentVariables)"
Condition="'$(TargetArchitecture)' != 'armel' and '$(BuildArchitecture)' != '$(TargetArchitecture)'" />
<Exec Command="$(RepositoryEngineeringDir)common/cross/armel/tizen-build-rootfs.sh"
EnvironmentVariables="$(ArmEnvironmentVariables)"
Condition="'$(TargetArchitecture)' == 'armel'" />
</Target>
</Project>

View file

@ -0,0 +1,39 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj" />
</ItemGroup>
<UsingTask TaskName="Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.MarkAndCatalogPackages" AssemblyFile="$(MicrosoftDotNetSourceBuildTasksLeakDetectionAssembly)" TaskFactory="TaskHostFactory" />
<Target Name="PoisonPrebuiltPackages"
AfterTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)PoisonPrebuiltPackages.complete">
<PropertyGroup>
<SourceBuiltPoisonMarkerFile>.source-built.xml</SourceBuiltPoisonMarkerFile>
<SourceBuiltPoisonReportDataFile>$(PackageReportDir)poison-source-built-catalog.xml</SourceBuiltPoisonReportDataFile>
</PropertyGroup>
<ItemGroup>
<PrebuiltPackages Include="$(PrebuiltPackagesPath)**/*.nupkg" />
<PrebuiltSourceBuiltPackages Include="$(PrebuiltSourceBuiltPackagesPath)**/*.nupkg" />
</ItemGroup>
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Poisoning existing packages for leak detection." />
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltPackages)" CatalogOutputFilePath="$(PoisonReportDataFile)" MarkerFileName="$(PoisonMarkerFile)" />
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltSourceBuiltPackages)" CatalogOutputFilePath="$(SourceBuiltPoisonReportDataFile)" MarkerFileName="$(SourceBuiltPoisonMarkerFile)" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done poisoning." />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)PoisonPrebuiltPackages.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
</Project>

View file

@ -0,0 +1,97 @@
<Project>
<!-- This project must not use any prebuilts -->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>
<!-- Fake, to satisfy the SDK. -->
<TargetFramework>netstandard2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="Build"
DependsOnTargets="
UnpackTarballs;
BuildMSBuildSdkResolver;
ExtractToolsetPackages" />
<Target Name="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)UnpackTarballs.complete" >
<PropertyGroup>
<ExternalTarballsDir>$([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'archive'))</ExternalTarballsDir>
</PropertyGroup>
<MakeDir Directories="$(PrebuiltSourceBuiltPackagesPath)" Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<Exec Command="tar -xzf $(ExternalTarballsDir)$(SourceBuiltArtifactsTarballName).*$(ArchiveExtension)"
WorkingDirectory="$(PrebuiltSourceBuiltPackagesPath)"
Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<!--
Check for a prebuilt dependency tarball and extract if exists. If there isn't one, we expect
the build to be working without prebuilts.
-->
<ItemGroup>
<SourceBuiltPrebuiltsTarballFile Include="$(ExternalTarballsDir)$(SourceBuiltPrebuiltsTarballName).*$(ArchiveExtension)" />
</ItemGroup>
<Exec Command="tar -xzf %(SourceBuiltPrebuiltsTarballFile.FullPath)"
WorkingDirectory="$(PrebuiltPackagesPath)"
Condition="'@(SourceBuiltPrebuiltsTarballFile)' != ''" />
<!-- Copy SBRP packages to reference packages location -->
<ItemGroup>
<UnpackedSourceBuildReferencePackages Include="$(PrebuiltSourceBuiltPackagesPath)SourceBuildReferencePackages/*"/>
</ItemGroup>
<Move SourceFiles="@(UnpackedSourceBuildReferencePackages)" DestinationFiles="$(ReferencePackagesDir)%(Filename)%(Extension)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)UnpackTarballs.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Build the custom msbuild sdk resolver. -->
<Target Name="BuildMSBuildSdkResolver"
DependsOnTargets="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)BuildMSBuildSdkResolver.complete">
<MSBuild Projects="$(TasksDir)Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj"
Targets="Restore"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
<MSBuild Projects="$(TasksDir)Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj"
Targets="Build" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)BuildMSBuildSdkResolver.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Extract toolset packages into the bootstrap folder -->
<Target Name="ExtractToolsetPackages"
DependsOnTargets="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ExtractToolsetPackages.complete">
<ItemGroup>
<ToolsetPackage Include="Microsoft.DotNet.Arcade.Sdk" SourceFolder="$(PrebuiltSourceBuiltPackagesPath)" Version="$(ARCADE_BOOTSTRAP_VERSION)" />
<ToolsetPackage Include="Microsoft.Build.NoTargets" SourceFolder="$(ReferencePackagesDir)" Version="$(NOTARGETS_BOOTSTRAP_VERSION)" />
<ToolsetPackage Include="Microsoft.Build.Traversal" SourceFolder="$(ReferencePackagesDir)" Version="$(TRAVERSAL_BOOTSTRAP_VERSION)" />
</ItemGroup>
<Unzip SourceFiles="%(ToolsetPackage.SourceFolder)%(ToolsetPackage.Identity).%(ToolsetPackage.Version).nupkg"
DestinationFolder="$(BootstrapPackagesDir)$([System.String]::Copy('%(ToolsetPackage.Identity)').ToLowerInvariant())/%(ToolsetPackage.Version)"
SkipUnchangedFiles="true" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)ExtractToolsetPackages.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
</Project>

View file

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj" />
</ItemGroup>
<!-- Create a merge manifest from the individual repository manifest files. -->
<UsingTask TaskName="Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests" AssemblyFile="$(MicrosoftDotNetUnifiedBuildTasksAssembly)" TaskFactory="TaskHostFactory" />
<Target Name="MergeAssetManifests" AfterTargets="Build">
<PropertyGroup>
<MergedAssetManifestOutputPath>$(ArtifactsDir)VerticalManifest.xml</MergedAssetManifestOutputPath>
</PropertyGroup>
<ItemGroup>
<RepoAssetManifest Include="$(AssetManifestsIntermediateDir)\**\*.xml" />
</ItemGroup>
<!-- It's OK for the VmrBuildNumber to be empty -->
<Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests
AssetManifest="@(RepoAssetManifest)"
MergedAssetManifestOutputPath="$(MergedAssetManifestOutputPath)"
VmrBuildNumber="$(BUILD_BUILDNUMBER)" />
</Target>
</Project>

View file

@ -0,0 +1,13 @@
<Project>
<!--
Do not import the Arcade SDK as this would introduce a prebuilt as this project builds
before the custom sdk resolver is available in source-only mode.
-->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
</Project>

View file

@ -1,7 +0,0 @@
<configuration>
<packageSources>
<clear />
<!-- %ARTIFACTS_PATH% must be set via an environment variable (export ARTIFACTS_PATH=<path-to-sources>). -->
<add key="artifactsPath" value="%ARTIFACTS_PATH%" />
</packageSources>
</configuration>

View file

@ -1,13 +1,21 @@
<Project>
<!--
Do not import the Arcade SDK for the local tooling projects. This lets us
build them with just the .NET SDK, simplifying the build.
-->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
<PropertyGroup>
<RestoreSources Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(ReferencePackagesDir);$(PrebuiltPackagesPath);$(PrebuiltSourceBuiltPackagesPath)</RestoreSources>
</PropertyGroup>
<!--
Use some assemblies from the SDK, instead of package references. This ensures they match what's
found when the task is loaded by the SDK's MSBuild.
Reference NuGet assemblies, except a command line assembly that causes warnings such as:
MSB3277: Found conflicts between different versions of "System.Collections" that could not be resolved.
-->
<ItemGroup>
<SdkAssembly Include="$([MSBuild]::NormalizePath('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)', 'Newtonsoft.Json.dll'));
$([MSBuild]::NormalizeDirectory('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)'))NuGet.*.dll"
Exclude="$([MSBuild]::NormalizePath('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)', 'NuGet.CommandLine.XPlat.dll'))" />
</ItemGroup>
</Project>

View file

@ -1,179 +0,0 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<!-- Fake, to satisfy the SDK. -->
<TargetFramework>netstandard2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="Build"
DependsOnTargets="
UnpackTarballs;
BuildUnifiedBuildTasks;
BuildMSBuildSdkResolver;
BuildLeakDetection;
ExtractToolsetPackages;
GenerateRootFs;
PoisonPrebuiltPackages" />
<Target Name="UnpackTarballs"
Condition="'$(DotNetBuildSourceOnly)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)UnpackTarballs.complete" >
<PropertyGroup>
<ExternalTarballsDir>$([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'archive'))</ExternalTarballsDir>
</PropertyGroup>
<MakeDir Directories="$(PrebuiltSourceBuiltPackagesPath)" Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<Exec Command="tar -xzf $(ExternalTarballsDir)$(SourceBuiltArtifactsTarballName).*$(ArchiveExtension)"
WorkingDirectory="$(PrebuiltSourceBuiltPackagesPath)"
Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<!--
Check for a prebuilt dependency tarball and extract if exists. If there isn't one, we expect
the build to be working without prebuilts.
-->
<ItemGroup>
<SourceBuiltPrebuiltsTarballFile Include="$(ExternalTarballsDir)$(SourceBuiltPrebuiltsTarballName).*$(ArchiveExtension)" />
</ItemGroup>
<Exec Command="tar -xzf %(SourceBuiltPrebuiltsTarballFile.FullPath)"
WorkingDirectory="$(PrebuiltPackagesPath)"
Condition="'@(SourceBuiltPrebuiltsTarballFile)' != ''" />
<!-- Copy SBRP packages to reference packages location -->
<ItemGroup>
<UnpackedSourceBuildReferencePackages Include="$(PrebuiltSourceBuiltPackagesPath)SourceBuildReferencePackages/*"/>
</ItemGroup>
<Move SourceFiles="@(UnpackedSourceBuildReferencePackages)" DestinationFiles="$(ReferencePackagesDir)%(Filename)%(Extension)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)UnpackTarballs.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Build the custom msbuild sdk resolver. -->
<Target Name="BuildMSBuildSdkResolver"
DependsOnTargets="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)BuildMSBuildSdkResolver.complete">
<MSBuild Projects="tasks\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj"
Targets="Restore"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
<MSBuild Projects="tasks\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj"
Targets="Build" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)BuildMSBuildSdkResolver.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Build msbuild tasks. -->
<Target Name="BuildUnifiedBuildTasks"
DependsOnTargets="UnpackTarballs;BuildMSBuildSdkResolver"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)BuildUnifiedBuildTasks.complete">
<MSBuild Projects="tasks\Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj"
Targets="Restore"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
<MSBuild Projects="tasks\Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj"
Targets="Build" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)BuildUnifiedBuildTasks.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Build msbuild tasks for the poisoning feature even when EnablePoison!=true to validate that the task project
builds as EnablePoison=true isn't exercised in PR validation. -->
<Target Name="BuildLeakDetection"
DependsOnTargets="ExtractToolsetPackages;BuildMSBuildSdkResolver"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)BuildLeakDetection.complete">
<MSBuild Projects="tasks\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj"
Targets="Restore"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
<MSBuild Projects="tasks\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj"
Targets="Build" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)BuildLeakDetection.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="GenerateRootFs"
Condition="'$(BuildOS)' != 'windows' and '$(CrossBuild)' == 'true' and '$(ROOTFS_DIR)' == ''">
<PropertyGroup>
<ArmEnvironmentVariables Condition="'$(ArmEnvironmentVariables)' == ''">ROOTFS_DIR=$(ArtifactsObjDir)crossrootfs/arm</ArmEnvironmentVariables>
<ArmEnvironmentVariables Condition="'$(Platform)' == 'armel'">ROOTFS_DIR=$(ArtifactsObjDir)crossrootfs/armel</ArmEnvironmentVariables>
</PropertyGroup>
<Exec Command="$(ArmEnvironmentVariables) $(RepositoryEngineeringDir)common/cross/build-rootfs.sh"
Condition="'$(TargetArchitecture)' != 'armel' and '$(BuildArchitecture)' != '$(TargetArchitecture)'" />
<Exec Command="$(ArmEnvironmentVariables) $(RepositoryEngineeringDir)common/cross/armel/tizen-build-rootfs.sh"
Condition="'$(TargetArchitecture)' == 'armel'" />
</Target>
<!-- Extract toolset packages into the bootstrap folder -->
<Target Name="ExtractToolsetPackages"
Condition="'$(DotNetBuildSourceOnly)' == 'true'"
DependsOnTargets="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ExtractToolsetPackages.complete">
<ItemGroup>
<ToolsetPackage Include="Microsoft.DotNet.Arcade.Sdk" SourceFolder="$(PrebuiltSourceBuiltPackagesPath)" Version="$(ARCADE_BOOTSTRAP_VERSION)" />
<ToolsetPackage Include="Microsoft.Build.NoTargets" SourceFolder="$(ReferencePackagesDir)" Version="$(NOTARGETS_BOOTSTRAP_VERSION)" />
<ToolsetPackage Include="Microsoft.Build.Traversal" SourceFolder="$(ReferencePackagesDir)" Version="$(TRAVERSAL_BOOTSTRAP_VERSION)" />
</ItemGroup>
<Unzip SourceFiles="%(ToolsetPackage.SourceFolder)%(ToolsetPackage.Identity).%(ToolsetPackage.Version).nupkg"
DestinationFolder="$(BootstrapPackagesDir)$([System.String]::Copy('%(ToolsetPackage.Identity)').ToLowerInvariant())/%(ToolsetPackage.Version)"
SkipUnchangedFiles="true" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)ExtractToolsetPackages.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<UsingTask TaskName="Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.MarkAndCatalogPackages" AssemblyFile="$(MicrosoftDotNetSourceBuildTasksLeakDetectionAssembly)" TaskFactory="TaskHostFactory" Condition="'$(EnablePoison)' == 'true'" />
<Target Name="PoisonPrebuiltPackages"
Condition="'$(EnablePoison)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)PoisonPrebuiltPackages.complete">
<PropertyGroup>
<SourceBuiltPoisonMarkerFile>.source-built.xml</SourceBuiltPoisonMarkerFile>
<SourceBuiltPoisonReportDataFile>$(PackageReportDir)poison-source-built-catalog.xml</SourceBuiltPoisonReportDataFile>
</PropertyGroup>
<ItemGroup>
<PrebuiltPackages Include="$(PrebuiltPackagesPath)**/*.nupkg" />
<PrebuiltSourceBuiltPackages Include="$(PrebuiltSourceBuiltPackagesPath)**/*.nupkg" />
</ItemGroup>
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Poisoning existing packages for leak detection." />
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltPackages)" CatalogOutputFilePath="$(PoisonReportDataFile)" MarkerFileName="$(PoisonMarkerFile)" />
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltSourceBuiltPackages)" CatalogOutputFilePath="$(SourceBuiltPoisonReportDataFile)" MarkerFileName="$(SourceBuiltPoisonMarkerFile)" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done poisoning." />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)PoisonPrebuiltPackages.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
</Project>

View file

@ -1,21 +0,0 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
<PropertyGroup>
<RestoreSources Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(ReferencePackagesDir);$(PrebuiltPackagesPath);$(PrebuiltSourceBuiltPackagesPath)</RestoreSources>
</PropertyGroup>
<!--
Use some assemblies from the SDK, instead of package references. This ensures they match what's
found when the task is loaded by the SDK's MSBuild.
Reference NuGet assemblies, except a command line assembly that causes warnings such as:
MSB3277: Found conflicts between different versions of "System.Collections" that could not be resolved.
-->
<ItemGroup>
<SdkAssembly Include="$([MSBuild]::NormalizePath('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)', 'Newtonsoft.Json.dll'));
$([MSBuild]::NormalizeDirectory('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)'))NuGet.*.dll"
Exclude="$([MSBuild]::NormalizePath('$(NetCoreRoot)', 'sdk', '$(NETCoreSdkVersion)', 'NuGet.CommandLine.XPlat.dll'))" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,13 @@
<Project>
<!--
Do not import the Arcade SDK as this would introduce a prebuilt as this project builds
the custom sdk resolver that makes the bootstrap toolsets available.
-->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
</Project>

View file

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<!-- Skip the sdk resolver in source-only mode as it already got built in the previous msbuild node execution triggered in build.sh. -->
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver\Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj" />
</ItemGroup>
</Project>