Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce configurations for configuring the classpath #138

Merged
merged 1 commit into from
Sep 29, 2021
Merged

Conversation

melix
Copy link
Collaborator

@melix melix commented Sep 28, 2021

Previously to this commit, the classpath used by native image was
hardcoded to include the project artifact and its runtime classpath.
With this change, the plugin now introduces a couple of configurations:

  • nativeImageCompileOnly which can be used to declare dependencies
    (or artifacts) which are required at image build time, but not by the
    main application (JVM mode)
  • nativeImageClasspath, which extends from the same configurations
    as the runtimeClasspath configuration, but also from the new
    nativeImageCompileOnly configuration. This is the configuration which
    is now used to configure the plugin classpath.

This will allow other plugins to contribute more artifacts or dependencies
at image build time without having to tweak manually the image classpath,
which could before imply loosing some user configuration code.

This also makes it cleaner to contribute GraalVM native image features,
without leaking into the main application runtime classpath.

Eventually, the same mirror configurations are defines for the test
image building.

Closes #129

@melix melix added enhancement New feature or request gradle-plugin Related to Gradle plugin labels Sep 28, 2021
@melix melix added this to the 0.9.6 milestone Sep 28, 2021
@melix melix self-assigned this Sep 28, 2021
@melix melix force-pushed the cc/issue-129 branch 4 times, most recently from a27d244 to 759306a Compare September 29, 2021 08:58
Previously to this commit, the classpath used by native image was
hardcoded to include the project artifact and its runtime classpath.
With this change, the plugin now introduces a couple of configurations:

- `nativeImageCompileOnly` which _can_ be used to declare dependencies
(or artifacts) which are required at image build time, but not by the
main application (JVM mode)
- `nativeImageClasspath`, which extends from the same configurations
as the `runtimeClasspath` configuration, but also from the new
`nativeImageCompileOnly` configuration. This is the configuration which
is now used to configure the plugin classpath.

This will allow other plugins to contribute more artifacts or dependencies
at image build time without having to tweak manually the image classpath,
which could before imply loosing some user configuration code.

This also makes it cleaner to contribute GraalVM native image features,
without leaking into the main application runtime classpath.

Eventually, the same mirror configurations are defines for the test
image building.

Closes #129
@melix melix merged commit 3c0a9b7 into master Sep 29, 2021
@melix melix deleted the cc/issue-129 branch September 29, 2021 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gradle-plugin Related to Gradle plugin oracle-emp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring additional entries for native image classpath
2 participants