Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TFM overrides per MultiTarget #218

Merged
merged 8 commits into from
Oct 25, 2024
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,12 @@ jobs:
- name: Generate solution
shell: pwsh
working-directory: ./
run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -MultiTargets wasm

# Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App.Wasm.csproj
- name: dotnet build
working-directory: ./${{ env.HEADS_DIRECTORY }}/AllComponents/Wasm/
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
shell: pwsh
working-directory: ./
run: ./tooling/Build-Toolkit-Components.ps1 -Release -MultiTargets wasm ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -BinlogOutput ./ -EnableBinLogs' || '' }}

# TODO: Do we want to run tests here? Can we do that on linux easily?

Expand Down
24 changes: 22 additions & 2 deletions Build-Toolkit-Components.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,21 @@ function Invoke-MSBuildWithBinlog {
)

# Reset build args to default
$msbuildArgs = @("-r", "-m", "/p:DebugType=Portable")
$msbuildArgs = @("/p:DebugType=Portable")

# Add "-r" parameter if not running on linux
if ($($PSVersionTable.Platform) -ne "Unix") {
$msbuildArgs += "-r"
}
# Otherwise, add "-restore" parameter
else {
$msbuildArgs += "-restore"
}

# Add "-m" parameter if not running on linux
if ($($PSVersionTable.Platform) -ne "Unix") {
$msbuildArgs += "-m"
}

# Add packing to the msbuild arguments if NupkgOutput is supplied
if ($NupkgOutput) {
Expand Down Expand Up @@ -170,7 +184,13 @@ function Invoke-MSBuildWithBinlog {
$msbuildArgs += "/v:detailed"
}

msbuild $msbuildArgs $TargetHeadPath
# If platform is linux, use dotnet instead of msbuild
if ($($PSVersionTable.Platform) -eq "Unix") {
dotnet build $msbuildArgs $TargetHeadPath
}
else {
msbuild $msbuildArgs $TargetHeadPath
}
}

# Components are built individually
Expand Down
26 changes: 13 additions & 13 deletions MultiTarget/AvailableTargetFrameworks.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project>
<PropertyGroup>
<UwpTargetFramework>uap10.0.17763</UwpTargetFramework>
<WinAppSdkTargetFramework>net8.0-windows10.0.22621.0;net7.0-windows10.0.22621.0;net6.0-windows10.0.22621.0;</WinAppSdkTargetFramework>
<UwpTargetFramework Condition="'$(UwpTargetFramework)' == ''">uap10.0.17763</UwpTargetFramework>
<WinAppSdkTargetFramework Condition="'$(WinAppSdkTargetFramework)' == ''">net8.0-windows10.0.22621.0;net7.0-windows10.0.22621.0;net6.0-windows10.0.22621.0;</WinAppSdkTargetFramework>

<WasmHeadTargetFramework>net8.0</WasmHeadTargetFramework>
<LinuxHeadTargetFramework>net8.0</LinuxHeadTargetFramework>
<WpfHeadTargetFramework>net8.0</WpfHeadTargetFramework>
<WasmHeadTargetFramework Condition="'$(WasmHeadTargetFramework)' == ''">net8.0</WasmHeadTargetFramework>
Sergio0694 marked this conversation as resolved.
Show resolved Hide resolved
<LinuxHeadTargetFramework Condition="'$(LinuxHeadTargetFramework)' == ''">net8.0</LinuxHeadTargetFramework>
<WpfHeadTargetFramework Condition="'$(WpfHeadTargetFramework)' == ''">net8.0</WpfHeadTargetFramework>

<AndroidLibTargetFramework>net8.0-android34.0</AndroidLibTargetFramework>
<MacOSLibTargetFramework>net8.0-maccatalyst</MacOSLibTargetFramework>
<iOSLibTargetFramework>net8.0-ios</iOSLibTargetFramework>
<AndroidLibTargetFramework Condition="'$(AndroidLibTargetFramework)' == ''">net8.0-android34.0</AndroidLibTargetFramework>
<MacOSLibTargetFramework Condition="'$(MacOSLibTargetFramework)' == ''">net8.0-maccatalyst</MacOSLibTargetFramework>
<iOSLibTargetFramework Condition="'$(iOSLibTargetFramework)' == ''">net8.0-ios</iOSLibTargetFramework>

<!-- Used for comparison to current TargetFramework -->
<LinuxLibTargetFramework>net8.0</LinuxLibTargetFramework>
<WasmLibTargetFramework>net8.0</WasmLibTargetFramework>
<WpfLibTargetFramework>net8.0</WpfLibTargetFramework>
<LinuxLibTargetFramework Condition="'$(LinuxLibTargetFramework)' == ''">net8.0</LinuxLibTargetFramework>
<WasmLibTargetFramework Condition="'$(WasmLibTargetFramework)' == ''">net8.0</WasmLibTargetFramework>
<WpfLibTargetFramework Condition="'$(WpfLibTargetFramework)' == ''">net8.0</WpfLibTargetFramework>

<!-- Used for defining TargetFramework under platforms that need it -->
<DotnetStandardCommonTargetFramework>netstandard2.0</DotnetStandardCommonTargetFramework>
<DotnetCommonTargetFramework>net8.0</DotnetCommonTargetFramework>
<DotnetStandardCommonTargetFramework Condition="'$(DotnetStandardCommonTargetFramework)' == ''">netstandard2.0</DotnetStandardCommonTargetFramework>
<DotnetCommonTargetFramework Condition="'$(DotnetCommonTargetFramework)' == ''">net8.0</DotnetCommonTargetFramework>
</PropertyGroup>
</Project>
22 changes: 11 additions & 11 deletions MultiTarget/EnabledTargetFrameworks.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project>
<PropertyGroup>
<UwpTargetFramework>uap10.0.17763</UwpTargetFramework>
<WinAppSdkTargetFramework>net8.0-windows10.0.22621.0;net7.0-windows10.0.22621.0;net6.0-windows10.0.22621.0;</WinAppSdkTargetFramework>
<UwpTargetFramework Condition="'$(UwpTargetFramework)' == ''">uap10.0.17763</UwpTargetFramework>
<WinAppSdkTargetFramework Condition="'$(WinAppSdkTargetFramework)' == ''">net8.0-windows10.0.22621.0;net7.0-windows10.0.22621.0;net6.0-windows10.0.22621.0;</WinAppSdkTargetFramework>

<WasmHeadTargetFramework Condition="'$(WasmHeadTargetFramework)' == ''">net8.0</WasmHeadTargetFramework>
<LinuxHeadTargetFramework Condition="'$(LinuxHeadTargetFramework)' == ''">net8.0</LinuxHeadTargetFramework>
<WpfHeadTargetFramework Condition="'$(WpfHeadTargetFramework)' == ''">net8.0</WpfHeadTargetFramework>

<WasmHeadTargetFramework>net8.0</WasmHeadTargetFramework>
<LinuxHeadTargetFramework>net8.0</LinuxHeadTargetFramework>
<WpfHeadTargetFramework>net8.0</WpfHeadTargetFramework>





<!-- Used for comparison to current TargetFramework -->
<LinuxLibTargetFramework>net8.0</LinuxLibTargetFramework>
<WasmLibTargetFramework>net8.0</WasmLibTargetFramework>
<WpfLibTargetFramework>net8.0</WpfLibTargetFramework>
<LinuxLibTargetFramework Condition="'$(LinuxLibTargetFramework)' == ''">net8.0</LinuxLibTargetFramework>
<WasmLibTargetFramework Condition="'$(WasmLibTargetFramework)' == ''">net8.0</WasmLibTargetFramework>
<WpfLibTargetFramework Condition="'$(WpfLibTargetFramework)' == ''">net8.0</WpfLibTargetFramework>

<!-- Used for defining TargetFramework under platforms that need it -->
<DotnetStandardCommonTargetFramework>netstandard2.0</DotnetStandardCommonTargetFramework>
<DotnetCommonTargetFramework>net8.0</DotnetCommonTargetFramework>
<DotnetStandardCommonTargetFramework Condition="'$(DotnetStandardCommonTargetFramework)' == ''">netstandard2.0</DotnetStandardCommonTargetFramework>
<DotnetCommonTargetFramework Condition="'$(DotnetCommonTargetFramework)' == ''">net8.0</DotnetCommonTargetFramework>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion MultiTarget/UseTargetFrameworks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $targetFrameworksToRemove = @(

$targetFrameworksToRemoveRegexPartial = $targetFrameworksToRemove -join "|";

$newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial)>.+?>", '';
$newFileContents = $fileContents -replace "<(?:$targetFrameworksToRemoveRegexPartial).+?>.+?>", '';

Set-Content -Force -Path $PSScriptRoot/EnabledTargetFrameworks.props -Value $newFileContents;

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.201",
"version": "8.0.403",
"rollForward": "latestFeature"
},
"msbuild-sdks":
Expand Down
Loading