diff --git a/Before.Java.Interop.sln.targets b/Before.Java.Interop.sln.targets index 09d57401a..6a0c00417 100644 --- a/Before.Java.Interop.sln.targets +++ b/Before.Java.Interop.sln.targets @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 521e68a47..2d850d6a5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,4 +52,11 @@ <_XamarinAndroidCecilPath Condition=" '$(CecilSourceDirectory)' != '' And Exists('$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll') ">$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll $([System.IO.Path]::GetFullPath ('$(XamarinAndroidToolsDirectory)')) + + 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' ">$(Runtime) "$(_JNIEnvGenPath)" + diff --git a/Makefile b/Makefile index dbadfd6f6..4c595a1b7 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,8 @@ prepare-external $(PREPARE_EXTERNAL_FILES): (cd external/xamarin-android-tools && $(MAKE) prepare) nuget restore +prepare-core: bin/Build$(CONFIGURATION)/MonoInfo.props src/Java.Runtime.Environment/Java.Runtime.Environment.dll.config + clean: -$(MSBUILD) $(MSBUILD_FLAGS) /t:Clean -rm -Rf bin/$(CONFIGURATION) bin/Build$(CONFIGURATION) bin/Test$(CONFIGURATION) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index c97e25fae..5f558b5fe 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -10,7 +10,7 @@ pr: # Global variables variables: - DotNetCoreVersion: 3.1.201 + DotNetCoreVersion: 3.1.300 HostedMac: Hosted Mac Internal HostedWinVS2019: Hosted Windows 2019 with VS2019 @@ -25,10 +25,7 @@ jobs: - checkout: self submodules: recursive - - task: UseDotNet@2 - displayName: Use .NET Core $(DotNetCoreVersion) - inputs: - version: $(DotNetCoreVersion) + - template: templates\install-dependencies.yaml - task: NuGetToolInstaller@0 inputs: @@ -78,71 +75,13 @@ jobs: - checkout: self submodules: recursive - - task: UseDotNet@2 - displayName: Use .NET Core $(DotNetCoreVersion) - inputs: - version: $(DotNetCoreVersion) - - - task: DotNetCoreCLI@2 - displayName: Prepare Solution - inputs: - projects: Java.Interop.sln - arguments: '-c $(Build.Configuration) -target:Prepare' - - - task: DotNetCoreCLI@2 - displayName: Build Solution - inputs: - projects: Java.Interop.sln - arguments: '-c $(Build.Configuration)' - - - task: DotNetCoreCLI@2 - displayName: 'Tests: Java.Interop.Tools.Generator' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\Java.Interop.Tools.Generator-Tests.dll - continueOnError: true - - - task: DotNetCoreCLI@2 - displayName: 'Tests: generator' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\generator-Tests.dll - continueOnError: true - - - task: DotNetCoreCLI@2 - displayName: 'Tests: JavaCallableWrappers' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\Java.Interop.Tools.JavaCallableWrappers-Tests.dll - continueOnError: true + - template: templates\install-dependencies.yaml - - task: DotNetCoreCLI@2 - displayName: 'Tests: logcat-parse' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\logcat-parse-Tests.dll - continueOnError: true + - template: templates\core-build.yaml - - task: DotNetCoreCLI@2 - displayName: 'Tests: ApiXmlAdjuster' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\Xamarin.Android.Tools.ApiXmlAdjuster-Tests.dll - continueOnError: true + - template: templates\core-tests.yaml - - task: DotNetCoreCLI@2 - displayName: 'Tests: Bytecode' - inputs: - command: test - arguments: bin\Test$(Build.Configuration)\Xamarin.Android.Tools.Bytecode-Tests.dll - continueOnError: true - - - powershell: | - Write-Host "Current job status is: $env:AGENT_JOBSTATUS" - if ($env:AGENT_JOBSTATUS -eq "SucceededWithIssues") { - Write-Host "##vso[task.complete result=Failed;]DONE" - } - displayName: Fail job if tests failed + - template: templates\fail-on-issue.yaml - job: mac_build displayName: Mac - Mono @@ -154,15 +93,7 @@ jobs: - checkout: self submodules: recursive - - task: UseDotNet@2 - displayName: Use .NET Core $(DotNetCoreVersion) - inputs: - version: $(DotNetCoreVersion) - - - script: | - dotnet tool install --global boots - boots --stable Mono - displayName: Install Mono-Stable + - template: templates\install-dependencies.yaml - script: make prepare CONFIGURATION=$(Build.Configuration) displayName: make prepare @@ -200,3 +131,24 @@ jobs: inputs: ArtifactName: debug condition: succeededOrFailed() + +- job: mac_dotnet_build + displayName: Mac - .NET Core + pool: $(HostedMac) + timeoutInMinutes: 20 + workspace: + clean: all + steps: + - checkout: self + submodules: recursive + + - template: templates\install-dependencies.yaml + + - script: make prepare-core CONFIGURATION=$(Build.Configuration) + displayName: make prepare-core + + - template: templates\core-build.yaml + + - template: templates\core-tests.yaml + + - template: templates\fail-on-issue.yaml diff --git a/build-tools/automation/templates/core-build.yaml b/build-tools/automation/templates/core-build.yaml new file mode 100644 index 000000000..b631aed7c --- /dev/null +++ b/build-tools/automation/templates/core-build.yaml @@ -0,0 +1,15 @@ +parameters: + condition: succeeded() + +steps: +- task: DotNetCoreCLI@2 + displayName: Prepare Solution + inputs: + projects: Java.Interop.sln + arguments: '-c $(Build.Configuration) -target:Prepare' + +- task: DotNetCoreCLI@2 + displayName: Build Solution + inputs: + projects: Java.Interop.sln + arguments: '-c $(Build.Configuration) -m:1' diff --git a/build-tools/automation/templates/core-tests.yaml b/build-tools/automation/templates/core-tests.yaml new file mode 100644 index 000000000..ba16127ac --- /dev/null +++ b/build-tools/automation/templates/core-tests.yaml @@ -0,0 +1,74 @@ +parameters: + condition: succeeded() + +steps: +- task: DotNetCoreCLI@2 + displayName: 'Tests: generator' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/generator-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: JavaCallableWrappers' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/Java.Interop.Tools.JavaCallableWrappers-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: logcat-parse' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/logcat-parse-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: ApiXmlAdjuster' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/Xamarin.Android.Tools.ApiXmlAdjuster-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: Bytecode' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/Xamarin.Android.Tools.Bytecode-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: Java.Interop.Tools.Generator' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/Java.Interop.Tools.Generator-Tests.dll + continueOnError: true + +- task: DotNetCoreCLI@2 + displayName: 'Tests: Java.Interop.Tools.JavaSource' + inputs: + command: test + arguments: bin/Test$(Build.Configuration)/Java.Interop.Tools.JavaSource-Tests.dll + continueOnError: true + +# Running native Java.Interop tests are not yet supported on .NET Core +#- task: DotNetCoreCLI@2 +# displayName: 'Tests: Java.Interop' +# inputs: +# command: test +# arguments: bin/Test$(Build.Configuration)/Java.Interop-Tests.dll +# continueOnError: true + +#- task: DotNetCoreCLI@2 +# displayName: 'Tests: Java.Interop.Dynamic' +# inputs: +# command: test +# arguments: bin/Test$(Build.Configuration)/Java.Interop.Dynamic-Tests.dll +# continueOnError: true + +#- task: DotNetCoreCLI@2 +# displayName: 'Tests: Java.Interop.Export' +# inputs: +# command: test +# arguments: bin/Test$(Build.Configuration)/Java.Interop.Export-Tests.dll +# continueOnError: true diff --git a/build-tools/automation/templates/fail-on-issue.yaml b/build-tools/automation/templates/fail-on-issue.yaml new file mode 100644 index 000000000..ad3f176f9 --- /dev/null +++ b/build-tools/automation/templates/fail-on-issue.yaml @@ -0,0 +1,10 @@ +parameters: + condition: succeeded() + +steps: +- powershell: | + Write-Host "Current job status is: $env:AGENT_JOBSTATUS" + if ($env:AGENT_JOBSTATUS -eq "SucceededWithIssues") { + Write-Host "##vso[task.complete result=Failed;]DONE" + } + displayName: fail if any issues occurred diff --git a/build-tools/automation/templates/install-dependencies.yaml b/build-tools/automation/templates/install-dependencies.yaml new file mode 100644 index 000000000..8bd8bf2f4 --- /dev/null +++ b/build-tools/automation/templates/install-dependencies.yaml @@ -0,0 +1,14 @@ +parameters: + condition: succeeded() + +steps: +- task: UseDotNet@2 + displayName: Use .NET Core $(DotNetCoreVersion) + inputs: + version: $(DotNetCoreVersion) + +- script: | + dotnet tool install --global boots + boots --stable Mono + displayName: Install Mono-Stable + condition: and(succeeded(), eq(variables['agent.os'], 'Darwin')) diff --git a/build-tools/jnienv-gen/jnienv-gen.csproj b/build-tools/jnienv-gen/jnienv-gen.csproj index 94e11ce24..11caad93f 100644 --- a/build-tools/jnienv-gen/jnienv-gen.csproj +++ b/build-tools/jnienv-gen/jnienv-gen.csproj @@ -11,4 +11,7 @@ $(BuildToolOutputFullPath) + + + diff --git a/build-tools/scripts/PrepareWindows.targets b/build-tools/scripts/Prepare.targets similarity index 100% rename from build-tools/scripts/PrepareWindows.targets rename to build-tools/scripts/Prepare.targets diff --git a/samples/Hello/Hello.csproj b/samples/Hello/Hello.csproj index 4925324e2..402863d2a 100644 --- a/samples/Hello/Hello.csproj +++ b/samples/Hello/Hello.csproj @@ -11,6 +11,10 @@ $(TestOutputFullPath) + + + + diff --git a/src/Java.Interop/Directory.Build.targets b/src/Java.Interop/Directory.Build.targets index 205b49e0d..95609908a 100644 --- a/src/Java.Interop/Directory.Build.targets +++ b/src/Java.Interop/Directory.Build.targets @@ -1,12 +1,5 @@ - - 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' ">$(Runtime) "$(_JNIEnvGenPath)" - @@ -21,16 +14,16 @@ + Outputs="Java.Interop/JniEnvironment.g.cs;$(IntermediateOutputPath)jni.c"> - <_AddCompile Condition=" !Exists('Java.Interop\JniEnvironment.g.cs') ">True + <_AddCompile Condition=" !Exists('Java.Interop/JniEnvironment.g.cs') ">True - + - + + + + + diff --git a/src/java-interop/java-interop.targets b/src/java-interop/java-interop.targets index 7c8120ec7..87f5ec272 100644 --- a/src/java-interop/java-interop.targets +++ b/src/java-interop/java-interop.targets @@ -1,17 +1,14 @@ - - mono - - + - <_MacLib>$(OutputPath)\lib$(OutputName).dylib + <_MacLib>$(OutputPath)/lib$(OutputName).dylib @(_Includes->'-I "%(Identity)"', ' ') @@ -47,7 +44,8 @@ <_Libs>$(MonoLibs) <_Files>@(ClCompile->'obj\$(Configuration)\%(Filename).o', ' ') - + + @@ -69,7 +67,7 @@ <_Libs>$(MonoLibs) <_Files>@(ClCompile->'obj\$(Configuration)\%(Filename).o', ' ') - + diff --git a/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj b/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj index b1eb84682..311f3e586 100644 --- a/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj +++ b/tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj @@ -15,6 +15,7 @@ + diff --git a/tests/Java.Interop-Tests/Java.Interop-Tests.csproj b/tests/Java.Interop-Tests/Java.Interop-Tests.csproj index 7da6cb398..99adeff12 100644 --- a/tests/Java.Interop-Tests/Java.Interop-Tests.csproj +++ b/tests/Java.Interop-Tests/Java.Interop-Tests.csproj @@ -20,6 +20,7 @@ + @@ -42,7 +43,7 @@ - + diff --git a/tests/Java.Interop.Dynamic-Tests/Java.Interop.Dynamic-Tests.csproj b/tests/Java.Interop.Dynamic-Tests/Java.Interop.Dynamic-Tests.csproj index 332940095..29eeb39ac 100644 --- a/tests/Java.Interop.Dynamic-Tests/Java.Interop.Dynamic-Tests.csproj +++ b/tests/Java.Interop.Dynamic-Tests/Java.Interop.Dynamic-Tests.csproj @@ -19,6 +19,7 @@ + diff --git a/tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj b/tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj index 635267802..a419f1b7f 100644 --- a/tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj +++ b/tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj @@ -16,6 +16,7 @@ + @@ -31,7 +32,7 @@ - + diff --git a/tests/Java.Interop.Tools.Generator-Tests/Java.Interop.Tools.Generator-Tests.csproj b/tests/Java.Interop.Tools.Generator-Tests/Java.Interop.Tools.Generator-Tests.csproj index a556d2ff4..acea34c9d 100644 --- a/tests/Java.Interop.Tools.Generator-Tests/Java.Interop.Tools.Generator-Tests.csproj +++ b/tests/Java.Interop.Tools.Generator-Tests/Java.Interop.Tools.Generator-Tests.csproj @@ -15,6 +15,7 @@ + diff --git a/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj b/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj index f16ad4351..a2d6c88e4 100644 --- a/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj +++ b/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj @@ -17,6 +17,7 @@ + diff --git a/tests/Java.Interop.Tools.JavaSource-Tests/Java.Interop.Tools.JavaSource-Tests.csproj b/tests/Java.Interop.Tools.JavaSource-Tests/Java.Interop.Tools.JavaSource-Tests.csproj index 3ab2f12e3..fcba001d0 100644 --- a/tests/Java.Interop.Tools.JavaSource-Tests/Java.Interop.Tools.JavaSource-Tests.csproj +++ b/tests/Java.Interop.Tools.JavaSource-Tests/Java.Interop.Tools.JavaSource-Tests.csproj @@ -11,6 +11,7 @@ + diff --git a/tests/TestJVM/TestJVM.csproj b/tests/TestJVM/TestJVM.csproj index 54965bae5..4d0d45a0f 100644 --- a/tests/TestJVM/TestJVM.csproj +++ b/tests/TestJVM/TestJVM.csproj @@ -14,6 +14,7 @@ + diff --git a/tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests.csproj b/tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests.csproj index 7d9cd12f4..bb5bcb475 100644 --- a/tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests.csproj +++ b/tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests.csproj @@ -14,6 +14,7 @@ + diff --git a/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj b/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj index 50a2a9a77..4be137c63 100644 --- a/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj +++ b/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj @@ -14,6 +14,7 @@ + @@ -52,7 +53,7 @@ - + diff --git a/tests/generator-Tests/generator-Tests.csproj b/tests/generator-Tests/generator-Tests.csproj index 28930d381..676b24374 100644 --- a/tests/generator-Tests/generator-Tests.csproj +++ b/tests/generator-Tests/generator-Tests.csproj @@ -18,6 +18,7 @@ + diff --git a/tests/logcat-parse-Tests/logcat-parse-Tests.csproj b/tests/logcat-parse-Tests/logcat-parse-Tests.csproj index 427208207..9414d13b3 100644 --- a/tests/logcat-parse-Tests/logcat-parse-Tests.csproj +++ b/tests/logcat-parse-Tests/logcat-parse-Tests.csproj @@ -14,6 +14,7 @@ + diff --git a/tools/class-parse/class-parse.csproj b/tools/class-parse/class-parse.csproj index da6a86a52..43f43f3de 100644 --- a/tools/class-parse/class-parse.csproj +++ b/tools/class-parse/class-parse.csproj @@ -11,6 +11,7 @@ + diff --git a/tools/generator/generator.csproj b/tools/generator/generator.csproj index e95c7c7d0..86e0fc58f 100644 --- a/tools/generator/generator.csproj +++ b/tools/generator/generator.csproj @@ -37,6 +37,7 @@ $(PkgHtmlAgilityPack)\lib\netstandard2.0\HtmlAgilityPack.dll + diff --git a/tools/jcw-gen/jcw-gen.csproj b/tools/jcw-gen/jcw-gen.csproj index fce17425b..16ae9a47e 100644 --- a/tools/jcw-gen/jcw-gen.csproj +++ b/tools/jcw-gen/jcw-gen.csproj @@ -11,6 +11,7 @@ + diff --git a/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj b/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj index 97ffb58df..ac7dcab72 100644 --- a/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj +++ b/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj @@ -23,6 +23,7 @@ + diff --git a/tools/logcat-parse/logcat-parse.csproj b/tools/logcat-parse/logcat-parse.csproj index 417f25d93..5fd738989 100644 --- a/tools/logcat-parse/logcat-parse.csproj +++ b/tools/logcat-parse/logcat-parse.csproj @@ -13,6 +13,7 @@ + diff --git a/tools/param-name-importer/param-name-importer.csproj b/tools/param-name-importer/param-name-importer.csproj index 1c2e0ee38..e2105d242 100644 --- a/tools/param-name-importer/param-name-importer.csproj +++ b/tools/param-name-importer/param-name-importer.csproj @@ -20,6 +20,7 @@ $(PkgMicrosoft_Xml_SgmlReader)\lib\netstandard2.0\SgmlReaderDll.dll +