Skip to content

Commit cc8a876

Browse files
[build] target net6.0 instead of netcoreapp3.1
Context: dotnet/android#5891 Context: dotnet/android@e59f649 xamarin-android should imminently be building libraries targeting `net6.0` instead of `netcoreapp3.1`. We should be able to do this now, because Mono 6.12.0.137 supports building both .NET 5.0 and .NET 6.0.
1 parent df4c5e7 commit cc8a876

File tree

19 files changed

+50
-28
lines changed

19 files changed

+50
-28
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<AppendTargetFrameworkToOutputPath Condition=" '$(AppendTargetFrameworkToOutputPath)' == '' ">False</AppendTargetFrameworkToOutputPath>
2828
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\</BaseIntermediateOutputPath>
2929
</PropertyGroup>
30-
<PropertyGroup Condition=" '$(TargetFramework)' != '' And $(TargetFramework.StartsWith ('netcoreapp')) ">
30+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
3131
<JIBuildingForNetCoreApp>True</JIBuildingForNetCoreApp>
3232
</PropertyGroup>
3333
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">

build-tools/automation/azure-pipelines.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ variables:
1919
RunningOnCI: true
2020
Build.Configuration: Release
2121
MaxJdkVersion: 8
22-
DotNetCoreVersion: 5.0.103
22+
DotNetCoreVersion: 6.0.x
2323
HostedMacImage: macOS-10.15
2424
HostedWinVS2019: Hosted Windows 2019 with VS2019
25-
NetCoreTargetFrameworkPathSuffix: -netcoreapp3.1
25+
NetCoreTargetFrameworkPathSuffix: -net6.0
2626
VSInstallRoot: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
2727

2828
jobs:
@@ -38,15 +38,13 @@ jobs:
3838

3939
- template: templates\install-dependencies.yaml
4040

41-
- task: NuGetToolInstaller@0
41+
- task: MSBuild@1
42+
displayName: MSBuild Java.Interop.sln /t:Restore
4243
inputs:
43-
versionSpec: 5.x
44+
solution: Java.Interop.sln
45+
configuration: $(Build.Configuration)
46+
msbuildArguments: /t:Restore /p:RestoreConfigFile=$(System.DefaultWorkingDirectory)\external\xamarin-android-tools\NuGet.config
4447

45-
- task: NuGetCommand@2
46-
inputs:
47-
command: custom
48-
arguments: restore external\xamarin-android-tools\Xamarin.Android.Tools.sln -ConfigFile external\xamarin-android-tools\NuGet.config
49-
5048
- task: MSBuild@1
5149
displayName: MSBuild Java.Interop.sln /t:Prepare
5250
inputs:
@@ -108,7 +106,12 @@ jobs:
108106
submodules: recursive
109107

110108
- template: templates\install-dependencies.yaml
111-
109+
110+
- script: >
111+
dotnet tool install --global boots &&
112+
boots --preview Mono
113+
displayName: Install Mono
114+
112115
- script: make prepare CONFIGURATION=$(Build.Configuration) JI_MAX_JDK=$(MaxJdkVersion)
113116
displayName: make prepare
114117

build-tools/automation/templates/install-dependencies.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ steps:
66
displayName: Use .NET Core $(DotNetCoreVersion)
77
inputs:
88
version: $(DotNetCoreVersion)
9+
includePreviewVersions: true

build-tools/jnienv-gen/jnienv-gen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
66
<IsPackable>false</IsPackable>
77
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
88
</PropertyGroup>

global.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"sdk": {
3+
"allowPrerelease": true
4+
},
25
"msbuild-sdks": {
36
"Microsoft.Build.NoTargets": "2.0.1"
47
}

src/Java.Interop.Export/Java.Interop.Export.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
55
<LangVersion>8.0</LangVersion>
66
<ProjectGuid>{B501D075-6183-4E1D-92C9-F7B5002475B1}</ProjectGuid>
77
<SignAssembly>true</SignAssembly>

src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<ProjectReference Include="..\Java.Interop\Java.Interop.csproj">
2525
<Project>{94BD81F7-B06F-4295-9636-F8A3B6BDC762}</Project>
2626
<Name>Java.Interop</Name>
27+
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
28+
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
2729
</ProjectReference>
2830
</ItemGroup>
2931
</Project>

src/Java.Interop/Java.Interop.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@
44
<XAConfigPath>..\..\bin\Build$(Configuration)\XAConfig.props</XAConfigPath>
55
</PropertyGroup>
66
<Import Condition="Exists ('$(XAConfigPath)')" Project="$(XAConfigPath)" />
7+
<!--
8+
NOTE: in xamarin-android, this project gets built by xabuild in Xamarin.Android-Tests.sln
9+
Exclude net6.0, because xabuild cannot build net5.0 or higher
10+
-->
11+
<PropertyGroup Condition=" '$(XABuild)' == 'true' ">
12+
<TargetFramework>netstandard2.0</TargetFramework>
13+
<_JniEnvSkipGetTargetFrameworkProperties>true</_JniEnvSkipGetTargetFrameworkProperties>
14+
<_JniEnvAdditionalProperties>TargetFramework=net472</_JniEnvAdditionalProperties>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(XABuild)' != 'true' ">
17+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
18+
</PropertyGroup>
719
<PropertyGroup>
8-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
920
<NoWarn>1591</NoWarn>
1021
<SignAssembly>true</SignAssembly>
1122
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
@@ -57,6 +68,8 @@
5768
<None Include="Documentation\Java.Interop\JniEnvironment.References.xml" />
5869
<ProjectReference Include="..\..\build-tools\jnienv-gen\jnienv-gen.csproj"
5970
ReferenceOutputAssembly="false"
71+
SkipGetTargetFrameworkProperties="$(_JniEnvSkipGetTargetFrameworkProperties)"
72+
AdditionalProperties="$(_JniEnvAdditionalProperties)"
6073
/>
6174
</ItemGroup>
6275
<ItemGroup>

src/java-interop/java-interop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.Build.NoTargets">
22
<PropertyGroup>
3-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
44
<OutputPath>$(ToolOutputFullPath)</OutputPath>
55
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
66
<OutputName>java-interop</OutputName>

tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
</PropertyGroup>

0 commit comments

Comments
 (0)