Skip to content

Commit 87a9efd

Browse files
committed
7903723: Jextract binary should live in a bin folder
Reviewed-by: jvernee
1 parent b4da328 commit 87a9efd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def jmods_dir = "$buildDir/jmods"
4343
def jextract_jmod_file = "$jmods_dir/org.openjdk.jextract.jmod"
4444
def jextract_jmod_inputs = "$buildDir/jmod_inputs"
4545
def jextract_app_dir = "$buildDir/jextract"
46+
def jextract_runtime_dir = "$jextract_app_dir/runtime"
47+
def jextract_bin_dir = "$jextract_app_dir/bin"
4648
def clang_include_dir = "${llvm_home}/lib/clang/${clang_version}/include"
4749
checkPath(clang_include_dir)
4850
def os_lib_dir = Os.isFamily(Os.FAMILY_WINDOWS)? "bin" : "lib"
@@ -118,21 +120,22 @@ task createJextractImage(type: Exec) {
118120

119121
doFirst {
120122
delete(jextract_app_dir)
123+
project.mkdir "${jextract_bin_dir}"
121124
}
122125

123126
executable = "${jdk22_home}/bin/jlink"
124127
args = [
125128
"--module-path=$jmods_dir",
126129
"--add-modules=org.openjdk.jextract",
127-
"--output=${jextract_app_dir}/runtime",
130+
"--output=${jextract_runtime_dir}",
128131
"--strip-debug", "--no-man-pages", "--no-header-files",
129132
"--add-options",
130133
"${quote_jlink_opts}"
131134
]
132135

133136
doLast {
134137
// Add launcher scripts
135-
Path unixOut = Path.of("${jextract_app_dir}/jextract");
138+
Path unixOut = Path.of("${jextract_bin_dir}/jextract");
136139
Files.copy(Path.of("$projectDir/src/main/jextract"), unixOut);
137140
if (unixOut.getFileSystem().supportedFileAttributeViews().contains("posix")) {
138141
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(unixOut);
@@ -142,7 +145,7 @@ task createJextractImage(type: Exec) {
142145
Files.setPosixFilePermissions(unixOut, perms);
143146
}
144147

145-
Files.copy(Path.of("$projectDir/src/main/jextract.bat"), Path.of("${jextract_app_dir}/jextract.bat"))
148+
Files.copy(Path.of("$projectDir/src/main/jextract.bat"), Path.of("${jextract_bin_dir}/jextract.bat"))
146149
}
147150
}
148151

@@ -153,7 +156,7 @@ assemble.dependsOn(createJextractImage)
153156
task verify(type: Exec) {
154157
dependsOn createJextractImage
155158

156-
executable = "${jextract_app_dir}/jextract${os_script_extension}"
159+
executable = "${jextract_bin_dir}/jextract${os_script_extension}"
157160
args = [ "test.h", "--output", "$buildDir/integration_test" ]
158161
}
159162

src/main/jextract

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

src/main/jextract.bat

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

0 commit comments

Comments
 (0)