Skip to content

JetBrains OpenJDK 11 #4567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
88207fd
JetBrains OpenJDK 11
grendello Apr 15, 2020
57530e0
Bump dependencies!
jonpryor Apr 16, 2020
3e6af18
OpenJDK11 support!
jonpryor Apr 16, 2020
e6d7542
[r8, manifestmerger] Target JDK 1.8
jonpryor Apr 20, 2020
6601fbc
[java-runtime] Use r8.jar instead of dx
jonpryor Apr 20, 2020
b78eed0
[manfestmerger] r8 must be built first
jonpryor Apr 20, 2020
3828571
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 4, 2020
a17f1c6
Fix build break when compiling xaprepare
jonpryor May 4, 2020
ebf3559
[java-runtime] Add ProjectReference for r8.csproj
jonpryor May 4, 2020
01be151
[java-runtimes] Fixity Fix
jonpryor May 4, 2020
ec9eca0
[scripts] Use r8.jar instead of dx
jonpryor May 5, 2020
bc7da93
Oops, forgot this s/dx/r8.jar/ replacement
jonpryor May 5, 2020
9b02c35
Let's try this again.
jonpryor May 5, 2020
0fca1ef
Trailing \ is bad
jonpryor May 5, 2020
f1af33e
[build] set $JAVA_HOME for mac test phases
jonathanpeppers May 6, 2020
181e4f5
Merge branch 'master' of https://github.com/xamarin/xamarin-android i…
jonathanpeppers May 6, 2020
1b6acb6
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 7, 2020
c2a95e2
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 8, 2020
85093ff
Use commandlinetools' avdmanager
jonpryor May 8, 2020
79a417a
Bump to xamarin/monodroid/jonp-try-xa-xat-ref@beb7c8fc
jonpryor May 9, 2020
1773d1b
Set JavacSourceVersion, JavacTargetVersion
jonpryor May 10, 2020
4eb11e8
[build] move Microsoft OpenJDK on Windows
jonathanpeppers May 11, 2020
527ac29
Remove `sdkmanager emulator` invocation
jonpryor May 13, 2020
6bf1bef
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 13, 2020
cea6614
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 14, 2020
d47bd6b
Fix <CreateMultiDexMainDexClassList/>?
jonpryor May 15, 2020
01901fe
Set `$(LatestSupportedJavaVersion)`=11.0.4
jonpryor May 15, 2020
6a7dfa3
Fix `make all-tests`
jonpryor May 15, 2020
70695d9
Fix Xamarin.Android.Build.Tests.BuildTest.GetDependencyWhenSDKIsMissi…
jonpryor May 15, 2020
fa8ac9e
Use cmdline-tools lint
jonpryor May 15, 2020
ed3e037
Add .idsig files to @(FileWrites)
jonathanpeppers May 15, 2020
5d62091
[tests] set /p:JavaSdkDirectory for MSBuild tests
jonathanpeppers May 15, 2020
4671de1
Revert "[build] move Microsoft OpenJDK on Windows"
jonathanpeppers May 15, 2020
f4960e8
Set %JAVA_HOME% for Windows Build and Test
jonathanpeppers May 18, 2020
841a05e
[test] accept SHA-256 for KeyToolTests
jonathanpeppers May 18, 2020
c0351dc
Merge branch 'master' of https://github.com/xamarin/xamarin-android i…
jonathanpeppers May 19, 2020
101139c
[build] fix %JAVA_HOME% on Windows
jonathanpeppers May 19, 2020
026bcf7
Use $(AndroidFrameworkVersion) instead of $(AndroidUseLatestPlatformSdk)
jonathanpeppers May 19, 2020
e120f20
[REVERT ME] print out %JAVA_HOME% throughout the build
jonathanpeppers May 19, 2020
90286ca
[tests] fix incorrect paths to Configuration.props
jonathanpeppers May 20, 2020
167d7ee
[REVERT ME] print out more %JAVA_HOME%
jonathanpeppers May 20, 2020
b2edbc9
[REVERT ME] one more %JAVA_HOME%
jonathanpeppers May 20, 2020
323a268
[Xamarin.Android.Build.Tasks]
jonpryor May 21, 2020
cf29684
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor May 21, 2020
3588f6c
Revert "[REVERT ME] print out %JAVA_HOME%"
jonathanpeppers May 21, 2020
8f0d900
[tests] retrieve JavaSdkDirectory from Configuration.props
jonathanpeppers May 21, 2020
2e22e76
[Xamarin.Android.Build.Tasks] Disable Javadoc use on JDK11
jonpryor May 21, 2020
4a32036
[tests] DotNetCLI should set JavaSdkDirectory
jonathanpeppers May 21, 2020
fe50c6e
[tests] CommonSampleLibrary is not an XA project
jonathanpeppers May 21, 2020
112980f
Revert "[tests] CommonSampleLibrary is not an XA project"
jonathanpeppers May 27, 2020
47ee214
Merge remote-tracking branch 'upstream/master' into jetbrains-openjdk
jonathanpeppers Jun 1, 2020
dd0c885
[tests] CodeBehindTests explicitly set $(TFV)
jonathanpeppers Jun 1, 2020
3258733
[tests] windows appears to need $(AppendTargetFrameworkToIntermediate…
jonathanpeppers Jun 1, 2020
4aa1a84
Merge remote-tracking branch 'upstream/master' into jetbrains-openjdk
jonathanpeppers Jun 2, 2020
90414d3
Revert "Bump to Android SDK Build-tools 29.0.2 (#4749)"
jonathanpeppers Jun 2, 2020
e5467ed
Bump to xamarin/xamarin-android-tools/master@967c278b (#4754)
jonpryor Jun 2, 2020
ef023a2
[XA.Build.Tasks] ServiceAttribute.ForegroundServiceType is [Flags] (#…
jpobst Jun 3, 2020
a121597
[Xamarin.Android.Build.Tasks] Fix use of non-int minSdkVersion
jonpryor Jun 3, 2020
a2b827e
<ValidateJavaVersion/> should be able to parse -rc4 in build-tools ve…
jonathanpeppers Jun 3, 2020
e73bc3a
[Xamarin.Android.Build.Tasks] Support cmdline-tools
jonpryor Jun 3, 2020
5dd172e
[Xamarin.Android.Build.Tasks] Build-tools r30 requires JDK11
jonpryor Jun 3, 2020
755a452
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor Jun 4, 2020
d1a7224
Try setting JI_JAVA_HOME.
jonpryor Jun 4, 2020
ebfd349
Don't setup test env for macOS Designer tests?
jonpryor Jun 4, 2020
56f1983
[ci] Export JI_JAVA_HOME on test environments
jonpryor Jun 4, 2020
9a5f3d0
[ci] Run `setup-test-environment.yaml` on macOS+Designer
jonpryor Jun 4, 2020
b874aeb
[CI] Allow overriding of xa source dir for test env setup
pjcollins Jun 4, 2020
6e53dd4
Fix setup-test-environment whitespace
pjcollins Jun 4, 2020
e6b8346
Bump to xamarin/xamarin-android-tools/jonp-windows-jvm-paths
jonpryor Jun 4, 2020
fbca417
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor Jun 4, 2020
9b25904
JI_JAVA_HOME sanitization
jonpryor Jun 4, 2020
44feed1
[ci] Add missing xaSourceDir param to setup-test-environment.yaml
pjcollins Jun 4, 2020
2d07941
Fix merge from fbca4170e4665445070cab62deeb1b37a5364b5a
jonpryor Jun 4, 2020
668eadb
[ci] fix macOS test provisioning location
jonpryor Jun 4, 2020
9b9618c
Export JI_JAVA_HOME when running `make prepare` for Java.Interop
jonpryor Jun 4, 2020
908cf89
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor Jun 5, 2020
2f069fb
Update default JDK to OpenJDK11.
jonpryor Jun 6, 2020
6c0de39
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor Jun 6, 2020
b550783
Nuse `nuget restore -Verbosity detailed`
jonpryor Jun 6, 2020
9b11c79
Merge remote-tracking branch 'origin/master' into jetbrains-openjdk
jonpryor Jun 8, 2020
7debfbd
[ci] Fix Designer
jonpryor Jun 8, 2020
5841608
Add release notes
jonpryor Jun 8, 2020
56503a3
More macOS+Designer integration fixes.
jonpryor Jun 8, 2020
9167b81
Increase expected rebuild times.
jonpryor Jun 8, 2020
c898c9e
Fix Xamarin.Designer.Android binlog source location
jonpryor Jun 8, 2020
db4dbe5
Flushity Flush
jonpryor Jun 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Documentation/release-notes/4567.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
### Preliminary JDK 11 Support

Xamarin.Android can now use JDK 11 to build libraries and applications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question to try to answer briefly in this note is why users would be interested in this change. The answer to that might depend on whether Visual Studio will start installing the JetBrains Runtime OpenJDK 11 by default in the same release that contains this Xamarin.Android change.

Some possibilities:

  • If it's not yet known when Visual Studio will start installing OpenJDK 11 by default, then one idea is to include an HTML comment in this draft release note that says something like:

    <!-- This release note might change depending on when Visual Studio starts
    installing OpenJDK 11 by default for the Mobile development with .NET workload.
    -->
    
  • If it is already known that Visual Studio will not install OpenJDK 11 by default alongside the first Xamarin.Android release that contains this change, then if possible, it could be good to add a sentence about when users might want to go to the trouble of finding and installing JDK 11 themselves.

    I think the main known reason at this time is for compatibility with Android SDK Build-Tools 30-rc1 and higher, which leads to a question of when users would need to update to that version of Android SDK Build-Tools.

    If the majority of users won't care about using Android SDK Build-Tools 30-rc1 or higher yet, the note could mention that, maybe using wording similar to JetBrains OpenJDK 11 #4567 (comment), and add something like:

    Future versions of the Android SDK might require JDK 11 for more scenarios.
    Project authors can try switching to JDK 11 now to prepare early for those
    potential future requirements.
    

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual Studio will start installing the JetBrains Runtime OpenJDK 11 by default in the same release that contains this Xamarin.Android change.

Almost certainly not, not for d16-7 P3 anyway, and I really doubt the likelihood of d16-7 period. For starters, it's only needed if Build-tools r30 is used, and --at present! -- it's not required to target API-R/Android 11.

(Even if it were required, I rather doubt the number of people who will be using Android 11 in the preview this is released in.)

More importantly, the Android Designer doesn't currently work with JDK 11. We can't change the default, even if we wanted to.

Additionally, I don't know what the rest of the VS "ecosystem" looks like, and whether it can be updated to JDK 11.

Finally, let's take a gander at API-29, shall we? That didn't become the default $(TargetFrameworkVersion) until d16-6, ~9 months after a Xamarin.Android release containing a stable Android 10.0 binding.

I think there is no chance at all of migrating VS to JDK 11 "soon."*

*Definition of "soon" is deliberately undefined.''

If it's not yet known when Visual Studio will start installing OpenJDK 11 by default…

Will do, though I think it'll be "moot." One of the (random) ideas is that we'll delete the Documentation/release-notes contents when a release note has gone stable. My guess is that XA d16-7 will be stable long before VS adds JDK 11, at which point this release note will likely not exist.

If it is already known that Visual Studio will not install OpenJDK 11 by default

99.99% certain of this.

it could be good to add a sentence about when users might want to go to the trouble of finding and installing JDK 11 themselves.

I'm not sure I can write this, not quickly. The only reason I know of to want/need JDK11 support is for Android SDK Build-tools r30+, but why would anybody want to use that, especially considering that it's still a "release candidate"? I don't know why this would be desirable.

I like the blurb you provided.


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
5 changes: 3 additions & 2 deletions build-tools/automation/azure-pipelines-oss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
54 changes: 43 additions & 11 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
30 changes: 20 additions & 10 deletions build-tools/automation/yaml-templates/setup-test-environment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
configuration: $(XA.Build.Configuration)
provisionExtraArgs: -vv -f
xaSourcePath: $(System.DefaultWorkingDirectory)

steps:
- checkout: self
Expand All @@ -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)
Expand All @@ -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'))

Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static partial class Defaults
{
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async Task<bool> ExecuteOSSpecific (Context context)
"prepare",
"V=1",
$"CONFIGURATION={context.Configuration}",
$"JI_JAVA_HOME={context.OS.JavaHome}",
$"JAVA_HOME={context.OS.JavaHome}",
$"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
}
Expand Down
8 changes: 7 additions & 1 deletion samples/HelloWorld/HelloLibrary/HelloLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
<AssemblyName>HelloLibrary</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidApplication>false</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<DebugType>portable</DebugType>
</PropertyGroup>
<Import
Condition="Exists('..\..\..\Configuration.props')"
Project="..\..\..\Configuration.props"
/>
<PropertyGroup Condition="Exists('..\..\..\Configuration.props')">
<TargetFrameworkVersion>$(AndroidFrameworkVersion)</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
Expand Down
2 changes: 0 additions & 2 deletions samples/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<AndroidDexTool Condition=" '$(AndroidDexTool)' == '' ">d8</AndroidDexTool>
<DebugType>portable</DebugType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
<UsingTask TaskName="Xamarin.Android.Tasks.MDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.Unzip" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />

<PropertyGroup>
<_JavadocSupported Condition=" $(_JdkVersion.StartsWith ('1.8')) ">True</_JavadocSupported>
</PropertyGroup>

<Target Name="_ExtractJavaDocJars"
Condition=" '$(_JavadocSupported)' == 'True' "
Inputs="@(JavaDocJar)"
Outputs="@(JavaDocJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
<Unzip
Expand All @@ -30,6 +35,7 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
</Target>

<Target Name="_GenerateJavaDocFromSourceJars"
Condition=" '$(_JavadocSupported)' == 'True' "
Inputs="@(JavaSourceJar)"
Outputs="@(JavaSourceJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
<Unzip
Expand All @@ -51,9 +57,9 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
</Target>

<Target Name="BuildDocumentation"
Condition=" '@(JavaDocIndex)' != '' And '$(_JavadocSupported)' == 'True' "
Inputs="@(JavaDocIndex);@(IntermediateAssembly->'$(IntermediateOutputPath)%(filename).xml')"
Outputs="@(IntermediateAssembly->'$(OutputPath)%(filename).xml')"
Condition=" '@(JavaDocIndex)' != '' ">
Outputs="@(IntermediateAssembly->'$(OutputPath)%(filename).xml')">
<MDoc
References="@(ReferencePath);@(ReferenceDependencyPaths)"
TargetAssembly="@(IntermediateAssembly)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<UsingAndroidNETSdk>true</UsingAndroidNETSdk>
<AndroidCommandLineToolsVersion Condition=" '$(AndroidCommandLineToolsVersion)' == '' ">1.0</AndroidCommandLineToolsVersion>
<LatestSupportedJavaVersion Condition=" '$(LatestSupportedJavaVersion)' == '' ">1.8.0</LatestSupportedJavaVersion>
<LatestSupportedJavaVersion Condition=" '$(LatestSupportedJavaVersion)' == '' ">11.0.4</LatestSupportedJavaVersion>
<MinimumSupportedJavaVersion Condition=" '$(MinimumSupportedJavaVersion)' == '' ">1.8.0</MinimumSupportedJavaVersion>
<EnableDefaultOutputPaths Condition=" '$(EnableDefaultOutputPaths)' == '' And '$(OS)' != 'Windows_NT' ">false</EnableDefaultOutputPaths>
<EnableDefaultOutputPaths Condition=" '$(EnableDefaultOutputPaths)' == '' ">true</EnableDefaultOutputPaths>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ protected override bool ValidateJava (string javaExe, Regex versionRegex)
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)
Expand All @@ -58,10 +65,18 @@ Version GetJavaVersionForFramework ()

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);
Expand Down
Loading