Skip to content
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

[build] Add support for JDK 17 #1141

Merged
merged 1 commit into from
Sep 1, 2023
Merged

[build] Add support for JDK 17 #1141

merged 1 commit into from
Sep 1, 2023

Conversation

jonpryor
Copy link
Member

Update <JdkInfo/> task to emit new $(Java*MajorVersion) and $(JavaApi*DefineConstants) MSBuild properties. These are used by src/Java.Base so that it knows which JDK version it's binding.

Update src/Java.Base to support binding the java.base.jmod from JDK 17.

Note: This "JDK-17 Java.Base binding" was a "time limited" effort.

To build against JDK-17:

  1. Install JDK-17.

  2. Prepare and override $(JdksRoot):

    dotnet build -t:Prepare Java.Interop.sln -p:JdksRoot=/Library/Java/JavaVirtualMachines/microsoft-17.jdk/Contents/Home
    

    will use the Microsoft OpenJDK 17 installation on macOS.

  3. Build:

    dotnet build Java.Interop.sln
    

Update `<JdkInfo/>` task to emit new `$(Java*MajorVersion)`
and `$(JavaApi*DefineConstants)` MSBuild properties.  These are used
by `src/Java.Base` so that it knows which JDK version it's binding.

Update `src/Java.Base` to support binding the `java.base.jmod` from
JDK 17.

Note: This "JDK-17 Java.Base binding" was a "time limited" effort.

To build against JDK-17:

 1. Install JDK-17.

 2. Prepare and override `$(JdksRoot)`:

        dotnet build -t:Prepare Java.Interop.sln -p:JdksRoot=/Library/Java/JavaVirtualMachines/microsoft-17.jdk/Contents/Home

    will use the Microsoft OpenJDK 17 installation on macOS.

 3. Build:

        dotnet build Java.Interop.sln
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 29, 2023
Context: dotnet#8304
Context: dotnet#8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Context: dotnet/java-interop#1141

> Does It Build™?

Because of dotnet#8029 we know we *can* use JDK 17.

Because of dotnet#8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 31, 2023
Context: dotnet#8304
Context: dotnet#8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Context: dotnet/java-interop#1141

> Does It Build™?

Because of dotnet#8029 we know we *can* use JDK 17.

Because of dotnet#8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
@jonpryor jonpryor merged commit 5bb0d24 into main Sep 1, 2023
4 checks passed
@jonpryor jonpryor deleted the jonp-jdk-17-support branch September 1, 2023 17:49
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Sep 1, 2023
Changes: dotnet/java-interop@5adb4d4...5bb0d24

  * dotnet/java-interop@5bb0d24b: [build] Add support for JDK 17 (dotnet/java-interop#1141)
  * dotnet/java-interop@7e3bd2f2: Revert "[build] Enable NuGet's Central Package Management (dotnet/java-interop#1114)" (dotnet/java-interop#1138)
  * dotnet/java-interop@7961b360: [build] set `$(DisableTransitiveFrameworkReferenceDownloads)`=true (dotnet/java-interop#1137)

Context: dotnet#8304
Context: dotnet#8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Because of dotnet#8029 we know we *can* use JDK 17.

Because of dotnet#8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
jonpryor added a commit to dotnet/android that referenced this pull request Sep 2, 2023
Changes: dotnet/java-interop@5adb4d4...5bb0d24

  * dotnet/java-interop@5bb0d24b: [build] Add support for JDK 17 (dotnet/java-interop#1141)
  * dotnet/java-interop@7e3bd2f2: Revert "[build] Enable NuGet's Central Package Management (dotnet/java-interop#1114)" (dotnet/java-interop#1138)
  * dotnet/java-interop@7961b360: [build] set `$(DisableTransitiveFrameworkReferenceDownloads)`=true (dotnet/java-interop#1137)

Context: #8304
Context: #8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Because of #8029 we know we *can* use JDK 17.

Because of #8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants