Use custom property instead of solution name for TFM variant selection
This commit is contained in:
Родитель
fa185d4eb3
Коммит
4a972dfe47
|
@ -1,6 +1,6 @@
|
|||
<Project>
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove(directory.build.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(directory.build.props))')" />
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
|
@ -11,7 +11,12 @@
|
|||
<PowerShellCommand Condition=" '$(OS)' == 'Unix' ">pwsh</PowerShellCommand>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command="$(PowerShellCommand) -ExecutionPolicy Unrestricted -NoProfile -File $(RepositoryDirectory)Common/Scripts/UpdateTargetFrameworks.ps1 $(SolutionName) --Verbose"
|
||||
WorkingDirectory="$(RepositoryDirectory)Common/Scripts/" />
|
||||
<PropertyGroup>
|
||||
<LabsTargetPlatformsVariant Condition="'$(SolutionName)' == 'Toolkit.Labs.All'">All</LabsTargetPlatformsVariant>
|
||||
<LabsTargetPlatformsVariant Condition="'$(SolutionName)' == 'Toolkit.Labs.Wasm'">Wasm</LabsTargetPlatformsVariant>
|
||||
<LabsTargetPlatformsVariant Condition="'$(LabsTargetPlatformsVariant)' == ''">Windows</LabsTargetPlatformsVariant>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command="$(PowerShellCommand) -ExecutionPolicy Unrestricted -NoProfile -File $(RepositoryDirectory)Common/Scripts/UpdateTargetFrameworks.ps1 $(LabsTargetPlatformsVariant) --Verbose" WorkingDirectory="$(RepositoryDirectory)Common/Scripts/" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,26 +1,32 @@
|
|||
if (Test-Path ".\..\Labs.TargetFrameworks.props.lock")
|
||||
{
|
||||
return;
|
||||
if (Test-Path ".\..\Labs.TargetFrameworks.props.lock") {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($args.Length -eq 0 -or ![bool]$args[0]) {
|
||||
Write-Error "Missing parameter. Please supply a variant value of All, Wasm or Windows.";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$variant = $args[0];
|
||||
|
||||
Set-Content -Path .\..\Labs.TargetFrameworks.props.lock -Value '';
|
||||
|
||||
$slnName = $args[0];
|
||||
|
||||
$fileContents = Get-Content -Path .\..\Labs.TargetFrameworks.default.props
|
||||
$newFileContents = $fileContents;
|
||||
|
||||
# If solution is set to All, don't do any replacements and copy all TFMs.
|
||||
if (-not($slnName -eq "Toolkit.Labs.All")) {
|
||||
if ($variant -eq "All") {
|
||||
# If set to All, don't do any replacements and copy all TFMs.
|
||||
$newFileContents = $fileContents;
|
||||
}
|
||||
|
||||
# If WASM, remove all non-wasm TFMs
|
||||
if ($slnName -eq "Toolkit.Labs.Wasm") {
|
||||
$newFileContents = $fileContents -replace '<(UwpTargetFramework|WinAppSdkTargetFramework|WpfLibTargetFramework|LinuxLibTargetFramework|AndroidLibTargetFramework|MacOSLibTargetFramework|iOSLibTargetFramework)>.+?>', '';
|
||||
}
|
||||
# If any other solution, assume minimal Windows dependencies.
|
||||
else {
|
||||
$newFileContents = $fileContents -replace '<(LinuxLibTargetFramework|AndroidLibTargetFramework|MacOSLibTargetFramework|iOSLibTargetFramework)>.+?>', '';
|
||||
}
|
||||
if ($variant -eq "Wasm") {
|
||||
# Remove all non-wasm TFMs
|
||||
$newFileContents = $fileContents -replace '<(UwpTargetFramework|WinAppSdkTargetFramework|WpfLibTargetFramework|LinuxLibTargetFramework|AndroidLibTargetFramework|MacOSLibTargetFramework|iOSLibTargetFramework)>.+?>', '';
|
||||
Set-Content -Path .\..\Labs.TargetFrameworks.props.wasmonly -Value '';
|
||||
}
|
||||
|
||||
if ($variant -eq "Windows") {
|
||||
# Minimal Windows dependencies.
|
||||
$newFileContents = $fileContents -replace '<(LinuxLibTargetFramework|AndroidLibTargetFramework|MacOSLibTargetFramework|iOSLibTargetFramework)>.+?>', '';
|
||||
Set-Content -Path .\..\Labs.TargetFrameworks.props.windowsonly -Value '';
|
||||
}
|
||||
|
||||
if ($newFileContents -eq $fileContents) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop" InitialTargets="Clean">
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Import Project="$(RepositoryDirectory)Common\Labs.TargetFrameworks.default.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче