diff --git a/Documentation/release-notes/4567.md b/Documentation/release-notes/4567.md new file mode 100644 index 000000000..02dbf23bd --- /dev/null +++ b/Documentation/release-notes/4567.md @@ -0,0 +1,32 @@ +### Preliminary JDK 11 Support + +Xamarin.Android can now use JDK 11 to build libraries and applications. + +JDK 11 is required in order to use Android SDK Build-tools r30, +currently a release candidate. Future versions of the Android SDK +*may* require JDK 11 for more scenarios. JDK 11 *is not required* +at this point in time. + +Project authors can try switching to JDK 11 now to prepare +potential future JDK 11 requirements. + +To do so: + + 1. Install JDK 11, for example + [JetBrains Runtime](https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime) + + 2. Tell Xamarin.Android to use JDK 11. This can be done within + [Visual Studio](https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/update-jdk?tabs=windows), + or can be done by setting the the `$(JavaSdkDirectory)` MSBuild + property to refer to the root of the JDK installation from (1). + +#### Known Issues + +When JDK 11 is used, the `@(JavaSourceJar)` Build action is not supported, +and binding projects will not parse Javadoc to determine parameter names. +This may result in different parameter names for existing bindings projects. +Authors of bindings projects affected by this change are recommended to +continue to use JDK 8 to build the bindings projects until this issue is +resolved. + +The fix is being tracked as: https://github.com/xamarin/xamarin-android/issues/4789 diff --git a/build-tools/automation/azure-pipelines-oss.yaml b/build-tools/automation/azure-pipelines-oss.yaml index 760da6a86..01030e5db 100644 --- a/build-tools/automation/azure-pipelines-oss.yaml +++ b/build-tools/automation/azure-pipelines-oss.yaml @@ -17,7 +17,8 @@ pr: # Predefined variables: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml # https://dev.azure.com/xamarin/public/_apps/hub/ms.vss-ciworkflow.build-ci-hub?_a=edit-build-definition&id=48&view=Tab_Variables variables: - XA.Jdk.Folder: jdk-1.8 + XA.Jdk8.Folder: jdk-1.8 + XA.Jdk11.Folder: jdk-11 XA.Build.MacOSSPool: VSEng-Xamarin-RedmondMacMojaveBuildPool-Android-OSS XA.Build.LinuxOSSPool: Xamarin-Android-Ubuntu-Public @@ -158,7 +159,7 @@ stages: - script: echo "##vso[task.setvariable variable=HOME]$(Agent.HomeDirectory)" displayName: set HOME to agent directory - - script: echo "##vso[task.setvariable variable=PATH]$PATH:$(Agent.HomeDirectory)/android-toolchain/$(XA.Jdk.Folder)/bin" + - script: echo "##vso[task.setvariable variable=PATH]$PATH:$(Agent.HomeDirectory)/android-toolchain/$(XA.Jdk11.Folder)/bin" displayName: append jdk tools to PATH - script: make jenkins V=1 PREPARE_CI_PR=1 PREPARE_AUTOPROVISION=1 CONFIGURATION=$(XA.Build.Configuration) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 0014a0f8c..cc73a43d9 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -44,7 +44,8 @@ resources: # Global variables variables: - XA.Jdk.Folder: jdk-1.8 + XA.Jdk8.Folder: jdk-1.8 + XA.Jdk11.Folder: jdk-11 NuGetArtifactName: nupkgs InstallerArtifactName: installers TestAssembliesArtifactName: test-assemblies @@ -97,8 +98,8 @@ stages: - checkout: self submodules: recursive - - script: echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/Library/Android/$(XA.Jdk.Folder)" - displayName: set JAVA_HOME + - script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/$(XA.Jdk11.Folder)" + displayName: set JI_JAVA_HOME - template: yaml-templates/use-dot-net.yaml parameters: @@ -234,6 +235,10 @@ stages: - template: yaml-templates\clean.yaml + - script: | + echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder) + displayName: set JI_JAVA_HOME + - template: yaml-templates\use-dot-net.yaml parameters: version: $(DotNetCorePreviewVersion) @@ -896,7 +901,7 @@ stages: if (("$branchName" -ne "master") -and ("$branchName" -notlike "d16*")) { $branchName = "master" } - Set-Location -Path $(System.DefaultWorkingDirectory) + Set-Location -Path $(System.DefaultWorkingDirectory)/designer git checkout $branchName git submodule update -q --init --recursive displayName: Clone and update designer @@ -905,19 +910,31 @@ stages: displayName: provision designer dependencies inputs: github_token: $(GitHub.Token) - provisioning_script: $(System.DefaultWorkingDirectory)/bot-provisioning/dependencies.csx + provisioning_script: $(System.DefaultWorkingDirectory)/designer/bot-provisioning/dependencies.csx provisioning_extra_args: -remove Xamarin.Android -vv DEVDIV_PKGS_NUGET_TOKEN=$(DevDiv.NuGet.Token) SECTOOLS_PKGS_NUGET_TOKEN=$(SecTools.NuGet.Token) - - template: yaml-templates/run-installer.yaml + - template: yaml-templates/setup-test-environment.yaml + parameters: + xaSourcePath: $(System.DefaultWorkingDirectory)/xamarin-android + + - script: echo "##vso[task.setvariable variable=JavaSdkDirectory]$HOME/Library/Android/$(XA.Jdk8.Folder)" + displayName: set JavaSdkDirectory + + - script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/$(XA.Jdk8.Folder)" + displayName: reset JI_JAVA_HOME for Designer - template: designer/android-designer-build-mac.yaml@yaml + parameters: + designerSourcePath: $(System.DefaultWorkingDirectory)/designer - template: designer/android-designer-tests.yaml@yaml + parameters: + designerSourcePath: $(System.DefaultWorkingDirectory)/designer - task: CopyFiles@2 displayName: 'Copy binlogs' inputs: - sourceFolder: Xamarin.Designer.Android + sourceFolder: $(System.DefaultWorkingDirectory)/designer/Xamarin.Designer.Android contents: '**/*.binlog' targetFolder: $(Build.ArtifactStagingDirectory)/designer-binlogs overWrite: true @@ -960,7 +977,7 @@ stages: if (("$branchName" -ne "master") -and ("$branchName" -notlike "d16*")) { $branchName = "master" } - Set-Location -Path $(System.DefaultWorkingDirectory) + Set-Location -Path $(System.DefaultWorkingDirectory)\designer git checkout $branchName git submodule update -q --init --recursive displayName: Clone and update designer @@ -969,19 +986,34 @@ stages: displayName: provision designer dependencies inputs: github_token: $(GitHub.Token) - provisioning_script: $(System.DefaultWorkingDirectory)\bot-provisioning\dependencies.csx + provisioning_script: $(System.DefaultWorkingDirectory)\designer\bot-provisioning\dependencies.csx provisioning_extra_args: -vv DEVDIV_PKGS_NUGET_TOKEN=$(DevDiv.NuGet.Token) SECTOOLS_PKGS_NUGET_TOKEN=$(SecTools.NuGet.Token) - - template: yaml-templates\run-installer.yaml + - template: yaml-templates\setup-test-environment.yaml + parameters: + xaSourcePath: $(System.DefaultWorkingDirectory)\xamarin-android + + - script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/$(XA.Jdk8.Folder)" + displayName: reset JI_JAVA_HOME for Designer + condition: and(succeeded(), eq(variables['agent.os'], 'Darwin')) + + - script: | + echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk8.Folder) + displayName: reset JI_JAVA_HOME for Designer + condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT')) - template: designer\android-designer-build-win.yaml@yaml + parameters: + designerSourcePath: $(System.DefaultWorkingDirectory)\designer - template: designer\android-designer-tests.yaml@yaml + parameters: + designerSourcePath: $(System.DefaultWorkingDirectory)\designer - task: CopyFiles@2 displayName: 'Copy binlogs' inputs: - sourceFolder: Xamarin.Designer.Android + sourceFolder: $(System.DefaultWorkingDirectory)/designer/Xamarin.Designer.Android contents: '**/*.binlog' targetFolder: $(Build.ArtifactStagingDirectory)/designer-binlogs overWrite: true diff --git a/build-tools/automation/yaml-templates/setup-test-environment.yaml b/build-tools/automation/yaml-templates/setup-test-environment.yaml index 9d5f8b5a4..b60fa3f6c 100644 --- a/build-tools/automation/yaml-templates/setup-test-environment.yaml +++ b/build-tools/automation/yaml-templates/setup-test-environment.yaml @@ -1,6 +1,7 @@ parameters: configuration: $(XA.Build.Configuration) provisionExtraArgs: -vv -f + xaSourcePath: $(System.DefaultWorkingDirectory) steps: - checkout: self @@ -11,6 +12,15 @@ steps: parameters: provisionExtraArgs: ${{ parameters.provisionExtraArgs }} +- script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/$(XA.Jdk11.Folder)" + displayName: set JI_JAVA_HOME + condition: and(succeeded(), eq(variables['agent.os'], 'Darwin')) + +- script: | + echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder) + displayName: set JI_JAVA_HOME + condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT')) + - template: use-dot-net.yaml parameters: version: $(DotNetCorePreviewVersion) @@ -33,20 +43,20 @@ steps: - task: MSBuild@1 displayName: build xaprepare inputs: - solution: build-tools/xaprepare/xaprepare.sln + solution: ${{ parameters.xaSourcePath }}/build-tools/xaprepare/xaprepare.sln configuration: ${{ parameters.configuration }} msbuildArguments: /restore - script: > - mono build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=UpdateMono --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI && - mono build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI && - mono build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=AndroidToolchain --no-emoji --run-mode=CI + mono ${{ parameters.xaSourcePath }}/build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=UpdateMono --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI && + mono ${{ parameters.xaSourcePath }}/build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI && + mono ${{ parameters.xaSourcePath }}/build-tools/xaprepare/xaprepare/bin/${{ parameters.configuration }}/xaprepare.exe --s=AndroidToolchain --no-emoji --run-mode=CI displayName: install test dependencies condition: and(succeeded(), eq(variables['agent.os'], 'Darwin')) - script: > - $(System.DefaultWorkingDirectory)\build-tools\xaprepare\xaprepare\bin\${{ parameters.configuration }}\xaprepare.exe --s=Required --auto-provision=yes --no-emoji --run-mode=CI && - $(System.DefaultWorkingDirectory)\build-tools\xaprepare\xaprepare\bin\${{ parameters.configuration }}\xaprepare.exe --s=AndroidToolchain --no-emoji --run-mode=CI + ${{ parameters.xaSourcePath }}\build-tools\xaprepare\xaprepare\bin\${{ parameters.configuration }}\xaprepare.exe --s=Required --auto-provision=yes --no-emoji --run-mode=CI && + ${{ parameters.xaSourcePath }}\build-tools\xaprepare\xaprepare\bin\${{ parameters.configuration }}\xaprepare.exe --s=AndroidToolchain --no-emoji --run-mode=CI displayName: install test dependencies condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT')) @@ -59,17 +69,17 @@ steps: displayName: nuget restore Xamarin.Android.Build.Tasks.sln inputs: command: custom - arguments: restore Xamarin.Android.Build.Tasks.sln -ConfigFile NuGet.config + arguments: restore ${{ parameters.xaSourcePath }}/Xamarin.Android.Build.Tasks.sln -ConfigFile ${{ parameters.xaSourcePath }}/NuGet.config -Verbosity detailed - task: NuGetCommand@2 displayName: nuget restore Xamarin.Android-Tests.sln inputs: command: custom - arguments: restore Xamarin.Android-Tests.sln -ConfigFile NuGet.config + arguments: restore ${{ parameters.xaSourcePath }}/Xamarin.Android-Tests.sln -ConfigFile ${{ parameters.xaSourcePath }}/NuGet.config -Verbosity detailed - task: MSBuild@1 displayName: build Xamarin.Android.Tools.BootstrapTasks.csproj inputs: - solution: build-tools/xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj + solution: ${{ parameters.xaSourcePath }}/build-tools/xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj configuration: ${{ parameters.configuration }} - msbuildArguments: /restore /bl:$(System.DefaultWorkingDirectory)/bin/Test${{ parameters.configuration }}/BootstrapTasks.binlog + msbuildArguments: /restore /bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/BootstrapTasks.binlog diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs index f3ee0bbd5..40334c39e 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs @@ -54,7 +54,7 @@ namespace Xamarin.Android.Prepare { public static readonly char[] PropertyListSeparator = new [] { ':' }; - public static readonly string JdkFolder = "jdk-1.8"; + public static readonly string JdkFolder = "jdk-11"; public static readonly Version JetBrainsOpenJDK11Version = new Version (Configurables.JetBrainsOpenJDK11Version); public static readonly Version JetBrainsOpenJDK11Release = new Version (Configurables.JetBrainsOpenJDK11Release); diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareExternalJavaInterop.Unix.cs b/build-tools/xaprepare/xaprepare/Steps/Step_PrepareExternalJavaInterop.Unix.cs index ce59185c1..b676976e7 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareExternalJavaInterop.Unix.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_PrepareExternalJavaInterop.Unix.cs @@ -20,6 +20,7 @@ namespace Xamarin.Android.Prepare "prepare", "V=1", $"CONFIGURATION={context.Configuration}", + $"JI_JAVA_HOME={context.OS.JavaHome}", $"JAVA_HOME={context.OS.JavaHome}", $"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}", } diff --git a/samples/HelloWorld/HelloLibrary/HelloLibrary.csproj b/samples/HelloWorld/HelloLibrary/HelloLibrary.csproj index 03f205b8c..0200146e0 100644 --- a/samples/HelloWorld/HelloLibrary/HelloLibrary.csproj +++ b/samples/HelloWorld/HelloLibrary/HelloLibrary.csproj @@ -13,9 +13,15 @@ HelloLibrary 512 false - True portable + + + $(AndroidFrameworkVersion) + true false diff --git a/samples/HelloWorld/HelloWorld.csproj b/samples/HelloWorld/HelloWorld.csproj index 8761ab56e..fb2db5520 100644 --- a/samples/HelloWorld/HelloWorld.csproj +++ b/samples/HelloWorld/HelloWorld.csproj @@ -14,8 +14,6 @@ Properties\AndroidManifest.xml Resources Assets - true - v7.1 d8 portable diff --git a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Documentation.targets b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Documentation.targets index c31086f59..ad1e824a3 100644 --- a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Documentation.targets +++ b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Documentation.targets @@ -16,7 +16,12 @@ This file is only used by binding projects. .NET 5 can eventually use it, once ` + + <_JavadocSupported Condition=" $(_JdkVersion.StartsWith ('1.8')) ">True + + + Outputs="@(IntermediateAssembly->'$(OutputPath)%(filename).xml')"> true 1.0 - 1.8.0 + 11.0.4 1.8.0 false true diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ValidateJavaVersion.cs b/src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ValidateJavaVersion.cs index 9e54758da..352d6697d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ValidateJavaVersion.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ValidateJavaVersion.cs @@ -48,6 +48,13 @@ namespace Xamarin.Android.Tasks.Legacy Version GetJavaVersionForFramework () { var apiLevel = MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); + if (apiLevel >= 30) { + // At present, it *looks like* API-R works with Build-tools r29, but + // historically API-X requires Build-tools rX, so if/when API-30 + // requires Build-tools r30, it will require JDK11. + // return new Version (11, 0); + return new Version (1, 8); + } if (apiLevel >= 24) return new Version (1, 8); else if (apiLevel == 23) @@ -58,10 +65,18 @@ namespace Xamarin.Android.Tasks.Legacy Version GetJavaVersionForBuildTools () { + string buildToolsVersionString = AndroidSdkBuildToolsVersion; + if (buildToolsVersionString != null) { + int index = buildToolsVersionString.IndexOf ('-'); + if (index != -1) + buildToolsVersionString = buildToolsVersionString.Substring (0, index); + } Version buildTools; - if (!Version.TryParse (AndroidSdkBuildToolsVersion, out buildTools)) { + if (!Version.TryParse (buildToolsVersionString, out buildTools)) { return Version.Parse (LatestSupportedJavaVersion); } + if (buildTools >= new Version (30, 0, 0)) + return new Version (11, 0); if (buildTools >= new Version (24, 0, 1)) return new Version (1, 8); return Version.Parse (MinimumSupportedJavaVersion); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs index 58db90e66..51ca9f7e5 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs @@ -445,11 +445,38 @@ namespace Foo { BinaryContent = () => Convert.FromBase64String (InlineData.JavaSourcesJarBase64) }); Assert.IsTrue (bindingBuilder.Build (binding), "binding build should have succeeded"); + var jdkVersion = GetJdkVersion (); + if (jdkVersion > new Version (9, 0)) { + Assert.Ignore ("JDK 11 and @(JavaSourceJar) don't currently mix."); + return; + } string xml = bindingBuilder.Output.GetIntermediaryAsText ("docs/Com.Xamarin.Android.Test.Msbuildtest/JavaSourceJarTest.xml"); Assert.IsTrue (xml.Contains (" - name to display."), "missing doc"); } } + static Version GetJdkVersion () + { + var jdkPath = AndroidSdkResolver.GetJavaSdkPath (); + var releasePath = Path.Combine (jdkPath, "release"); + if (!File.Exists (releasePath)) + return null; + foreach (var line in File.ReadLines (releasePath)) { + const string JavaVersionStart = "JAVA_VERSION=\""; + if (!line.StartsWith (JavaVersionStart, StringComparison.OrdinalIgnoreCase)) + continue; + var value = line.Substring (JavaVersionStart.Length, line.Length - JavaVersionStart.Length - 1); + int last = 0; + for (last = 0; last < value.Length; ++last) { + if (char.IsDigit (value, last) || value [last] == '.') + continue; + break; + } + return Version.Parse (last == value.Length ? value : value.Substring (0, last)); + } + return null; + } + [Test] [TestCaseSource (nameof (ClassParseOptions))] public void DesignTimeBuild (string classParser) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index 0759a264a..301e654de 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -3308,13 +3308,14 @@ AAMMAAABzYW1wbGUvSGVsbG8uY2xhc3NQSwUGAAAAAAMAAwC9AAAA1gEAAAAA") }); $"TargetFrameworkRootPath={referencesPath}", $"AndroidSdkDirectory={androidSdkPath}", }; + string buildToolsVersion = GetExpectedBuildToolsVersion (); using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), cleanupAfterSuccessfulBuild: false, cleanupOnDispose: false)) { builder.ThrowOnBuildFailure = false; builder.Target = "GetAndroidDependencies"; Assert.True (builder.Build (proj, parameters: parameters), string.Format ("First Build should have succeeded")); StringAssertEx.Contains ("platforms/android-26", builder.LastBuildOutput, "platforms/android-26 should be a dependency."); - StringAssertEx.Contains ("build-tools/29.0.2", builder.LastBuildOutput, "build-tools/29.0.2 should be a dependency."); + StringAssertEx.Contains ($"build-tools/{buildToolsVersion}", builder.LastBuildOutput, $"build-tools/{buildToolsVersion} should be a dependency."); StringAssertEx.Contains ("platform-tools", builder.LastBuildOutput, "platform-tools should be a dependency."); } } @@ -3341,17 +3342,30 @@ AAMMAAABzYW1wbGUvSGVsbG8uY2xhc3NQSwUGAAAAAAMAAwC9AAAA1gEAAAAA") }); $"AndroidSdkDirectory={androidSdkPath}", }; + string buildToolsVersion = GetExpectedBuildToolsVersion (); using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), cleanupAfterSuccessfulBuild: false, cleanupOnDispose: false)) { builder.ThrowOnBuildFailure = false; builder.Target = "GetAndroidDependencies"; Assert.True (builder.Build (proj, parameters: parameters), string.Format ("First Build should have succeeded")); StringAssertEx.Contains ("platforms/android-26", builder.LastBuildOutput, "platforms/android-26 should be a dependency."); - StringAssertEx.Contains ("build-tools/29.0.2", builder.LastBuildOutput, "build-tools/29.0.2 should be a dependency."); + StringAssertEx.Contains ($"build-tools/{buildToolsVersion}", builder.LastBuildOutput, $"build-tools/{buildToolsVersion} should be a dependency."); StringAssertEx.Contains ("platform-tools", builder.LastBuildOutput, "platform-tools should be a dependency."); } } + static readonly XNamespace MSBuildXmlns = "http://schemas.microsoft.com/developer/msbuild/2003"; + + static string GetExpectedBuildToolsVersion () + { + var propsPath = Path.Combine (XABuildPaths.TopDirectory, "src", "Xamarin.Android.Build.Tasks", "Xamarin.Android.Common.props.in"); + var props = XElement.Load (propsPath); + var AndroidSdkBuildToolsVersion = props.Elements (MSBuildXmlns+"PropertyGroup") + .Elements (MSBuildXmlns+"AndroidSdkBuildToolsVersion") + .FirstOrDefault (); + return AndroidSdkBuildToolsVersion?.Value?.Trim (); + } + [Test] public void ValidateUseLatestAndroid () { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/KeyToolTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/KeyToolTests.cs index 0917fd3da..6e7f49aaf 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/KeyToolTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/KeyToolTests.cs @@ -206,7 +206,7 @@ namespace Xamarin.Android.Build.Tests Assert.AreEqual (0, warnings.Count, "Task should have no warnings."); Assert.AreEqual (0, task.ExitCode, "ExitCode should have been 0"); string output = string.Join (" ", messages.Select (x => x.Message)); - Assert.IsTrue (output.Contains ("Certificate fingerprint (SHA1):"), "Certificate SHA1 should have been printed."); + Assert.IsTrue (output.Contains ("Certificate fingerprint (SHA"), "Certificate SHA1 or SHA-256 should have been printed."); } } } diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in index aea2b1056..b980344f0 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in @@ -7,7 +7,7 @@ false true true - 1.8.0 + 11.0.4 1.6.0 1.0 {abi}{versionCode:D5} diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 446ec683f..5860cb5cb 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2734,6 +2734,7 @@ because xbuild doesn't support framework reference assemblies. + diff --git a/tests/BCL-Tests/LocalTests.NUnit/LocalTests.NUnit.csproj b/tests/BCL-Tests/LocalTests.NUnit/LocalTests.NUnit.csproj index 9d7fb214e..4e6cc8597 100644 --- a/tests/BCL-Tests/LocalTests.NUnit/LocalTests.NUnit.csproj +++ b/tests/BCL-Tests/LocalTests.NUnit/LocalTests.NUnit.csproj @@ -8,14 +8,15 @@ Library LocalTests.NUnit LocalTests.NUnit - v8.1 Resources\Resource.designer.cs Resource Resources Assets - true + + $(AndroidFrameworkVersion) + true false diff --git a/tests/BCL-Tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj b/tests/BCL-Tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj index 32c40b79c..3d53c373d 100644 --- a/tests/BCL-Tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj +++ b/tests/BCL-Tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj @@ -9,18 +9,19 @@ Library UnitTestRunner Xamarin.Android.Bcl_Tests - v8.1 True Resources\Resource.designer.cs Resource Properties\AndroidManifest.xml Resources Assets - true false armeabi-v7a;x86 + + $(AndroidFrameworkVersion) + true false diff --git a/tests/CodeBehind/BuildTests/CodeBehindBuildTests.csproj b/tests/CodeBehind/BuildTests/CodeBehindBuildTests.csproj index b45956d5f..37ec2f759 100644 --- a/tests/CodeBehind/BuildTests/CodeBehindBuildTests.csproj +++ b/tests/CodeBehind/BuildTests/CodeBehindBuildTests.csproj @@ -8,17 +8,23 @@ Library Xamarin.Android.Tests.CodeBehindBuildTests CodeBehindBuildTests - v8.1 True Resources\Resource.designer.cs Resource Properties\AndroidManifest.xml Resources Assets - true True portable <_ApkDebugKeyStore>debug.keystore + false + + + + $(AndroidFrameworkVersion) true diff --git a/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.csproj b/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.csproj index 580c08556..34e7a43b7 100644 --- a/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.csproj +++ b/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.csproj @@ -8,16 +8,21 @@ Library CommonSampleLibrary Assets - true Resources Resources\Resource.designer.cs Resource CommonSampleLibrary - v8.1 8.0.30703 2.0 portable + + + $(AndroidFrameworkVersion) + true false diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj index a253079d8..5d0e2cf99 100644 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj +++ b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj @@ -17,12 +17,13 @@ Xamarin.Android.JcwGen-Tests Properties\AndroidManifest.xml armeabi-v7a;x86 - v9.0 false - true preview + + $(AndroidFrameworkVersion) + true false diff --git a/tests/EmbeddedDSOs/EmbeddedDSO/EmbeddedDSO.csproj b/tests/EmbeddedDSOs/EmbeddedDSO/EmbeddedDSO.csproj index a30e5a821..9a9b29e84 100644 --- a/tests/EmbeddedDSOs/EmbeddedDSO/EmbeddedDSO.csproj +++ b/tests/EmbeddedDSOs/EmbeddedDSO/EmbeddedDSO.csproj @@ -8,15 +8,14 @@ Library EmbeddedDSO Xamarin.Android.EmbeddedDSO_Test - v8.1 True Resources\Resource.designer.cs Resource Properties\AndroidManifest.xml Resources Assets - true false + false @@ -28,6 +27,9 @@ + + $(AndroidFrameworkVersion) +