Skip to content

Commit b4da328

Browse files
committed
7903720: Change layout of jextract image
Reviewed-by: mcimadamore
1 parent 7fbd5c4 commit b4da328

File tree

5 files changed

+30
-14
lines changed

5 files changed

+30
-14
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,13 @@ jobs:
4646
needs: [build-jtreg]
4747
strategy:
4848
matrix:
49-
os: [macos-latest, ubuntu-20.04, windows-latest]
49+
os: [ubuntu-20.04, windows-latest]
5050
include:
5151
- os: ubuntu-20.04
5252
TARGET: clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04
5353
ARCHIVE_EXT: "tar.xz"
5454
LIB_DIR: lib
5555
DEPS_ROOT: /tmp/deps
56-
- os: macos-latest
57-
TARGET: clang+llvm-13.0.0-x86_64-apple-darwin
58-
ARCHIVE_EXT: "tar.xz"
59-
LIB_DIR: lib
60-
DEPS_ROOT: /tmp/deps
6156
- os: windows-latest
6257
TARGET: LLVM-13.0.0-win64
6358
ARCHIVE_EXT: "exe"
@@ -69,7 +64,7 @@ jobs:
6964
uses: actions/[email protected]
7065
with:
7166
fetch-depth: 1
72-
67+
7368
- name: 'Prepare'
7469
shell: sh
7570
run: |
@@ -90,7 +85,7 @@ jobs:
9085
website: jdk.java.net
9186
release: ${{ env.TOOLCHAIN_VERSION }}
9287
install: false
93-
88+
9489
- name: 'Extract Toolchain JDK (Non Windows)'
9590
if: ${{ matrix.os != 'windows-latest' && steps.get-cached-toolchain.outputs.cache-hit != 'true' }}
9691
shell: sh

build.gradle

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.apache.tools.ant.taskdefs.condition.Os
22
import java.nio.file.Files;
33
import java.nio.file.Path;
4+
import java.nio.file.attribute.PosixFilePermission;
45

56
plugins {
67
id "java"
@@ -123,12 +124,26 @@ task createJextractImage(type: Exec) {
123124
args = [
124125
"--module-path=$jmods_dir",
125126
"--add-modules=org.openjdk.jextract",
126-
"--output=${jextract_app_dir}",
127-
"--launcher=jextract=org.openjdk.jextract/org.openjdk.jextract.JextractTool",
127+
"--output=${jextract_app_dir}/runtime",
128128
"--strip-debug", "--no-man-pages", "--no-header-files",
129129
"--add-options",
130130
"${quote_jlink_opts}"
131131
]
132+
133+
doLast {
134+
// Add launcher scripts
135+
Path unixOut = Path.of("${jextract_app_dir}/jextract");
136+
Files.copy(Path.of("$projectDir/src/main/jextract"), unixOut);
137+
if (unixOut.getFileSystem().supportedFileAttributeViews().contains("posix")) {
138+
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(unixOut);
139+
perms.add(PosixFilePermission.OWNER_EXECUTE);
140+
perms.add(PosixFilePermission.GROUP_EXECUTE);
141+
perms.add(PosixFilePermission.OTHERS_EXECUTE);
142+
Files.setPosixFilePermissions(unixOut, perms);
143+
}
144+
145+
Files.copy(Path.of("$projectDir/src/main/jextract.bat"), Path.of("${jextract_app_dir}/jextract.bat"))
146+
}
132147
}
133148

134149
// build the jextract image when the build or assemble task is run
@@ -138,7 +153,7 @@ assemble.dependsOn(createJextractImage)
138153
task verify(type: Exec) {
139154
dependsOn createJextractImage
140155

141-
executable = "${jextract_app_dir}/bin/jextract${os_script_extension}"
156+
executable = "${jextract_app_dir}/jextract${os_script_extension}"
142157
args = [ "test.h", "--output", "$buildDir/integration_test" ]
143158
}
144159

make/Build.gmk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ $(BUILD_MODULES_DIR): $(BUILD_CLASSES_DIR)
8080
$(JEXTRACT_IMAGE_DIR): $(BUILD_MODULES_DIR)
8181
# jlink the modules to create a custom runtime image for jextract
8282
$(FIXPATH) $(PANAMA_JAVA_HOME)/bin/jlink \
83-
--output "$(JEXTRACT_IMAGE_DIR)" \
83+
--output "$(JEXTRACT_IMAGE_DIR)/runtime" \
8484
--module-path "$(BUILD_MODULES_DIR)" \
8585
--add-modules org.openjdk.jextract \
86-
--add-options "\"--enable-native-access=org.openjdk.jextract\" \"--enable-preview\"" \
87-
--launcher jextract=org.openjdk.jextract/org.openjdk.jextract.JextractTool
86+
--add-options "\"--enable-native-access=org.openjdk.jextract\" \"--enable-preview\""
87+
$(CP) src/main/jextract "$(JEXTRACT_IMAGE_DIR)"
88+
$(CP) src/main/jextract.bat "$(JEXTRACT_IMAGE_DIR)"
8889

8990
$(JEXTRACT_IMAGE_TEST_JDK_DIR): $(JEXTRACT_IMAGE_DIR)
9091
# jlink the modules to create a custom runtime image for jextract testing

src/main/jextract

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
DIR=`dirname $0`
3+
$DIR/runtime/bin/java $JEXTRACT_JAVA_OPTIONS -m org.openjdk.jextract/org.openjdk.jextract.JextractTool "$@"

src/main/jextract.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@set DIR=%~dp0
2+
@"%DIR%\runtime\bin\java" %JEXTRACT_JAVA_OPTIONS% -m org.openjdk.jextract/org.openjdk.jextract.JextractTool %*

0 commit comments

Comments
 (0)