-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4314 from atomfrede/2819-add-graal-vm-native-image
add graal vm native image support for jhipster lite
- Loading branch information
Showing
12 changed files
with
202 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/tech/jhipster/lite/module/infrastructure/primary/NativeHints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package tech.jhipster.lite.module.infrastructure.primary; | ||
|
||
import org.springframework.aot.hint.MemberCategory; | ||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.RuntimeHintsRegistrar; | ||
import tech.jhipster.lite.common.domain.Generated; | ||
import tech.jhipster.lite.module.domain.landscape.JHipsterLandscapeElementType; | ||
|
||
@Generated(reason = "Not testing native runtime hints") | ||
class NativeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
hints | ||
.reflection() | ||
.registerType(RestJHipsterModuleProperties.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscape.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscapeLevel.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscapeElement.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscapeModule.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscapeFeature.class, MemberCategory.values()) | ||
.registerType(RestJHipsterLandscapeDependency.class, MemberCategory.values()) | ||
.registerType(RestJHipsterModulePropertiesDefinition.class, MemberCategory.values()) | ||
.registerType(JHipsterLandscapeElementType.class, MemberCategory.values()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/tech/jhipster/lite/module/infrastructure/secondary/git/NativeHints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package tech.jhipster.lite.module.infrastructure.secondary.git; | ||
|
||
import org.eclipse.jgit.api.*; | ||
import org.eclipse.jgit.internal.*; | ||
import org.eclipse.jgit.lib.*; | ||
import org.springframework.aot.hint.*; | ||
import tech.jhipster.lite.common.domain.*; | ||
|
||
@Generated(reason = "Not testing native runtime hints") | ||
class NativeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
/* | ||
Mimics quarkus native configuration. See https://github.com/quarkiverse/quarkus-jgit/blob/main/deployment/src/main/java/io/quarkus/jgit/deployment/JGitProcessor.java | ||
Their calls to | ||
ReflectiveClassBuildItem(true, true, | ||
"org.eclipse.jgit.api.MergeCommand$FastForwardMode", | ||
means methods, fields and constructors | ||
*/ | ||
hints | ||
.reflection() | ||
.registerType(MergeCommand.FastForwardMode.class, MemberCategory.values()) | ||
.registerType(MergeCommand.FastForwardMode.Merge.class, MemberCategory.values()) | ||
.registerType(JGitText.class, MemberCategory.values()) | ||
.registerType(CoreConfig.AutoCRLF.class, MemberCategory.values()) | ||
.registerType(CoreConfig.CheckStat.class, MemberCategory.values()) | ||
.registerType(CoreConfig.EOL.class, MemberCategory.values()) | ||
.registerType(CoreConfig.EolStreamType.class, MemberCategory.values()) | ||
.registerType(CoreConfig.HideDotFiles.class, MemberCategory.values()) | ||
.registerType(CoreConfig.SymLinks.class, MemberCategory.values()) | ||
.registerType(CoreConfig.LogRefUpdates.class, MemberCategory.values()); | ||
|
||
// patterns for JGit and our own template files | ||
hints.resources().registerPattern("org.eclipse.jgit.internal.JGitText").registerPattern("generator/**"); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../java/tech/jhipster/lite/module/infrastructure/secondary/git/NativeJGitConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package tech.jhipster.lite.module.infrastructure.secondary.git; | ||
|
||
import org.springframework.context.annotation.*; | ||
import tech.jhipster.lite.common.domain.*; | ||
|
||
@ImportRuntimeHints(NativeHints.class) | ||
@Generated(reason = "Not testing native configuration") | ||
@Configuration | ||
class NativeJGitConfiguration {} |
30 changes: 30 additions & 0 deletions
30
...n/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/NativeHints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package tech.jhipster.lite.module.infrastructure.secondary.javadependency; | ||
|
||
import org.dom4j.DocumentFactory; | ||
import org.dom4j.util.NonLazyDocumentFactory; | ||
import org.dom4j.util.ProxyDocumentFactory; | ||
import org.springframework.aot.hint.MemberCategory; | ||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.RuntimeHintsRegistrar; | ||
import org.springframework.aot.hint.TypeReference; | ||
import tech.jhipster.lite.common.domain.Generated; | ||
|
||
@Generated(reason = "Not testing native runtime hints") | ||
class NativeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
// Needed for xml reading and writing via dom4j | ||
hints | ||
.reflection() | ||
.registerType(ProxyDocumentFactory.class, MemberCategory.values()) | ||
.registerType(DocumentFactory.class, MemberCategory.values()) | ||
.registerType(NonLazyDocumentFactory.class, MemberCategory.values()); | ||
|
||
// internal usage | ||
hints.reflection().registerType(TypeReference.of("com.sun.org.apache.xpath.internal.functions.FuncLocalPart"), MemberCategory.values()); | ||
|
||
// patterns for our own template files | ||
hints.resources().registerPattern("generator/**"); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ite/module/infrastructure/secondary/javadependency/NativeJavaDependencyConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package tech.jhipster.lite.module.infrastructure.secondary.javadependency; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportRuntimeHints; | ||
import tech.jhipster.lite.common.domain.Generated; | ||
|
||
@ImportRuntimeHints(NativeHints.class) | ||
@Generated(reason = "Not testing native configuration") | ||
@Configuration | ||
public class NativeJavaDependencyConfiguration {} |
22 changes: 22 additions & 0 deletions
22
src/main/java/tech/jhipster/lite/project/infrastructure/secondary/NativeHints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package tech.jhipster.lite.project.infrastructure.secondary; | ||
|
||
import org.springframework.aot.hint.MemberCategory; | ||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.RuntimeHintsRegistrar; | ||
import tech.jhipster.lite.common.domain.Generated; | ||
import tech.jhipster.lite.project.domain.history.ProjectAction; | ||
import tech.jhipster.lite.project.domain.history.ProjectHistory; | ||
|
||
@Generated(reason = "Not testing native runtime hints") | ||
class NativeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
hints | ||
.reflection() | ||
.registerType(PersistedProjectHistory.class, MemberCategory.values()) | ||
.registerType(ProjectHistory.class, MemberCategory.values()) | ||
.registerType(ProjectAction.class, MemberCategory.values()) | ||
.registerType(PersistedProjectAction.class, MemberCategory.values()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters