Skip to content

Commit c31af20

Browse files
committed
chore: native build tool config changes for tracing agent
1 parent 49687bd commit c31af20

File tree

11 files changed

+24
-428
lines changed

11 files changed

+24
-428
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ $ sdk i java 20.0.2-graal
2626
# Build the native image
2727
$ ./gradlew nativeCompile
2828

29+
# Use trace agent for metadata generation
30+
$ ./gradlew -Pagent run
31+
$ ./gradlew metadataCopy
32+
2933
# Run native image tests
3034
$ ./gradlew nativeTest
35+
$ ./gradlew -Pagent nativeTest
3136

3237
# Native Image Quick Build
3338
$ ./gradlew nativeCompile -Pquick

gradle/build-logic/common-plugins/src/main/kotlin/common/ProjectExtns.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ val Project.javaToolchainPath
7070
val jLauncher =
7171
when (defToolchain != null) {
7272
true -> javaToolchainSvc?.launcherFor(defToolchain)
73-
else -> javaToolchainSvc?.launcherFor { languageVersion = toolchainVersion }
73+
else -> javaToolchainSvc?.launcherFor { configureJvmToolchain() }
7474
}?.orNull
7575

7676
return jLauncher?.metadata?.installationPath?.asFile?.toPath()

gradle/build-logic/common-plugins/src/main/kotlin/plugins/graalvm.gradle.kts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ graalvmNative {
4141
fallback = false
4242
verbose = debugEnabled
4343
quickBuild = quickBuildEnabled
44+
richOutput = true
4445
buildArgs = buildList {
4546
add("--enable-preview")
4647
add("--native-image-info")
@@ -50,9 +51,9 @@ graalvmNative {
5051
add("--features=dev.suresh.aot.RuntimeFeature")
5152
add("-R:MaxHeapSize=64m")
5253
add("-H:+ReportExceptionStackTraces")
53-
add("-H:+UnlockExperimentalVMOptions")
5454
add("-EBUILD_NUMBER=${project.version}")
5555
add("-ECOMMIT_HASH=${semverExtn.commits.get().first().hash}")
56+
// add("-H:+UnlockExperimentalVMOptions")
5657
// add("-H:+AddAllCharsets")
5758
// add("-H:+IncludeAllLocales")
5859
// add("-H:+IncludeAllTimeZones")
@@ -104,11 +105,23 @@ graalvmNative {
104105
// https://www.graalvm.org/dashboard/?ojr=help%3Btopic%3Dgetting-started.md
105106
}
106107

108+
// resources { autodetect() }
107109
jvmArgs = listOf("--add-modules=$addModules")
108110
systemProperties = mapOf("java.awt.headless" to "false")
109-
resources { autodetect() }
111+
javaLauncher = javaToolchains.launcherFor { configureJvmToolchain() }
110112
}
111113
}
114+
115+
agent {
116+
defaultMode = "standard"
117+
enabled = true
118+
metadataCopy {
119+
inputTaskNames.add("run") // Tasks previously executed with the agent attached (test).
120+
outputDirectories.add("src/main/resources/META-INF/native-image/playground")
121+
mergeWithExisting = true
122+
}
123+
}
124+
112125
metadataRepository { enabled = true }
113126
toolchainDetection = false
114127
}

gradle/build-logic/common-plugins/src/main/kotlin/plugins/kotlin.mpp.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ kotlinMultiplatform.apply {
6464
commonWebpackConfig(
6565
Action {
6666
// outputFileName = "app.js"
67-
cssSupport { enabled.set(true) }
67+
cssSupport { enabled = true }
6868
})
6969

7070
testTask(

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ benasher44-uuid = "0.7.1"
5959
intellij-markdown = "0.4.1"
6060

6161
# Plugin versions
62-
benmanes = "0.47.0"
62+
benmanes = "0.48.0"
6363
foojay-resolver = "0.7.0"
6464
gradle-enterprise = "3.14.1"
6565
nexus-publish = "2.0.0-rc-1"
@@ -69,7 +69,7 @@ semver-plugin = "0.5.0-rc.5"
6969
taskinfo = "2.1.0"
7070
dependency-analysis = "1.21.0"
7171
best-practices-plugin = "0.10"
72-
graalvm-nativeimage = "0.9.25"
72+
graalvm-nativeimage = "0.9.26"
7373
beryx-jlink = "2.24.4"
7474
beryx-runtime = "1.13.0"
7575
beryx-jar = "2.0.0"

src/main/resources/META-INF/native-image/playground/jni-config.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/main/resources/META-INF/native-image/playground/predefined-classes-config.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/resources/META-INF/native-image/playground/proxy-config.json

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)