Skip to content

Commit 1d5f3dd

Browse files
Y-Shcheholskyydnestoro
authored andcommitted
Revert changes
1 parent 2ab0a0f commit 1d5f3dd

File tree

2 files changed

+118
-105
lines changed

2 files changed

+118
-105
lines changed

docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,7 @@ A JDK version between 17 and 21 is required to execute Gradle (see the https://d
3333
id("org.graalvm.buildtools.native") version "{gradle-plugin-version}"
3434
----
3535

36-
Replace `{maven-plugin-version}` with the latest released version.
37-
All plugin versions are listed https://github.com/graalvm/native-build-tools/releases[here].
38-
39-
40-
- Provide the application main class in _build.gradle_ / _build.gradle.kts_ as shown below.
41-
Adjust the path according to your application sources.
42-
43-
[source,groovy,subs="verbatim,attributes", role="multi-language-sample"]
44-
----
45-
application {
46-
mainClass.set('org.example.Main')
47-
}
48-
----
36+
All plugin versions are listed https://github.com/graalvm/native-build-tools/releases[here]
4937

5038
[[run-your-project]]
5139
=== Build and Run Your Application
@@ -72,23 +60,23 @@ Continue reading below to learn more about the plugin.
7260
[[advanced-use-cases]]
7361
== Advanced Use Cases: How to
7462

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.
7664

7765
[[configure-image-build]]
7866
=== Configure Native Image Build
7967

8068
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.
8371

8472
The plugin also provides special properties to configure the build:
8573

8674
- `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).
8876
- `jvmArgs` - Passes the given argument directly to the JVM running the `native-image` tool
8977
- `quickBuild` - Enables quick build mode
9078
- `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>>.
9280

9381
Here is an example of additional options usage:
9482

@@ -99,12 +87,14 @@ graalvmNative {
9987
// common options
10088
verbose = true
10189
}
90+
10291
binaries.main {
10392
// options to configure the main binary
104-
imageName = 'application'
93+
imageName = 'myApp'
10594
mainClass = 'org.example.Main'
10695
buildArgs.add('-O3') // enables additional compiler optimizations
10796
}
97+
10898
binaries.test {
10999
// options to configure the test binary
110100
quickBuild = true
@@ -120,6 +110,7 @@ graalvmNative {
120110
// common options
121111
verbose.set(true)
122112
}
113+
123114
binaries.main {
124115
// options to configure the main binary
125116
imageName.set('application')
@@ -208,13 +199,14 @@ By default, the _default.iprof_ file, if not specified otherwise, is generated a
208199

209200
Step 3. **Build an optimized native image with profiles**.
210201
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:
212203

213204
[source,bash, role="multi-language-sample"]
214205
----
215206
./gradlew nativeCompile
216207
----
217208

209+
If everything was done properly, you will see _"PGO: user-provided"_ in the native image build output.
218210
Once the optimized image is built, run it:
219211

220212
[source,bash, role="multi-language-sample"]
@@ -334,6 +326,13 @@ graalvmNative {
334326
----
335327

336328
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+
337336
By default, the agent creates the metadata in the _build/native/agent-output_ directory.
338337

339338
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/
445444

446445
=== Learn more
447446

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

Comments
 (0)