Skip to content

Commit

Permalink
Add Maven Profile for initial generation of GraalVM Reachability Meta…
Browse files Browse the repository at this point in the history
…data JSON
  • Loading branch information
linghengqian committed Dec 6, 2024
1 parent 99709ac commit 2e960f8
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ sdk use java 22.0.2-graalce
./mvnw -T 1.5C clean test
```

### How to initially generate the JSON for GraalVM Reachability Metadata

- Execute the following command.

```shell
git clone [email protected]:linghengqian/hive-server2-jdbc-driver.git -b add-agent
cd ./hive-server2-jdbc-driver/
sdk use java 22.0.2-graalce
./mvnw -PgenerateMetadata -DskipNativeTests clean test native:metadata-copy
```

### How to nativeTest under GraalVM Native Image

- Execute the following command.
Expand Down
9 changes: 9 additions & 0 deletions native-image-filter/extra-filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"rules": [
{"includeClasses": "**"},

{"excludeClasses": "io.github.linghengqian.hive.server2.jdbc.driver.**"}
],
"regexRules": [
]
}
8 changes: 8 additions & 0 deletions native-image-filter/user-code-filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rules": [
{"excludeClasses": "**"},
{"includeClasses": "org.apache.hive.**"}
],
"regexRules": [
]
}
51 changes: 51 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,57 @@
</plugins>
</build>
</profile>
<profile>
<id>generateMetadata</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<agent>
<enabled>true</enabled>
<defaultMode>Conditional</defaultMode>
<modes>
<conditional>
<userCodeFilterPath>${user.dir}/native-image-filter/user-code-filter.json</userCodeFilterPath>
<extraFilterPath>${user.dir/native-image-filter/extra-filter.json</extraFilterPath>
<parallel>true</parallel>
</conditional>
</modes>
<metadataCopy>
<disabledStages>
<stage>main</stage>
</disabledStages>
<merge>false</merge>
<outputDirectory>${user.dir}/generated-reachability-metadata/</outputDirectory>
</metadataCopy>
</agent>
</configuration>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>nativeTestInCustom</id>
<build>
Expand Down

0 comments on commit 2e960f8

Please sign in to comment.