Skip to content

Commit

Permalink
[One .NET] Target net6.0 instead of netcoreapp3.1 (#5891)
Browse files Browse the repository at this point in the history
Projects which were multitargetd to support .NET 6 have been updated to
target `net6.0` instead of `netcoreapp3.1`.  CI has been updated to
install .NET 6 preview 3 instead of .NET 5.

* Bump to xamarin/xamarin-android-tools/main@683f375

Changes: dotnet/android-tools@c5732a0...683f375
  • Loading branch information
pjcollins authored Apr 30, 2021
1 parent 0e74266 commit fefc151
Show file tree
Hide file tree
Showing 20 changed files with 35 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public sealed class CheckApiCompatibility : Task

static readonly string assemblyToValidate = "Mono.Android.dll";

static readonly string netCoreAppVersion = "netcoreapp3.1";
static readonly string netCoreAppVersion = "net6.0";
static string compatApiCommand = null;

// Path where Microsoft.DotNet.ApiCompat nuget package is located
Expand Down
2 changes: 1 addition & 1 deletion build-tools/automation/azure-pipelines-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ variables:
InstallerArtifactName: installers-unsigned
TestAssembliesArtifactName: test-assemblies
DotNetCoreVersion: 3.1.405
DotNet5Version: 5.0.201
DotNet6Version: 6.0.100-preview.3.21202.5
HostedMacImage: macOS-10.15
GitHub.Token: $(github--pat--vs-mobiletools-engineering-service2)
NUnit.NumberOfTestWorkers: 4
Expand Down
6 changes: 1 addition & 5 deletions build-tools/automation/azure-pipelines-oss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ variables:
EXTRA_MSBUILD_ARGS: /p:AutoProvision=True /p:AutoProvisionUsesSudo=True /p:IgnoreMaxMonoVersion=False
PREPARE_FLAGS: PREPARE_CI=1 PREPARE_CI_PR=1
DotNetCoreVersion: 3.1.405
DotNet5Version: 5.0.201
DotNet6Version: 6.0.100-preview.3.21202.5
GitHub.Token: $(github--pat--vs-mobiletools-engineering-service2)

stages:
Expand All @@ -54,7 +54,6 @@ stages:

- template: yaml-templates/use-dot-net.yaml
parameters:
version: $(DotNet5Version)
remove_dotnet: true

- template: yaml-templates/use-dot-net.yaml
Expand Down Expand Up @@ -174,9 +173,6 @@ stages:
submodules: recursive

- template: yaml-templates/use-dot-net.yaml
parameters:
version: $(DotNet5Version)
remove_dotnet: true

- template: yaml-templates/use-dot-net.yaml
parameters:
Expand Down
14 changes: 7 additions & 7 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ variables:
TestAssembliesArtifactName: test-assemblies
NUnitConsoleVersion: 3.11.1
DotNetCoreVersion: 3.1.405
DotNet5Version: 5.0.201
DotNet6Version: 6.0.100-preview.3.21202.5
HostedMacImage: macOS-10.15
HostedWinVS2019: Hosted Windows 2019 with VS2019
VSEngWinVS2019: Xamarin-Android-Win2019
Expand Down Expand Up @@ -193,8 +193,6 @@ stages:
displayName: set JI_JAVA_HOME
- template: yaml-templates\use-dot-net.yaml
parameters:
version: $(DotNet5Version)

- template: yaml-templates\use-dot-net.yaml
parameters:
Expand Down Expand Up @@ -317,8 +315,6 @@ stages:
displayName: set JI_JAVA_HOME
- template: yaml-templates\use-dot-net.yaml
parameters:
version: $(DotNet5Version)

- template: yaml-templates\use-dot-net.yaml
parameters:
Expand Down Expand Up @@ -445,8 +441,6 @@ stages:
displayName: delete external xamarin-android submodule

- template: yaml-templates/use-dot-net.yaml
parameters:
version: $(DotNet5Version)

- template: yaml-templates/use-dot-net.yaml
parameters:
Expand Down Expand Up @@ -1316,6 +1310,10 @@ stages:
- checkout: release_scripts
clean: true

- template: yaml-templates/use-dot-net.yaml
parameters:
remove_dotnet: true

- template: yaml-templates/use-dot-net.yaml
parameters:
version: $(DotNetCoreVersion)
Expand Down Expand Up @@ -1415,6 +1413,8 @@ stages:
- checkout: self
submodules: recursive

- template: yaml-templates/use-dot-net.yaml

- task: DownloadPipelineArtifact@2
inputs:
${{ if eq(variables['MicroBuildSignType'], 'Real') }}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ steps:

- template: use-dot-net.yaml
parameters:
version: $(DotNet5Version)
remove_dotnet: true

- template: use-dot-net.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ steps:
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))

- template: use-dot-net.yaml
parameters:
version: $(DotNet5Version)
remove_dotnet: true

- template: use-dot-net.yaml
parameters:
version: $(DotNetCoreVersion)

- task: MSBuild@1
displayName: build xaprepare
Expand Down
2 changes: 1 addition & 1 deletion build-tools/automation/yaml-templates/use-dot-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# We prefer this over the UseDotNet task so that we can always clean up old/unstable versions on disk.

parameters:
version: $(DotNetCoreVersion)
version: $(DotNet6Version)
remove_dotnet: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<UsingTask TaskName="GenerateBuildManifest" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll" />

<PropertyGroup>
<_MonoAndroidNETOutputDir>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\netcoreapp3.1\</_MonoAndroidNETOutputDir>
<_MonoAndroidNETOutputDir>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0\</_MonoAndroidNETOutputDir>
<_WorkloadResolverFlagFile>$(DotNetPreviewPath)sdk\$(MicrosoftDotnetSdkInternalPackageVersion)\EnableWorkloadResolver.sentinel</_WorkloadResolverFlagFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion build-tools/create-packs/Microsoft.Android.Sdk.proj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ core workload sdk packs imported by Microsoft.NET.Workload.Android.
DependsOnTargets="ConstructInstallerItems;_GenerateBundledVersions;_GetLicense">
<PropertyGroup>
<ToolsSourceDir>$(XamarinAndroidSourcePath)bin\Build$(Configuration)\packs\tools\</ToolsSourceDir>
<NetCoreAppToolsSourceDir>$(XamarinAndroidSourcePath)bin\$(Configuration)-netcoreapp3.1\</NetCoreAppToolsSourceDir>
<NetCoreAppToolsSourceDir>$(XamarinAndroidSourcePath)bin\$(Configuration)-net6.0\</NetCoreAppToolsSourceDir>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<CecilSourceDirectory>$(MSBuildThisFileDirectory)..\..\external\mono\external\cecil</CecilSourceDirectory>
<UtilityOutputFullPath>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\</UtilityOutputFullPath>
<UtilityOutputFullPathCoreApps>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)-netcoreapp3.1\</UtilityOutputFullPathCoreApps>
<UtilityOutputFullPathCoreApps>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)-net6.0\</UtilityOutputFullPathCoreApps>
<XamarinAndroidToolsDirectory>$(MSBuildThisFileDirectory)..\..\external\xamarin-android-tools</XamarinAndroidToolsDirectory>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions build-tools/scripts/JavaCallableWrappers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<OutputPathAbs Condition=" '$(OutputPathAbs)' == '' ">$(MSBuildProjectDirectory)\$(OutputPath)</OutputPathAbs>
<JcwGen>"$(XAInstallPrefix)xbuild\Xamarin\Android\jcw-gen.exe" -v10</JcwGen>
<_LibDirs>-L "$(OutputPathAbs.TrimEnd('\'))"</_LibDirs>
<_LibDirs Condition=" '$(TargetFramework)' != 'netcoreapp3.1' ">$(_LibDirs) -L "$(OutputPathAbs)..\v1.0" -L "$(OutputPathAbs)..\v1.0\Facades"</_LibDirs>
<_LibDirs Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">$(_LibDirs) -L "$(_CorlibDir.TrimEnd('\'))"</_LibDirs>
<_LibDirs Condition=" '$(TargetFramework)' != 'net6.0' ">$(_LibDirs) -L "$(OutputPathAbs)..\v1.0" -L "$(OutputPathAbs)..\v1.0\Facades"</_LibDirs>
<_LibDirs Condition=" '$(TargetFramework)' == 'net6.0' ">$(_LibDirs) -L "$(_CorlibDir.TrimEnd('\'))"</_LibDirs>
<_Out>-o "$(MSBuildProjectDirectory)\$(IntermediateOutputPath)jcw\src"</_Out>
</PropertyGroup>
<Exec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public static partial class Paths

public static string TestBinDir => GetCachedPath (ref testBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"Test{ctx.Configuration}"));
public static string BinDir => GetCachedPath (ref binDir, () => Path.Combine (Configurables.Paths.BinDirRoot, ctx.Configuration));
public static string NetCoreBinDir => GetCachedPath (ref netCoreBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"{ctx.Configuration}-netcoreapp3.1"));
public static string NetCoreBinDir => GetCachedPath (ref netCoreBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"{ctx.Configuration}-net6.0"));
public static string BuildBinDir => GetCachedPath (ref buildBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"Build{ctx.Configuration}"));
public static string MingwBinDir => GetCachedPath (ref mingwBinDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidMxeFullPath), "bin"));
public static string ProfileAssembliesProjitemsPath => GetCachedPath (ref profileAssembliesProjitemsPath, () => Path.Combine (BuildBinDir, "ProfileAssemblies.projitems"));
Expand Down
2 changes: 1 addition & 1 deletion external/xamarin-android-tools
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"sdk": {
"allowPrerelease": true
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "2.0.1",
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20555.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\Configuration.props" />
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<DefineConstants>NET5_LINKER</DefineConstants>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(XAInstallPrefix)xbuild\Xamarin\Android\</OutputPath>
Expand Down
8 changes: 4 additions & 4 deletions src/Mono.Android.Export/Mono.Android.Export.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<Import Project="..\..\Configuration.props" />

<PropertyGroup>
<!-- Only build for netcoreapp3.1 for $(AndroidLatestStableFrameworkVersion) -->
<!-- Only build for net6.0 for $(AndroidLatestStableFrameworkVersion) -->
<TargetFrameworks Condition=" '$(AndroidFrameworkVersion)' != '$(AndroidLatestStableFrameworkVersion)' ">monoandroid10</TargetFrameworks>
<TargetFrameworks Condition=" '$(AndroidFrameworkVersion)' == '$(AndroidLatestStableFrameworkVersion)' ">monoandroid10;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(AndroidFrameworkVersion)' == '$(AndroidLatestStableFrameworkVersion)' ">monoandroid10;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<NoStdLib>true</NoStdLib>
Expand All @@ -21,7 +21,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<OutputPath>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\</OutputPath>
</PropertyGroup>

Expand Down Expand Up @@ -52,7 +52,7 @@
</Reference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop\Java.Interop.csproj" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Import Project="..\..\Configuration.props" />

<PropertyGroup>
<TargetFrameworks>monoandroid10;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>monoandroid10;net6.0</TargetFrameworks>
<RootNamespace>Android</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -41,7 +41,7 @@
<OutputPath>$(XAInstallPrefix)xbuild-frameworks\MonoAndroid\$(AndroidFrameworkVersion)\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<OutputPath>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\$(TargetFramework)\</OutputPath>
</PropertyGroup>

Expand Down Expand Up @@ -92,7 +92,7 @@
</Reference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop\Java.Interop.csproj" />
<EmbeddedResource Include="ILLink/ILLink.LinkAttributes.xml">
<LogicalName>ILLink.LinkAttributes.xml</LogicalName>
Expand Down Expand Up @@ -375,8 +375,8 @@
<Target Name="GetTargetPath" />

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- Only build the 'netcoreapp3.1' version of 'Mono.Android.dll' once for the latest stable Android version. -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' And '$(AndroidFrameworkVersion)' != '$(AndroidLatestStableFrameworkVersion)' ">
<!-- Only build the 'net6.0' version of 'Mono.Android.dll' once for the latest stable Android version. -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' And '$(AndroidFrameworkVersion)' != '$(AndroidLatestStableFrameworkVersion)' ">
<BuildDependsOn></BuildDependsOn>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Mono.Android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<_PackageVersion>$(ProductVersion)</_PackageVersion>
<_PackageVersionBuild>$(XAVersionCommitCount)</_PackageVersionBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<_PackageVersion>$(AndroidPackVersion)</_PackageVersion>
<_PackageVersionBuild>$(PackVersionCommitCount)</_PackageVersionBuild>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Android.App\InstrumentationAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Android.App\LayoutAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\IJniNameProviderAttribute.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net5.0' ">
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net6.0' ">
<Compile Include="$(MSBuildThisFileDirectory)System.Diagnostics.CodeAnalysis/DynamicallyAccessedMemberTypes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System.Diagnostics.CodeAnalysis/DynamicDependencyAttribute.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tools/javadoc2mdoc/javadoc2mdoc.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputType>Exe</OutputType>
<RootNamespace>Xamarin.Android.Tools.JavadocToMDoc</RootNamespace>
Expand Down

0 comments on commit fefc151

Please sign in to comment.