You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All plugin versions are listed https://github.com/graalvm/native-build-tools/releases[here]
49
37
50
38
[[run-your-project]]
51
39
=== Build and Run Your Application
@@ -72,23 +60,23 @@ Continue reading below to learn more about the plugin.
72
60
[[advanced-use-cases]]
73
61
== Advanced Use Cases: How to
74
62
75
-
For advanced use cases, this guide provides instructions for configuring the build process, running tests on native code, gathering execution profiles, troubleshooting missing configurations, and enabling diagnostic tools to analyze native images.
63
+
For advanced use cases, this guide provides instructions for configuring the build process, running tests on native code, gathering execution profiles, troubleshooting missing configuration, and enabling diagnostic tools to analyze native images.
76
64
77
65
[[configure-image-build]]
78
66
=== Configure Native Image Build
79
67
80
68
The plugin supports passing options directly to Native Image inside the `graalvmNative` block in the _build.gradle_ / _build.gradle.kts_ file.
81
-
Using `buildArgs.add("<option>")`, you can pass any Native Image build option listed on https://www.graalvm.org/reference-manual/native-image/overview/Options/[this website page].
82
-
You can pass options to configure the `main` or the `test` native binary, or both at the same time.
69
+
Using `buildArgs.add("<option>")`, you can pass any Native Image build option listed on https://www.graalvm.org/reference-manual/native-image/overview/Options/[this page].
70
+
You can pass options to <<gradle-plugin.adoc#configure-native-image,configure the `main` or the `test` native binary>>, or both at the same time.
83
71
84
72
The plugin also provides special properties to configure the build:
85
73
86
74
- `mainClass` - Provides the main class to use, defaults to the `application.mainClass`
87
-
- `imageName` - Specifies of the name for the native executable file. If a custom name is not supplied, the artifact ID of the project will be used by default (defaults to the project name).
75
+
- `imageName` - Specifies the name for the native executable file. If a custom name is not supplied, the artifact ID of the project will be used by default (defaults to the project name).
88
76
- `jvmArgs` - Passes the given argument directly to the JVM running the `native-image` tool
89
77
- `quickBuild` - Enables quick build mode
90
78
- `verbose` - Enables the verbose output
91
-
- and many more https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html#_native_image_options[listed here].
79
+
- and many more <<gradle-plugin.adoc#native-image-options,listed here>>.
@@ -208,13 +199,14 @@ By default, the _default.iprof_ file, if not specified otherwise, is generated a
208
199
209
200
Step 3. **Build an optimized native image with profiles**.
210
201
This step involves copying the generated profile to the conventional directory, ensuring it is automatically used during the build process.
211
-
Place the _default.iprof_ file in the _src/pgo-profiles/_ directory, and then run:
202
+
Place the _default.iprof_ file in the _src/pgo-profiles/main_ directory, and then run:
212
203
213
204
[source,bash, role="multi-language-sample"]
214
205
----
215
206
./gradlew nativeCompile
216
207
----
217
208
209
+
If everything was done properly, you will see _"PGO: user-provided"_ in the native image build output.
218
210
Once the optimized image is built, run it:
219
211
220
212
[source,bash, role="multi-language-sample"]
@@ -334,6 +326,13 @@ graalvmNative {
334
326
----
335
327
336
328
From that point on, commands such as `run` or `test` will execute with the agent attached.
329
+
For example you can execute the following command and the agent will be attached automatically:
330
+
331
+
[source,bash, role="multi-language-sample"]
332
+
----
333
+
./gradlew run
334
+
----
335
+
337
336
By default, the agent creates the metadata in the _build/native/agent-output_ directory.
338
337
339
338
Step 2: **Copy the generated metadata** from the default location, _build/native/agent-output_, to the resources directory, for example, _resources/META-INF/native-image_.
@@ -445,4 +444,4 @@ All the monitoring and debugging tools https://www.graalvm.org/reference-manual/
445
444
446
445
=== Learn more
447
446
448
-
To continue learning, refer to the <<changelog.adoc#,extensive reference documentation for the GraalVM Native Image Gradle plugin>>.
447
+
To continue learning, refer to the <<changelog.adoc#,extensive reference documentation for the GraalVM Native Image Gradle plugin>>.
0 commit comments