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 #275

Closed
wants to merge 5 commits into from
Closed
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
@@ -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 -Pjdk_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image clean verify
- name: 'Get cached JTReg'
uses: actions/cache@v4
@@ -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 -Pjdk_home=${{ matrix.DEPS_ROOT }}/jdk-toolchain -Pllvm_home=${{ matrix.DEPS_ROOT }}/llvm/image -Pjtreg_home=./deps/jtreg/build/images/jtreg jtreg
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ Alternatively, to build jextract from the latest sources (which include all the

### Building

`jextract` depends on the [C libclang API](https://clang.llvm.org/doxygen/group__CINDEX.html). To build the jextract sources, the easiest option is to download LLVM binaries for your platform, which can be found [here](https://releases.llvm.org/download.html) (version 13.0.0 is recommended). Both the `jextract` tool and the bindings it generates depend heavily on the [Foreign Function & Memory API](https://openjdk.java.net/jeps/454), so a suitable [jdk 22 distribution](https://jdk.java.net/22/) is also required.
`jextract` depends on the [C libclang API](https://clang.llvm.org/doxygen/group__CINDEX.html). To build the jextract sources, the easiest option is to download LLVM binaries for your platform, which can be found [here](https://releases.llvm.org/download.html) (version 13.0.0 is recommended). Both the `jextract` tool and the bindings it generates depend heavily on the [Foreign Function & Memory API](https://openjdk.java.net/jeps/454). A suitable [JDK 23 or higher distribution](https://jdk.java.net/23/) is also required.

> <details><summary><strong>Building older jextract versions</strong></summary>
>
@@ -33,7 +33,7 @@ We currently use gradle version 7.3.3 which is fetched automatically by the grad


```sh
$ sh ./gradlew -Pjdk22_home=<jdk22_home_dir> -Pllvm_home=<libclang_dir> clean verify
$ sh ./gradlew -Pjdk_home=<jdk_home_dir> -Pllvm_home=<libclang_dir> clean verify
```


@@ -63,7 +63,7 @@ Expected a header file
The repository also contains a comprehensive set of tests, written using the [jtreg](https://openjdk.java.net/jtreg/) test framework, which can be run as follows (again, on Windows, `gradlew.bat` should be used instead):

```sh
$ sh ./gradlew -Pjdk22_home=<jdk22_home_dir> -Pllvm_home=<libclang_dir> -Pjtreg_home=<jtreg_home> jtreg
$ sh ./gradlew -Pjdk_home=<jdk_home_dir> -Pllvm_home=<libclang_dir> -Pjtreg_home=<jtreg_home> jtreg
```

Note: running `jtreg` task requires `cmake` to be available on the `PATH`.
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ def static checkPath(String p) {
}

def llvm_home = project.property("llvm_home")
def jdk_home = project.property("jdk_home")
checkPath(llvm_home)
checkPath("${llvm_home}/lib/clang")
def clang_versions = new File("${llvm_home}/lib/clang/").list();
@@ -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"
@@ -59,9 +60,9 @@ repositories {
}

compileJava {
options.release = 22
options.release = 23
Copy link
Member

Choose a reason for hiding this comment

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

Same as above: with this set, users now must use JDK 23 or higher.

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

jar {
@@ -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",
@@ -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",
@@ -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",
]
1 change: 1 addition & 0 deletions samples/python3/compilesource.sh
Original file line number Diff line number Diff line change
@@ -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 \