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

7903928: update build.gradle to use JDK 23 #271

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
- name: 'Build Jextract'
shell: sh
run: |
sh ./gradlew -Pjdk22_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image clean verify
sh ./gradlew -Pjdk23_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image clean verify
- name: 'Get cached JTReg'
uses: actions/cache@v4
Expand All @@ -180,4 +180,4 @@ jobs:
- name: 'Run tests'
shell: sh
run: |
sh ./gradlew -Pjdk22_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image -Pjtreg_home=./deps/jtreg/build/images/jtreg jtreg
sh ./gradlew -Pjdk23_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image -Pjtreg_home=./deps/jtreg/build/images/jtreg jtreg
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def static checkPath(String p) {
}

def llvm_home = project.property("llvm_home")
def jdk_home = project.property("jdk23_home")
Copy link
Member

Choose a reason for hiding this comment

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

We should rename this property simply to jdk_home.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Especially now that we only have one "master" (tip) version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Gradle's jdk is set via JAVA_HOME. It is usual have gradle support for the latest JDK to come bit "late". If we call JDK needed for jextract to be "jdk_Home" and the one needed for gradle as "JAVA_HOME", we may be in a situation where jdk_home points latest JDK (say JDK 25) and JAVA_HOME points whatever then latest Gradle supports. Can we keep jextract use specific JDK version for its build/test as a separately distinctly named variable?

Copy link
Member

Choose a reason for hiding this comment

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

I think you can run gradle's Java compilation and the gradle tool with different JDKs; my previous strategy for running JMH through gradle was to define my local openjdk build as org.gradle.java.home project property, either set in gradle.properties or passed as -Porg.gradle.java.home=xx on command line. JAVA_HOME is used to launch the gradle tool, so it cannot be the local openjdk build, which uses a class file format too new for gradle to generate abstract method implementations.

checkPath(llvm_home)
checkPath("${llvm_home}/lib/clang")
def clang_versions = new File("${llvm_home}/lib/clang/").list();
Expand All @@ -39,7 +40,7 @@ if (clang_versions.length == 0) {
def clang_version = clang_versions[0]

def buildDir = layout.buildDirectory.get()
def jextract_version = "22"
def jextract_version = "23"
def jmods_dir = "$buildDir/jmods"
def jextract_jmod_file = "$jmods_dir/org.openjdk.jextract.jmod"
def jextract_jmod_inputs = "$buildDir/jmod_inputs"
Expand All @@ -59,9 +60,9 @@ repositories {
}

compileJava {
options.release = 22
options.release = 23
options.fork = true
options.forkOptions.executable = "${jdk22_home}/bin/javac${os_exe_suffix}"
options.forkOptions.executable = "${jdk_home}/bin/javac${os_exe_suffix}"
}

jar {
Expand Down Expand Up @@ -104,7 +105,7 @@ task createJextractJmod(type: Exec) {
delete(jextract_jmod_file)
}

executable = "${jdk22_home}/bin/jmod"
executable = "${jdk_home}/bin/jmod"
args = [
"create",
"--module-version=$jextract_version",
Expand All @@ -131,7 +132,7 @@ task createJextractImage(type: Exec) {
project.mkdir "${jextract_bin_dir}"
}

executable = "${jdk22_home}/bin/jlink"
executable = "${jdk_home}/bin/jlink"
args = [
"--module-path=$jmods_dir",
"--add-modules=org.openjdk.jextract",
Expand Down Expand Up @@ -183,9 +184,9 @@ task createRuntimeImageForTest(type: Exec) {
delete(out_dir)
}

executable = "${jdk22_home}/bin/jlink"
executable = "${jdk_home}/bin/jlink"
args = [
"--module-path=$jmods_dir" + File.pathSeparator + "$jdk22_home/jmods",
"--module-path=$jmods_dir" + File.pathSeparator + "$jdk_home/jmods",
"--add-modules=ALL-MODULE-PATH",
"--output=$out_dir",
]
Expand Down
1 change: 1 addition & 0 deletions samples/python3/compilesource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if [[ -z "${ANACONDA3_HOME}" ]]; then
fi

jextract --output src \
-D_Float16=short \
-l :${ANACONDA3_HOME}/lib/libpython3.11.dylib \
-I ${ANACONDA3_HOME}/include/python3.11 \
-t org.python \
Expand Down