Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 97d2fcc

Browse files
committed
Update documentation for 0.8.0
1 parent 11286bd commit 97d2fcc

File tree

5 files changed

+26
-25
lines changed

5 files changed

+26
-25
lines changed

spring-graalvm-native-docs/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>org.springframework.experimental</groupId>
88
<artifactId>spring-graalvm-native-build</artifactId>
9-
<version>0.8.0-SNAPSHOT</version>
9+
<version>0.8.0</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

1313
<artifactId>spring-graalvm-native-docs</artifactId>
14-
<version>0.8.0-SNAPSHOT</version>
14+
<version>0.8.0</version>
1515
<packaging>pom</packaging>
1616

1717
<name>Spring GraalVM Native docs</name>

spring-graalvm-native-docs/src/main/asciidoc/agent.adoc

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[agent]]
2-
== Testing with the agent to compute configuration
2+
== Tracing agent
33

44
When using the agent to compute configuration for native-image, there are a couple of approaches:
55

@@ -12,13 +12,14 @@ anything required by the test infrastructure, which is unnecessary when the appl
1212
To address this problem the agent supports an access-filter file that will cause certain data to
1313
be excluded from the generated output.
1414

15+
=== Testing with the agent to compute configuration
1516

16-
=== A basic access-filter file
17+
==== A basic access-filter file
1718

1819
This is a simple `access-filter.json` file.
1920

2021
====
21-
[source,xml,subs="attributes,verbatim"]
22+
[source,json,subs="attributes,verbatim"]
2223
----
2324
{ "rules": [
2425
{"excludeClasses": "org.apache.maven.surefire.**"},
@@ -38,15 +39,15 @@ Most of these lines would apply to any Spring application, except for the last o
3839
specific and will need tweaking to match the package of a specific applications tests.
3940

4041

41-
=== Using the access-filter file
42+
==== Using the access-filter file
4243

4344
The access-filter.json file is specified with the `access-filter-file` option as part of the agentlib string:
4445

4546
`-Dorg.graalvm.nativeimage.imagecode=true -agentlib:native-image-agent=access-filter-file=access-filter.json,config-output-dir=target/classes/META-INF/native-image`
4647

4748
Note the inclusion of the `-D` to set the `org.graalvm.nativeimage.imagecode` property. In normal operation a built native executable will have this property set (automatically by the image building process). If there is any code that will behave differently due to it being set (which may occur if trying to work around something not supported by GraalVM) then we should set it when running with the agent too, so that code executed whilst the agent is attached matches the code that will run in the final executable.
4849

49-
=== Using it with maven
50+
==== Using it with maven
5051

5152
Let's look at how to pull the ideas here together and apply them to a project.
5253

@@ -110,18 +111,18 @@ Finally, this following snippet would go into the maven pom:
110111
<groupId>org.apache.maven.plugins</groupId>
111112
<artifactId>maven-surefire-plugin</artifactId>
112113
<configuration>
113-
<argLine>-Dorg.graalvm.nativeimage.imagecode=agent -Dspring.backgroundpreinitializer.ignore=true -Dspring.xml.ignore=true -Dspring.spel.ignore=true -agentlib:native-image-agent=access-filter-file=target/classes/access-filter.json,config-merge-dir=target/classes/META-INF/native-image</argLine>
114-
<includes>
115-
<include>**/AppContextStartupTest.java</include>
116-
</includes>
114+
<argLine>-Dorg.graalvm.nativeimage.imagecode=agent -Dspring.xml.ignore=true -Dspring.spel.ignore=true -agentlib:native-image-agent=access-filter-file=target/classes/access-filter.json,config-merge-dir=target/classes/META-INF/native-image</argLine>
115+
<includes>
116+
<include>**/AppContextStartupTest.java</include>
117+
</includes>
117118
</configuration>
118119
</plugin>
119120
<plugin>
120121
<groupId>org.graalvm.nativeimage</groupId>
121122
<artifactId>native-image-maven-plugin</artifactId>
122123
<version>{graalvm-version}</version>
123124
<configuration>
124-
<mainClass>com.example.demo.DemoApplication</mainClass>
125+
<mainClass>com.example.demo.DemoApplication</mainClass>
125126
<imageName>example-compiled-app</imageName>
126127
<buildArgs>-Dspring.native.remove-yaml-support=true -Dspring.spel.ignore=true</buildArgs>
127128
</configuration>

spring-graalvm-native-docs/src/main/asciidoc/index.adoc

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:icons: font
55
:hide-uri-scheme:
66
:project-home: https://github.com/spring-projects-experimental/spring-graalvm-native
7-
:version: 0.8.0-SNAPSHOT
7+
:version: 0.8.0
88
:repository: milestone
99
:boot-version: 2.4.0-M2
1010
:graalvm-version: 20.2.0
@@ -39,7 +39,7 @@ There are two primary ways to communicate this information to the build process:
3939
4040
It is worth mentioning that there are limitations on what GraalVM supports with respect to native images.
4141
If your application is doing any of these, it may not be possible to build a native image.
42-
The limitations are discussed https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md[here].
42+
The limitations are discussed https://github.com/oracle/graal/blob/master/substratevm/Limitations.md[here].
4343

4444
== Spring GraalVM Native
4545

@@ -75,7 +75,7 @@ include::getting-started-native-image.adoc[]
7575

7676
include::samples.adoc[]
7777

78-
include::support-scope.adoc[]
78+
include::support.adoc[]
7979

8080
include::options.adoc[]
8181

@@ -90,6 +90,5 @@ include::how-to-contribute.adoc[]
9090
Finally, before you post about it not working, please check the <<troubleshooting,troubleshooting guide>>, which is full of information on pitfalls, common problems, and how to deal with them (through fixes and workarounds).
9191

9292
We would love to hear about your successes and failures through the project issue tracker.
93-
Work has been started on an extension model that makes it easy to support areas of Spring the feature does not yet reach.
94-
If you want to make a contribution here, see the <<extension_guide,extension guide>>.
95-
Please be aware this is pre-1.0 and, as such, some of these options and extension APIs are still evolving and may change before it is finally considered done.
93+
If you want to make a contribution here, see the <<how-to-contribute,how to contribute guide>>.
94+
Please be aware this project is still incubating and, as such, some of these options and extension APIs are still evolving and may change before it is finally considered done.

spring-graalvm-native-docs/src/main/asciidoc/support-scope.adoc spring-graalvm-native-docs/src/main/asciidoc/support.adoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[[support-scope]]
2-
== Support scope
1+
[[support]]
2+
== Support
33

44
=== Language
55

@@ -41,4 +41,5 @@ Group ID is `org.springframework.cloud`.
4141

4242
=== Limitations
4343

44+
- `@Configuration` and related annotations like `@SpringBootApplication` should specify `proxyBeanMethods = false` in order to not require CGLIB proxies. In practice, the main limitation with attribute set is that bean dependencies should be specified as explicit method parameter rather that by `@Bean` method invocation. Notice this attribute https://github.com/spring-projects-experimental/spring-graalvm-native/issues/248[could be inferred in the future].
4445
- Only proxies on interfaces are supported for now

spring-graalvm-native-docs/src/main/asciidoc/troubleshooting.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you see an error like:
3030
----
3131
====
3232

33-
It could be due to https://github.com/oracle/graal/issues/2748[oracle/graal#2748] bug which impact GraalVM 20.2.0. This is a transient error so re-run
33+
It could be due to https://github.com/oracle/graal/issues/2748[oracle/graal#2748] bug which impact GraalVM 20.2.0. This is a transient error so run again
3434
the build. If a newer GraalVM 20.2.x is available, please update to use it.
3535

3636
==== DataSize was unintentionally initialized at build time
@@ -72,7 +72,7 @@ Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:
7272
----
7373
====
7474

75-
This is due to https://github.com/spring-projects/spring-boot/issues/23130[this bug] that will be fixed asap.
75+
This is due to https://github.com/spring-projects/spring-boot/issues/23130[this bug] that will be fixed in Spring Boot 2.4.0-M3.
7676
The workaround is to try to modify the content (change space to tabs, add or remove line breaks, etc.) to not hit that bug or
7777
to replace `<BP_BOOT_NATIVE_IMAGE_BUILD_ARGUMENTS>` element by a `META-INF/native-image/<GROUP_ID>/<ARTIFACT_ID>/native-image.properties`
7878
file with `Args = ...` content.
@@ -133,7 +133,7 @@ You have a number of options to address it:
133133
* Download a new version of GraalVM that includes a fixed agent.
134134

135135
* Raise a bug against the `spring-graalvm-native` project, as a key aim of the feature is to make sure these things get registered.
136-
If it is not "`obvious`" that it should be registered, it may be necessary for a new or expanded hint to the added to the `spring-graalvm-native-configuration` project (see the <<extension_guide,extension guide>> if you want to explore that).
136+
If it is not "`obvious`" that it should be registered, it may be necessary for a new or expanded hint to the added to the `spring-graalvm-native-configuration` project (see the <<how-to-contribute,how to contribute guide>> if you want to explore that).
137137

138138
* Manually add it.
139139
The `native-image` run picks up any configuration it finds.
@@ -211,7 +211,7 @@ Snapshots are regularly published and obviously ahead of releases and milestones
211211
Sometimes, you want to use the feature but cannot.
212212
Maybe you like that the feature offers that more optimal mode of discarding unnecessary configuration at image-build time, which the agent mode does not.
213213
When you use the feature, you either get an error about some missing piece of configuration or, worse, you get no error and it does not work (implying there is probably missing configuration that is not critical for the app to start but is just critical for it to actually work).
214-
If the error is clear, you can follow the guidelines in the <<extension_guide,extension guide>> and perhaps contribute it back.
214+
If the error is clear, you can follow the guidelines in the <<how-to-contribute,how to contribute guide>> and perhaps contribute it back.
215215
But in the case where you have no idea, what do you do?
216216

217217
The first step to take here is try and run it with the agent, as follows:
@@ -323,4 +323,4 @@ Now create `src/main/resources/META-INF/native-image/reflect-config.json` with c
323323
====
324324

325325
As we add the details found in the diff, we can rebuild the `native-image` each time and see which bits help.
326-
Once computed, we can create a hint in the feature configuration project that captures this knowledge (see the <<extension_guide,extension guide>> for more info on that) or, if it is more related to this specific application than the infrastructure, we might leave that `reflect-config.json` in the project and commit it to our repository alongside the source for future use.
326+
Once computed, we can create a hint in the feature configuration project that captures this knowledge (see the <<how-to-contribute,how to contribute guide>> for more info on that) or, if it is more related to this specific application than the infrastructure, we might leave that `reflect-config.json` in the project and commit it to our repository alongside the source for future use.

0 commit comments

Comments
 (0)