Dogfood net6 and pack package with all tfms

This commit is contained in:
Rui Marinho 2021-03-26 10:37:05 +00:00
Родитель c1057e0413
Коммит acaa820be9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 8011175E77E1FC88
17 изменённых файлов: 476 добавлений и 15 удалений

31
Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,31 @@
<Project>
<Import Project="eng\Version.props" />
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<ProduceReferenceAssembly Condition="'$(UsingMicrosoftNETSdk)' == 'True' AND '$(Configuration)' == 'Debug'">True</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup>
<GitDefaultBranch>main</GitDefaultBranch>
</PropertyGroup>
<PropertyGroup>
<Company>Microsoft</Company>
<Product>Microsoft MAUI Graphics</Product>
<Authors>Microsoft</Authors>
<Owners>microsoft</Owners>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/dotnet/Microsoft.Maui.Graphics.git</RepositoryUrl>
<ProjectUrl>https://github.com/dotnet/Microsoft.Maui.Graphics</ProjectUrl>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageVersion>0.0.1-alpha1</PackageVersion>
<PackageOutputPath>$(MSBuildThisFileDirectory)artifacts</PackageOutputPath>
</PropertyGroup>
<!-- This target is replaced by GitInfo when restored. Allows Version.targets to rely on it before restore. -->
<Target Name="GitVersion" />
<Target Name="GitInfo" />
<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="$(MSBuildThisFileDirectory)eng\Environment.Build.props" />
</Project>

4
Directory.Build.targets Normal file
Просмотреть файл

@ -0,0 +1,4 @@
<Project>
<Import Project="eng\Git.Build.targets" />
<Import Project="eng\Version.targets" />
</Project>

1
GitInfo.txt Normal file
Просмотреть файл

@ -0,0 +1 @@
6.0.100-preview.2

13
NuGet.config Normal file
Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>

Просмотреть файл

@ -1,3 +1,7 @@
variables:
- name: BuildVersion
value: $[counter('release-counter', 1)]
trigger:
branches:
include:
@ -41,31 +45,44 @@ pool:
vmImage: windows-latest
steps:
- script: dotnet restore build/Build.Microsoft.Maui.Graphics.Mac.sln
displayName: 'NuGet Restore'
- task: MSBuild@1
displayName: 'Build Legacy'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.7.0'
inputs:
solution: build/Build.Microsoft.Maui.Graphics.Windows.sln
configuration: Release
restoreNugetPackages: true
msbuildArguments: /verbosity:normal /t:Build
versionSpec: 5.7.0
- task: DotNetCoreCLI@2
displayName: 'Build NET6'
displayName: 'Install NET6'
inputs:
command: 'build'
projects: build/Build.Microsoft.Maui.Graphics-net6.sln
arguments: -p:Configuration=Release
projects: |
src\external\DotNet\DotNet.csproj
- task: NuGetCommand@2
displayName: 'Restore sln'
inputs:
command: 'restore'
restoreSolution: build\Build.Microsoft.Maui.Graphics.Windows.sln
- task: MSBuild@1
displayName: 'Build Graphics with MSBUILD'
inputs:
solution: build\Build.Microsoft.Maui.Graphics.Windows.sln
configuration: Release
msbuildArguments: /verbosity:normal /t:Build
- script: src\bin\dotnet\dotnet build build\Build.Microsoft.Maui.Graphics-net6.sln -p:Configuration=Release
displayName: 'Build Graphics with NET6'
- task: NuGetCommand@2
displayName: 'Pack nupkg'
inputs:
command: 'pack'
packagesToPack: 'build/JonLipsky.Microsoft.Maui.Graphics.nuspec'
packagesToPack: 'build/Microsoft.Maui.Graphics.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
basePath: '$(System.DefaultWorkingDirectory)'
versioningScheme : 'byEnvVar'
versionEnvVar: 'NugetVersion'
versionEnvVar: 'BUILD_BUILDNUMBER'
- task: PublishBuildArtifacts@1
condition: always()

Просмотреть файл

@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<EnvironmentBuildPropsImported>true</EnvironmentBuildPropsImported>
</PropertyGroup>
<PropertyGroup Condition="'$(CI)' == ''">
<CI>false</CI>
<CI Condition="'$(TF_BUILD)' == 'true'">true</CI>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<!-- Auto install any missing Android SDKs -->
<PropertyGroup Condition="'$(CI)' == 'true'">
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">False</AndroidRestoreOnBuild>
<AcceptAndroidSDKLicenses Condition="'$(AcceptAndroidSDKLicenses)' == ''">True</AcceptAndroidSDKLicenses>
</PropertyGroup>
</Project>

6
eng/Git.Build.targets Normal file
Просмотреть файл

@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="MSBuilder.GenerateAssemblyInfo" Version="0.2.2" PrivateAssets="All" />
</ItemGroup>
</Project>

9
eng/Version.props Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETSdkPackageVersion>6.0.100-preview.2.21155.3</MicrosoftNETSdkPackageVersion>
<MicrosoftAndroidSdkPackageVersion>11.0.200-ci.main.148</MicrosoftAndroidSdkPackageVersion>
<MicrosoftMacCatalystSdkPackageVersion>14.3.100-ci.main.337</MicrosoftMacCatalystSdkPackageVersion>
<MicrosoftiOSSdkPackageVersion>14.4.100-ci.main.1192</MicrosoftiOSSdkPackageVersion>
</PropertyGroup>
</Project>

115
eng/Version.targets Normal file
Просмотреть файл

@ -0,0 +1,115 @@
<Project>
<PropertyGroup>
<NightlyTag>nightly</NightlyTag>
<RegexTag>[a-z]+\.[0-9]</RegexTag>
</PropertyGroup>
<PropertyGroup>
<GitBranch Condition="'$(SYSTEM_PULLREQUEST_TARGETBRANCH)' != ''">$(SYSTEM_PULLREQUEST_TARGETBRANCH)</GitBranch>
<GitBranch Condition="'$(SYSTEM_PULLREQUEST_TARGETBRANCH)' == '' and '$(BUILD_SOURCEBRANCHNAME)' != ''">$(BUILD_SOURCEBRANCHNAME)</GitBranch>
</PropertyGroup>
<PropertyGroup>
<CoreCompileDependsOn>
SetVersions;
VersionInfoReport;
$(CoreCompileDependsOn);
</CoreCompileDependsOn>
<GenerateNuspecDependsOn>
SetVersions;
VersionInfoReport;
$(GenerateNuspecDependsOn);
</GenerateNuspecDependsOn>
<GetPackageVersionDependsOn>
SetVersions;
VersionInfoReport;
$(GetPackageVersionDependsOn);
</GetPackageVersionDependsOn>
<SetVersionsBefore>
GetAssemblyVersion;
$(SetVersionsBefore);
</SetVersionsBefore>
<SetVersionsDependsOn>
GitInfo;
GitVersion;
$(SetVersionsDependsOn);
</SetVersionsDependsOn>
<SetGitInfoPropsBefore>
GitInfo;
GitVersion;
</SetGitInfoPropsBefore>
</PropertyGroup>
<Target Name="SetGitInfoProps" BeforeTargets="$(SetGitInfoPropsBefore)">
<PropertyGroup>
<GitDefaultBranch>main</GitDefaultBranch>
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
<GitIgnoreTagVersion>true</GitIgnoreTagVersion>
</PropertyGroup>
</Target>
<Target Name="SetVersions" BeforeTargets="$(SetVersionsBefore)" DependsOnTargets="$(SetVersionsDependsOn)" Returns="$(Version)">
<PropertyGroup>
<SemVerLabel>$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(RegexTag)))</SemVerLabel>
<GitDefaultBranch>main</GitDefaultBranch>
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
<GitIgnoreTagVersion>true</GitIgnoreTagVersion>
<GitSemVerLabel Condition=" '$(GitTag)' != '' and $([System.Text.RegularExpressions.Regex]::IsMatch('$(GitTag)', $(RegexTag))) ">$(SemVerLabel)</GitSemVerLabel>
<GitSemVerLabel Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'">$(NightlyTag)</GitSemVerLabel>
<GitSemVerDashLabel Condition="'$(GitSemVerLabel)' != ''" >-$(GitSemVerLabel)</GitSemVerDashLabel>
</PropertyGroup>
<ItemGroup>
<VersionMetadata Include="$(GitCommits)" Condition="'$(GitSemVerDashLabel)' == ''" />
<VersionMetadata Condition="$(CI) and '$(BUILD_REASON)' == 'PullRequest'"
Include="pr.$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)"/>
<VersionMetadata Include="sha.$(GitCommit)"/>
<VersionMetadata Condition="$(CI)"
Include="azdo.$(BUILD_BUILDID)"/>
</ItemGroup>
<PropertyGroup>
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
<PackageVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)$(VersionMetadataPlusLabel)</PackageVersion>
<PackageVersion Condition="$(CI)">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel).$(BUILDVERSION)$(VersionMetadataPlusLabel)</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<InformationalVersion>$(PackageVersion)</InformationalVersion>
<FileVersion>$(Version).$(GitCommits)</FileVersion>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <!-- THIS SHALL REMAIN 1.0.0.0 -->
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>Version</_Parameter1>
<_Parameter2>1.0.0.0</_Parameter2> <!-- THIS SHALL REMAIN 1.0.0.0 -->
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>PackageVersion</_Parameter1>
<_Parameter2>$(PackageVersion)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<Message Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'" Importance="high" Text="##vso[build.addbuildtag]$(NightlyTag)"/>
<Message Condition="$(CI)" Importance="high" Text="##vso[build.updatebuildnumber]$(PackageVersion)"/>
</Target>
<Target Name="VersionInfoReport" DependsOnTargets="SetVersions">
<ItemGroup>
<Message Importance="$(GitInfoReportImportance)" Text="Version Info:
AssemblyVersion: $(AssemblyVersion)
FileVersion: $(FileVersion)
InformationalVersion: $(InformationalVersion)
PackageVersion: $(PackageVersion)
Version: $(Version)
VersionPrefix: $(VersionPrefix)
VersionSuffix: $(VersionSuffix)
"/>
</ItemGroup>
</Target>
</Project>

102
eng/dogfood.ps1 Normal file
Просмотреть файл

@ -0,0 +1,102 @@
<#
.SYNOPSIS
*Windows-only* Launches Visual Studio with environment variables to use the local ./bin/dotnet/dotnet.exe.
.DESCRIPTION
*Windows-only* Launches Visual Studio with environment variables to use the local ./bin/dotnet/dotnet.exe.
Script based on:
https://github.com/dotnet/runtime/blob/1be117d8e7c0cd29ebc55cbcff2a7fa70604ed39/eng/build.ps1#L186-L208
https://github.com/dotnet/runtime/blob/1be117d8e7c0cd29ebc55cbcff2a7fa70604ed39/eng/common/tools.ps1#L109
.PARAMETER vs
The path to Visual Studio, defaults to:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe".
.PARAMETER sln
The path to a .sln or .project file, defaults to "Microsoft.Maui-net6.sln".
.PARAMETER modify
Modify the environment variables in the current session. This would
allow the "dotnet" command to work instead of ".\bin\dotnet\dotnet".
However, it would be good to do this in a new terminal session,
since you would have trouble running "dotnet build" if it needs to
provision .NET 6 and the iOS/Android workloads again.
.EXAMPLE
PS> .\scripts\dogfood.ps1
.EXAMPLE
PS> .\scripts\dogfood.ps1 -vs "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"
.EXAMPLE
PS> .\scripts\dogfood.ps1 -sln .\path\to\MySolution.sln
#>
param(
[string]$vs = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe",
[string]$sln,
[switch]$modify
)
$dotnet=Join-Path $PSScriptRoot ../bin/dotnet/
$dotnet=(Get-Item $dotnet).FullName
if (-Not $sln) {
$sln=Join-Path $PSScriptRoot ../Microsoft.Maui-net6.sln
$sln=(Get-Item $sln).FullName
}
# Modify global.json, so the IDE can load
$globaljson = Join-Path $PSScriptRoot ../global.json
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Version.props)
$json = Get-Content $globaljson | ConvertFrom-Json
$json | Add-Member sdk (New-Object -TypeName PSObject) -Force
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftNETSdkPackageVersion -Force
$json | ConvertTo-Json | Set-Content $globaljson
# NOTE: I've not found a better way to do this
# see: https://github.com/PowerShell/PowerShell/issues/3316
$oldDOTNET_INSTALL_DIR=$env:DOTNET_INSTALL_DIR
$oldDOTNET_ROOT=$env:DOTNET_ROOT
$oldDOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
$oldDOTNET_MULTILEVEL_LOOKUP=$env:DOTNET_MULTILEVEL_LOOKUP
$oldMSBuildEnableWorkloadResolver=$env:MSBuildEnableWorkloadResolver
$old_ExcludeMauiProjectCapability=$env:_ExcludeMauiProjectCapability
$oldPATH=$env:PATH
try {
$env:DOTNET_INSTALL_DIR=$dotnet
# This tells .NET to use the bootstrapped runtime
$env:DOTNET_ROOT=$env:DOTNET_INSTALL_DIR
# This tells MSBuild to load the SDK from the directory of the bootstrapped SDK
$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_ROOT
# This tells .NET not to go looking for .NET in other places
$env:DOTNET_MULTILEVEL_LOOKUP=0
# This enables workload support inside the IDE
$env:MSBuildEnableWorkloadResolver=$true
# This disables the Maui @(ProjectCapability), a temporary workaround for 16.9
$env:_ExcludeMauiProjectCapability=$true
# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
$env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH)
# Launch VS
& "$vs" "$sln"
} finally {
if (-Not $modify) {
$env:DOTNET_INSTALL_DIR = $oldDOTNET_INSTALL_DIR
$env:DOTNET_ROOT=$oldDOTNET_ROOT
$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$oldDOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
$env:DOTNET_MULTILEVEL_LOOKUP=$oldDOTNET_MULTILEVEL_LOOKUP
$env:MSBuildEnableWorkloadResolver=$oldMSBuildEnableWorkloadResolver
$env:_ExcludeMauiProjectCapability=$old_ExcludeMauiProjectCapability
$env:PATH=$oldPATH
}
}
exit 0

6
global.json Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.23",
"Microsoft.Build.NoTargets": "2.0.1"
}
}

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net6.0-ios;net6.0-android;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net6.0-ios;net6.0-android;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT'">$(TargetFrameworks);net6.0-maccatalyst</TargetFrameworks>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

3
src/external/DotNet/Dependencies/Directory.Build.props поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
<Project>
<Import Project="../../../../eng/Version.props" />
</Project>

1
src/external/DotNet/Dependencies/Directory.Build.targets поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
<Project />

15
src/external/DotNet/Dependencies/Packs.csproj поставляемый Normal file
Просмотреть файл

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.Android.Ref" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.Android.Sdk.win-x64" Version="[$(MicrosoftAndroidSdkPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('windows'))" />
<PackageDownload Include="Microsoft.Android.Sdk.osx-x64" Version="[$(MicrosoftAndroidSdkPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('osx'))" />
<PackageDownload Include="Microsoft.Android.Sdk.BundleTool" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.MacCatalyst.Ref" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.MacCatalyst.Sdk" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.iOS.Ref" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.iOS.Sdk" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
</ItemGroup>
</Project>

10
src/external/DotNet/Dependencies/Workloads.csproj поставляемый Normal file
Просмотреть файл

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.NET.Workload.Android" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.MacCatalyst" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.iOS" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
</ItemGroup>
</Project>

108
src/external/DotNet/DotNet.csproj поставляемый Normal file
Просмотреть файл

@ -0,0 +1,108 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<MauiOutputPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../../bin/'))</MauiOutputPath>
<DotNetDirectory>$(MauiOutputPath)dotnet/</DotNetDirectory>
<DotNetToolPath>$(DotNetDirectory)dotnet</DotNetToolPath>
<DotNetPacksDirectory>$(DotNetDirectory)packs/</DotNetPacksDirectory>
<DotNetSdkManifestsDirectory>$(DotNetDirectory)sdk-manifests/$(MicrosoftNETSdkPackageVersion.Split('-')[0])/</DotNetSdkManifestsDirectory>
<DotNetSentinelPath>$(DotNetDirectory)sdk/$(MicrosoftNETSdkPackageVersion)/EnableWorkloadResolver.sentinel</DotNetSentinelPath>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
<DotNetInstallScriptUrl>https://dot.net/v1/dotnet-install.ps1</DotNetInstallScriptUrl>
<DotNetInstallScriptName>dotnet-install.ps1</DotNetInstallScriptName>
<DotNetInstallScriptPath>$(MauiOutputPath)$(DotNetInstallScriptName)</DotNetInstallScriptPath>
<DotNetInstallCommand>&amp; '$(DotNetInstallScriptPath)' -Version $(MicrosoftNETSdkPackageVersion) -InstallDir '$(DotNetDirectory)' -Verbose</DotNetInstallCommand>
<DotNetInstallCommand>powershell -Command &quot;$(DotNetInstallCommand)&quot;</DotNetInstallCommand>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('osx'))">
<DotNetInstallScriptUrl>https://dot.net/v1/dotnet-install.sh</DotNetInstallScriptUrl>
<DotNetInstallScriptName>dotnet-install.sh</DotNetInstallScriptName>
<DotNetInstallScriptPath>$(MauiOutputPath)$(DotNetInstallScriptName)</DotNetInstallScriptPath>
<DotNetInstallCommand>sh '$(DotNetInstallScriptPath)' --version $(MicrosoftNETSdkPackageVersion) --install-dir '$(DotNetDirectory)' --verbose</DotNetInstallCommand>
</PropertyGroup>
<PropertyGroup>
<_ProvisionDependsOn>
_DownloadDotNetInstallScript;
_InstallDotNet;
_AcquireWorkloads;
_AcquirePacks;
_CreateWorkloadSentinel;
</_ProvisionDependsOn>
</PropertyGroup>
<Target Name="_Provision" BeforeTargets="Build" DependsOnTargets="$(_ProvisionDependsOn)" />
<PropertyGroup>
<!-- These files should invalidate ./bin/dotnet completely -->
<_Inputs>
$(MSBuildThisFile);
../../eng/Version.props;
</_Inputs>
</PropertyGroup>
<Target Name="_DownloadDotNetInstallScript"
Inputs="$(_Inputs)"
Outputs="$(DotNetInstallScriptPath)">
<DownloadFile
SourceUrl="$(DotNetInstallScriptUrl)"
DestinationFolder="$(MauiOutputPath)"
DestinationFileName="$(DotNetInstallScriptName)"
/>
</Target>
<Target Name="_InstallDotNet"
Inputs="$(_Inputs)"
Outputs="$(DotNetDirectory).stamp">
<RemoveDir Directories="$(DotNetDirectory)" />
<Exec Command="$(DotNetInstallCommand)" />
<Touch Files="$(DotNetDirectory).stamp" AlwaysCreate="true" />
</Target>
<ItemGroup>
<!-- These are extra packs that get extracted that should be deleted -->
<_PacksToRemove Include="microsoft.build.notargets" />
<_PacksToRemove Include="microsoft.netcore.platforms" />
<_PacksToRemove Include="netstandard.library" />
</ItemGroup>
<Target Name="_AcquireWorkloads"
Inputs="$(_Inputs);Dependencies/Workloads.csproj"
Outputs="$(DotNetSdkManifestsDirectory).stamp">
<Exec
Command="&quot;$(DotNetToolPath)&quot; restore &quot;$(MSBuildThisFileDirectory)Dependencies/Workloads.csproj&quot; -bl:$(PackageOutputPath)/DotNetWorkloads.binlog"
EnvironmentVariables="NUGET_PACKAGES=$(DotNetSdkManifestsDirectory);DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1"
/>
<!--
NOTE: Workloads need to go in dotnet/sdk-manifests/6.0.100/Microsoft.Workload.NET.*/
Workloads only contain two files: WorkloadManifest.targets & WorkloadManifest.json
We have to move everything up one directory, for things to land in the right location.
-->
<ItemGroup>
<_WorkloadFiles Include="$(DotNetSdkManifestsDirectory)Microsoft.NET.Workload.*/*/WorkloadManifest.*" />
<_WorkloadDirectoriesToDelete Include="@(_WorkloadFiles->'%(RootDir)%(Directory)'->Distinct())" />
</ItemGroup>
<Copy SourceFiles="@(_WorkloadFiles)" DestinationFiles="@(_WorkloadFiles->'%(RootDir)%(Directory)../%(FileName)%(Extension)')" />
<RemoveDir Directories="@(_WorkloadDirectoriesToDelete);@(_PacksToRemove->'$(DotNetSdkManifestsDirectory)%(Identity)')" />
<Touch Files="$(DotNetSdkManifestsDirectory).stamp" AlwaysCreate="true" />
</Target>
<Target Name="_AcquirePacks"
Inputs="$(_Inputs);Dependencies/Packs.csproj"
Outputs="$(DotNetPacksDirectory).stamp">
<Exec
Command="&quot;$(DotNetToolPath)&quot; restore &quot;$(MSBuildThisFileDirectory)Dependencies/Packs.csproj&quot; -bl:$(PackageOutputPath)/DotNetPacks.binlog"
EnvironmentVariables="NUGET_PACKAGES=$(DotNetPacksDirectory);DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1"
/>
<RemoveDir Directories="@(_PacksToRemove->'$(DotNetPacksDirectory)%(Identity)')" />
<Touch Files="$(DotNetPacksDirectory).stamp" AlwaysCreate="true" />
</Target>
<Target Name="_CreateWorkloadSentinel"
Inputs="$(_Inputs)"
Outputs="$(DotNetSentinelPath)">
<Touch Files="$(DotNetSentinelPath)" AlwaysCreate="true" />
</Target>
</Project>