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

Fixes #542, add some docs on the substrate build items #578

Merged
merged 1 commit into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import org.jboss.builder.item.MultiBuildItem;

/**
* Used to register a class for reflection in substrate
*/
public final class ReflectiveClassBuildItem extends MultiBuildItem {

private final List<String> className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

import org.jboss.builder.item.MultiBuildItem;

/**
* A class that will be reinitialized at runtime by Substrate. This will result in the static
* initializer running twice.
*/
public final class RuntimeReinitializedClassBuildItem extends MultiBuildItem {

private final String className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import org.jboss.builder.item.MultiBuildItem;

/**
* A build item that indicates that a static resource should be included in the native image
*/
public final class SubstrateResourceBuildItem extends MultiBuildItem {

private final List<String> resources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

import org.jboss.builder.item.MultiBuildItem;

/**
* Indicates that a resource bundle should be included in the native image
*/
public final class SubstrateResourceBundleBuildItem extends MultiBuildItem {

private final String bundleName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

import org.jboss.builder.item.MultiBuildItem;

/**
* A system property that will be set at native image build time
*/
public final class SubstrateSystemPropertyBuildItem extends MultiBuildItem {

private final String key;
Expand Down
28 changes: 28 additions & 0 deletions docs/src/main/asciidoc/extension-authors-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,31 @@ public class PersistenceAndShamrockConfigTest {
----

<1> This tells JUnit that the Protean deployment should fail with a specific exception


== Native Image Support

There Shamrock provides a lot of build items that control aspects of the native image build. This allows for extensions
to programmatically perform tests such as registering classes for reflection or adding static resources to the native
image. Some of these build items are listed below:

`org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBuildItem`::
Includes static resources into the native image.

`org.jboss.shamrock.deployment.builditem.substrate.RuntimeReinitializedClassBuildItem`::
A class that will be reinitialized at runtime by Substrate. This will result in the static initializer running twice.

`org.jboss.shamrock.deployment.builditem.substrate.SubstrateSystemPropertyBuildItem`::
A system property that will be set at native image build time.

`org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBundleBuildItem`::
Includes a resource bundle in the native image.

`org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem`::
Registers a class for reflection in Substrate. Constructors are always registered, while methods and fields are optional.

`org.jboss.shamrock.deployment.builditem.substrate.RuntimeInitializedClassBuildItem`::
A class that will be initialized at runtime rather than build time. This will cause the build to fail if the class is initialized as part of the native image build process, so care must be taken.

`org.jboss.shamrock.deployment.builditem.substrate.SubstrateConfigBuildItem`::
A convenience feature that allows you to control most of the above features from a single build item.