diff --git a/Directory.Build.props b/Directory.Build.props index bb59986b2..0fca5ff0e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,7 +27,7 @@ False obj\ - + True @@ -50,6 +50,7 @@ $(MSBuildThisFileDirectory)external\xamarin-android-tools + dotnet cmake $(MSBuildThisFileDirectory)build-tools\gradle $(GradleHome)\gradlew @@ -67,7 +68,7 @@ mono <_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BuildToolOutputFullPath)jnienv-gen.dll <_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BuildToolOutputFullPath)jnienv-gen.exe - <_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">dotnet "$(_JNIEnvGenPath)" + <_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(DotnetToolPath) "$(_JNIEnvGenPath)" <_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)" diff --git a/build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/JdkInfo.cs b/build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/JdkInfo.cs index 31acad96a..53981a60e 100644 --- a/build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/JdkInfo.cs +++ b/build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/JdkInfo.cs @@ -21,6 +21,8 @@ public class JdkInfo : Task public string MaximumJdkVersion { get; set; } + public string DotnetToolPath { get; set; } + static Regex VersionExtractor = new Regex (@"(?[\d]+(\.\d+)+)", RegexOptions.Compiled); [Required] @@ -95,6 +97,7 @@ Action CreateLogger () void WritePropertyFile (string javaPath, string jarPath, string javacPath, string jdkJvmPath, string rtJarPath, IEnumerable includes) { + var dotnet = string.IsNullOrEmpty (DotnetToolPath) ? "dotnet" : DotnetToolPath; var msbuild = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003"); var project = new XElement (msbuild + "Project", new XElement (msbuild + "Choose", @@ -112,6 +115,8 @@ void WritePropertyFile (string javaPath, string jarPath, string javacPath, strin javacPath), new XElement (msbuild + "JarPath", new XAttribute ("Condition", " '$(JarPath)' == '' "), jarPath), + new XElement (msbuild + "DotnetToolPath", new XAttribute ("Condition", " '$(DotnetToolPath)' == '' "), + dotnet), CreateJreRtJarPath (msbuild, rtJarPath))); project.Save (PropertyFile.ItemSpec); } diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 25b80de03..c163b2203 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -19,10 +19,10 @@ variables: RunningOnCI: true Build.Configuration: Release MaxJdkVersion: 8 - DotNetCoreVersion: 5.0.103 + DotNetCoreVersion: 6.0.x HostedMacImage: macOS-10.15 HostedWinVS2019: Hosted Windows 2019 with VS2019 - NetCoreTargetFrameworkPathSuffix: -netcoreapp3.1 + NetCoreTargetFrameworkPathSuffix: -net6.0 VSInstallRoot: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise jobs: @@ -38,15 +38,13 @@ jobs: - template: templates\install-dependencies.yaml - - task: NuGetToolInstaller@0 + - task: MSBuild@1 + displayName: MSBuild Java.Interop.sln /t:Restore inputs: - versionSpec: 5.x + solution: Java.Interop.sln + configuration: $(Build.Configuration) + msbuildArguments: /t:Restore /p:RestoreConfigFile=$(System.DefaultWorkingDirectory)\external\xamarin-android-tools\NuGet.config - - task: NuGetCommand@2 - inputs: - command: custom - arguments: restore external\xamarin-android-tools\Xamarin.Android.Tools.sln -ConfigFile external\xamarin-android-tools\NuGet.config - - task: MSBuild@1 displayName: MSBuild Java.Interop.sln /t:Prepare inputs: @@ -108,7 +106,12 @@ jobs: submodules: recursive - template: templates\install-dependencies.yaml - + + - script: > + dotnet tool install --global boots && + boots --preview Mono + displayName: Install Mono + - script: make prepare CONFIGURATION=$(Build.Configuration) JI_MAX_JDK=$(MaxJdkVersion) displayName: make prepare diff --git a/build-tools/automation/templates/install-dependencies.yaml b/build-tools/automation/templates/install-dependencies.yaml index 496379a56..a8a0040f5 100644 --- a/build-tools/automation/templates/install-dependencies.yaml +++ b/build-tools/automation/templates/install-dependencies.yaml @@ -6,3 +6,4 @@ steps: displayName: Use .NET Core $(DotNetCoreVersion) inputs: version: $(DotNetCoreVersion) + includePreviewVersions: true diff --git a/build-tools/jnienv-gen/jnienv-gen.csproj b/build-tools/jnienv-gen/jnienv-gen.csproj index 11caad93f..71466f043 100644 --- a/build-tools/jnienv-gen/jnienv-gen.csproj +++ b/build-tools/jnienv-gen/jnienv-gen.csproj @@ -2,7 +2,7 @@ Exe - net472;netcoreapp3.1 + net472;net6.0 false $(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\ diff --git a/build-tools/scripts/Prepare.targets b/build-tools/scripts/Prepare.targets index 71f7e70d3..b13e9651a 100644 --- a/build-tools/scripts/Prepare.targets +++ b/build-tools/scripts/Prepare.targets @@ -15,6 +15,7 @@ JdksRoot="$(ProgramFiles)\Java" MakeFragmentFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.mk" MaximumJdkVersion="$(_MaxJdk)" + DotnetToolPath="$(DotnetToolPath)" PropertyFile="$(_TopDir)\bin\Build$(Configuration)\JdkInfo.props"> diff --git a/build-tools/scripts/jdk.mk b/build-tools/scripts/jdk.mk index f078f78a6..74ea11577 100644 --- a/build-tools/scripts/jdk.mk +++ b/build-tools/scripts/jdk.mk @@ -45,4 +45,5 @@ endif # $(OS)=Linux $(_INCLUDE_MK) $(_INCLUDE_PROPS): bin/Build$(CONFIGURATION)/Java.Interop.BootstrapTasks.dll $(MSBUILD) $(MSBUILD_FLAGS) build-tools/scripts/jdk.targets /t:GetPreferredJdkRoot \ /p:JdksRoot="$(_JDKS_ROOT)" \ + /p:DotnetToolPath="$(DOTNET_TOOL_PATH)" \ $(if $(JI_MAX_JDK),"/p:MaximumJdkVersion=$(JI_MAX_JDK)") diff --git a/build-tools/scripts/jdk.targets b/build-tools/scripts/jdk.targets index df083e8aa..e71f1d921 100644 --- a/build-tools/scripts/jdk.targets +++ b/build-tools/scripts/jdk.targets @@ -6,6 +6,7 @@ JdksRoot="$(JdksRoot)" MakeFragmentFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.mk" MaximumJdkVersion="$(MaximumJdkVersion)" + DotnetToolPath="$(DotnetToolPath)" PropertyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props"> diff --git a/global.json b/global.json index 8831967d8..40c464e57 100644 --- a/global.json +++ b/global.json @@ -1,4 +1,7 @@ { + "sdk": { + "allowPrerelease": true + }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1" } diff --git a/src/Java.Interop.Export/Java.Interop.Export.csproj b/src/Java.Interop.Export/Java.Interop.Export.csproj index d608d87ee..8d923e92d 100644 --- a/src/Java.Interop.Export/Java.Interop.Export.csproj +++ b/src/Java.Interop.Export/Java.Interop.Export.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netcoreapp3.1 + netstandard2.0;net6.0 8.0 {B501D075-6183-4E1D-92C9-F7B5002475B1} true diff --git a/src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj b/src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj index 099b50ec5..62da24d00 100644 --- a/src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj +++ b/src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj @@ -24,6 +24,8 @@ {94BD81F7-B06F-4295-9636-F8A3B6BDC762} Java.Interop + true + TargetFramework=netstandard2.0 \ No newline at end of file diff --git a/src/Java.Interop/Java.Interop.csproj b/src/Java.Interop/Java.Interop.csproj index 88eadd83d..263a61de3 100644 --- a/src/Java.Interop/Java.Interop.csproj +++ b/src/Java.Interop/Java.Interop.csproj @@ -4,8 +4,19 @@ ..\..\bin\Build$(Configuration)\XAConfig.props + + + netstandard2.0 + <_JniEnvSkipGetTargetFrameworkProperties>true + <_JniEnvAdditionalProperties>TargetFramework=net472 + + + netstandard2.0;net6.0 + - netstandard2.0;netcoreapp3.1 1591 true ..\..\product.snk @@ -57,6 +68,8 @@ diff --git a/src/java-interop/java-interop.csproj b/src/java-interop/java-interop.csproj index 4db957592..20b5ef3c3 100644 --- a/src/java-interop/java-interop.csproj +++ b/src/java-interop/java-interop.csproj @@ -1,6 +1,6 @@ - net472;netcoreapp3.1 + net472;net6.0 $(ToolOutputFullPath) $(BuildToolOutputFullPath) java-interop diff --git a/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj b/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj index 33cee5a8e..ae3295562 100644 --- a/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj +++ b/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1 + net472;net6.0 false true diff --git a/tests/Java.Interop-Tests/Java.Interop-Tests.csproj b/tests/Java.Interop-Tests/Java.Interop-Tests.csproj index a39a8e8f1..a04402fd4 100644 --- a/tests/Java.Interop-Tests/Java.Interop-Tests.csproj +++ b/tests/Java.Interop-Tests/Java.Interop-Tests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1 + net472;net6.0 false true @@ -10,7 +10,7 @@ $(TestOutputFullPath) - + $(DefineConstants);NO_MARSHAL_MEMBER_BUILDER_SUPPORT;NO_GC_BRIDGE_SUPPORT @@ -37,7 +37,7 @@ - + diff --git a/tests/TestJVM/TestJVM.csproj b/tests/TestJVM/TestJVM.csproj index ab52b760f..809df0552 100644 --- a/tests/TestJVM/TestJVM.csproj +++ b/tests/TestJVM/TestJVM.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1 + net472;net6.0 false diff --git a/tests/invocation-overhead/Directory.Build.targets b/tests/invocation-overhead/Directory.Build.targets index 923147232..40974f9e9 100644 --- a/tests/invocation-overhead/Directory.Build.targets +++ b/tests/invocation-overhead/Directory.Build.targets @@ -29,7 +29,7 @@ Targets="_Run_net472" /> diff --git a/tests/invocation-overhead/invocation-overhead.csproj b/tests/invocation-overhead/invocation-overhead.csproj index 36117f0a1..15ab142b9 100644 --- a/tests/invocation-overhead/invocation-overhead.csproj +++ b/tests/invocation-overhead/invocation-overhead.csproj @@ -2,7 +2,7 @@ Exe - net472;netcoreapp3.1 + net472;net6.0 True True FEATURE_JNIENVIRONMENT_JI_INTPTRS;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIENVIRONMENT_SAFEHANDLES;FEATURE_JNIENVIRONMENT_XA_INTPTRS diff --git a/tools/class-parse/class-parse.csproj b/tools/class-parse/class-parse.csproj index 43f43f3de..4dc32967b 100644 --- a/tools/class-parse/class-parse.csproj +++ b/tools/class-parse/class-parse.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1 + net472;net6.0 Exe diff --git a/tools/generator/generator.csproj b/tools/generator/generator.csproj index 80bcf2b0f..34e613108 100644 --- a/tools/generator/generator.csproj +++ b/tools/generator/generator.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1 + net472;net6.0 Exe $(DefineConstants);GENERATOR;HAVE_CECIL;JCW_ONLY_TYPE_NAMES 8.0 diff --git a/tools/jcw-gen/jcw-gen.csproj b/tools/jcw-gen/jcw-gen.csproj index 16ae9a47e..5fddaafc9 100644 --- a/tools/jcw-gen/jcw-gen.csproj +++ b/tools/jcw-gen/jcw-gen.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1 + net472;net6.0 Exe diff --git a/tools/logcat-parse/logcat-parse.csproj b/tools/logcat-parse/logcat-parse.csproj index e189818e2..a5d083424 100644 --- a/tools/logcat-parse/logcat-parse.csproj +++ b/tools/logcat-parse/logcat-parse.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1 + net472;net6.0 Exe diff --git a/tools/param-name-importer/param-name-importer.csproj b/tools/param-name-importer/param-name-importer.csproj index e2105d242..6aa6f057c 100644 --- a/tools/param-name-importer/param-name-importer.csproj +++ b/tools/param-name-importer/param-name-importer.csproj @@ -1,6 +1,6 @@ - net472;netcoreapp3.1 + net472;net6.0 Exe