428d541627
When building the entire stack for a non windows target, the windows resolver packages will not be present (and in the case of a windows build, you'd only have one architecture anyway). Provide a way to opt out of including the resolver. It's only interesting for Visual Studio insertion cases, which is something the community at large doesn't need to worry about.
136 lines
6.8 KiB
XML
136 lines
6.8 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="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=""%(RestoreSrcPackagesInput.FullPath)"" />
|
|
|
|
</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" />
|
|
<RestoreSrcPackagesInput Remove="$(RepoRoot)/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj" Condition="'$(IncludeMSBuildSdkResolver)' == 'false'" />
|
|
</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=""%(RestoreToolsPackagesInput.FullPath)""
|
|
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>
|
|
<Project>
|
|
<PropertyGroup>
|
|
<PreviousStageDirectory>$(OutputDirectory)</PreviousStageDirectory>
|
|
<PreviousStageDotnet>$(DotnetInOutputDirectory)</PreviousStageDotnet>
|
|
<CliOuterBuildStage>$(CliBuildStage)</CliOuterBuildStage>
|
|
</PropertyGroup>
|
|
</Project>
|
|
</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>
|