generator-jhipster 8.7.1 → 8.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/commands.d.mts +89 -89
- package/dist/cli/environment-builder.d.mts +7 -6
- package/dist/cli/environment-builder.mjs +5 -3
- package/dist/cli/jhipster-command.d.mts +2 -2
- package/dist/cli/jhipster-command.mjs +13 -4
- package/dist/cli/program.d.mts +53 -36
- package/dist/cli/program.mjs +41 -32
- package/dist/cli/utils.d.mts +2 -3
- package/dist/cli/utils.mjs +11 -21
- package/dist/generators/angular/generator.js +2 -2
- package/dist/generators/angular/resources/package.json +13 -13
- package/dist/generators/angular/templates/src/main/webapp/app/account/activate/activate.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/activate/activate.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password/password.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password/password.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/sessions/sessions.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/sessions/sessions.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/settings/settings.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/configuration/configuration.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/configuration/configuration.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/gateway/gateway-routes.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/gateway/gateway.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/health/health.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/health/health.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/health/modal/health-modal.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/logs/logs.component.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/admin/logs/logs.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/metrics.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/metrics.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/tracker/tracker.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/list/user-management.component.ts.ejs +5 -5
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/service/user-management.service.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/app.component.ts.ejs +4 -4
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/account.service.ts.ejs +7 -7
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/auth-jwt.service.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/auth-session.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/csrf.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/state-storage.service.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/core/interceptor/notification.interceptor.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/core/tracker/tracker.service.ts.ejs +5 -5
- package/dist/generators/angular/templates/src/main/webapp/app/core/util/alert.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs +4 -4
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/service/_entityFile_.service.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/home/home.component.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/main/main.component.ts.ejs +7 -7
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.ts.ejs +7 -7
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/profiles/profile.service.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.service.ts.ejs +4 -4
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert-error.component.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert.component.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/language/translate.directive.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/language/translation.module.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/shared/sort/sort-by.directive.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/shared/sort/sort.service.ts.ejs +1 -1
- package/dist/generators/base/api.d.ts +10 -4
- package/dist/generators/base/generator.d.ts +4 -0
- package/dist/generators/base/generator.js +10 -1
- package/dist/generators/base/shared-data.js +2 -0
- package/dist/generators/base/support/faker.d.ts +1 -1
- package/dist/generators/base/support/faker.js +1 -1
- package/dist/generators/base/support/timestamp.js +10 -2
- package/dist/generators/base-application/support/prepare-entity.js +6 -1
- package/dist/generators/base-application/support/prepare-field.js +40 -16
- package/dist/generators/base-application/support/prepare-relationship.d.ts +1 -1
- package/dist/generators/base-application/support/task-type-inference.d.ts +18 -18
- package/dist/generators/base-application/types.d.ts +4 -0
- package/dist/generators/base-core/generator.d.ts +7 -4
- package/dist/generators/base-core/generator.js +31 -35
- package/dist/generators/base-workspaces/generator.d.ts +34 -1
- package/dist/generators/base-workspaces/generator.js +1 -1
- package/dist/generators/base-workspaces/internal/docker-base.js +1 -3
- package/dist/generators/bootstrap/support/eslint-transform.js +2 -2
- package/dist/generators/bootstrap/support/java-unused-imports-transform.js +2 -2
- package/dist/generators/bootstrap/support/prettier-support.js +2 -2
- package/dist/generators/bootstrap-application-base/generator.d.ts +2 -2
- package/dist/generators/bootstrap-application-base/generator.js +19 -5
- package/dist/generators/bootstrap-application-base/utils.d.ts +3 -3
- package/dist/generators/bootstrap-application-base/utils.js +9 -3
- package/dist/generators/bootstrap-workspaces/command.d.ts +12 -2
- package/dist/generators/bootstrap-workspaces/command.js +5 -3
- package/dist/generators/bootstrap-workspaces/generator.d.ts +8 -2
- package/dist/generators/bootstrap-workspaces/generator.js +0 -2
- package/dist/generators/bootstrap-workspaces/index.d.ts +1 -0
- package/dist/generators/bootstrap-workspaces/index.js +1 -0
- package/dist/generators/client/command.d.ts +22 -0
- package/dist/generators/client/command.js +22 -0
- package/dist/generators/client/files-common.js +1 -1
- package/dist/generators/client/generator.js +4 -5
- package/dist/generators/client/prompts.js +10 -9
- package/dist/generators/client/resources/package.json +3 -3
- package/dist/generators/client/templates/webpack/webpack.microfrontend.js.jhi.ejs +16 -5
- package/dist/generators/common/generator.js +2 -2
- package/dist/generators/common/resources/package.json +1 -1
- package/dist/generators/cypress/files.js +6 -0
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/login-page.cy.ts.ejs +2 -2
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/logout.cy.ts.ejs +39 -0
- package/dist/generators/docker/generator.d.ts +1 -1
- package/dist/generators/docker/templates/docker/keycloak.yml.ejs +2 -1
- package/dist/generators/docker-compose/command.js +9 -1
- package/dist/generators/docker-compose/generator.d.ts +11 -53
- package/dist/generators/docker-compose/generator.js +24 -23
- package/dist/generators/generate-blueprint/command.d.ts +97 -20
- package/dist/generators/generate-blueprint/command.js +28 -0
- package/dist/generators/generate-blueprint/constants.d.ts +2 -2
- package/dist/generators/generate-blueprint/files.d.ts +1 -42
- package/dist/generators/generate-blueprint/files.js +27 -29
- package/dist/generators/generate-blueprint/generator.d.ts +5 -2
- package/dist/generators/generate-blueprint/generator.js +78 -22
- package/dist/generators/generate-blueprint/resources/package.json +3 -3
- package/dist/generators/generate-blueprint/templates/.github/workflows/samples.yml.ejs +6 -8
- package/dist/generators/generate-blueprint/templates/README.md.ejs +12 -2
- package/dist/generators/generate-blueprint/templates/cli/cli-customizations.cjs.ejs +2 -0
- package/dist/generators/generate-blueprint/templates/cli/cli.cjs.ejs +2 -1
- package/dist/generators/generate-blueprint/templates/cli/commands.cjs.ejs +1 -1
- package/dist/generators/generate-blueprint/templates/eslint.config.js.jhi.blueprint.ejs +3 -2
- package/dist/generators/generate-blueprint/templates/generators/generator/command.mjs.ejs +8 -12
- package/dist/generators/generate-blueprint/templates/generators/generator/generator.mjs.jhi.ejs +8 -11
- package/dist/generators/generate-blueprint/templates/generators/generator/generator.spec.mjs.ejs +2 -2
- package/dist/generators/generate-blueprint/templates/generators/generator/index.mjs.ejs +2 -4
- package/dist/generators/generate-blueprint/templates/vitest.config.ts.ejs +0 -1
- package/dist/generators/generator-constants.d.ts +2 -2
- package/dist/generators/generator-constants.js +3 -3
- package/dist/generators/git/command.d.ts +10 -0
- package/dist/generators/git/command.js +10 -0
- package/dist/generators/git/generator.d.ts +5 -4
- package/dist/generators/git/generator.js +6 -4
- package/dist/generators/gradle/generators/node-gradle/templates/buildSrc/src/main/groovy/jhipster.node-gradle-conventions.gradle.ejs +16 -10
- package/dist/generators/gradle/internal/needles.d.ts +3 -1
- package/dist/generators/gradle/internal/needles.js +10 -5
- package/dist/generators/gradle/templates/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/dist/generators/gradle/types.d.ts +3 -2
- package/dist/generators/init/command.d.ts +4 -20
- package/dist/generators/init/command.js +1 -1
- package/dist/generators/init/resources/.node-version +1 -1
- package/dist/generators/java/command.d.ts +3 -5
- package/dist/generators/java/command.js +1 -20
- package/dist/generators/java/generators/bootstrap/command.d.ts +7 -0
- package/dist/generators/java/generators/bootstrap/command.js +7 -0
- package/dist/generators/java/generators/build-tool/generator.js +37 -13
- package/dist/generators/java/generators/graalvm/command.d.ts +5 -0
- package/dist/generators/java/generators/graalvm/command.js +5 -0
- package/dist/generators/java/generators/graalvm/generator.d.ts +9 -0
- package/dist/generators/java/generators/graalvm/generator.js +222 -0
- package/dist/generators/java/generators/graalvm/index.d.ts +20 -0
- package/dist/generators/java/generators/graalvm/index.js +20 -0
- package/dist/generators/java/generators/graalvm/internal/maven-definition.d.ts +8 -0
- package/dist/generators/java/generators/graalvm/internal/maven-definition.js +130 -0
- package/dist/generators/java/generators/graalvm/resources/build.gradle +1 -0
- package/dist/generators/java/generators/graalvm/resources/gradle/libs.versions.toml +5 -0
- package/dist/generators/java/generators/graalvm/templates/README.md.jhi.native.ejs +53 -0
- package/dist/generators/java/generators/graalvm/templates/gradle/native.gradle.ejs +44 -0
- package/dist/generators/java/generators/graalvm/templates/src/main/java/_package_/config/NativeConfiguration.java.ejs +14 -0
- package/dist/generators/java/generators/node/generator.d.ts +6 -18
- package/dist/generators/java/generators/node/generator.js +31 -0
- package/dist/generators/java/generators/openapi-generator/generator.js +2 -2
- package/dist/generators/java/support/util.d.ts +1 -1
- package/dist/generators/java/types.d.ts +4 -1
- package/dist/generators/javascript/generators/bootstrap/command.d.ts +21 -20
- package/dist/generators/javascript/generators/bootstrap/generator.d.ts +1 -2
- package/dist/generators/javascript/generators/bootstrap/generator.js +9 -5
- package/dist/generators/javascript/types.d.ts +9 -2
- package/dist/generators/kubernetes/command.d.ts +12 -0
- package/dist/generators/kubernetes/command.js +12 -0
- package/dist/generators/kubernetes/index.d.ts +1 -0
- package/dist/generators/kubernetes/index.js +1 -0
- package/dist/generators/kubernetes-helm/index.d.ts +1 -0
- package/dist/generators/kubernetes-helm/index.js +1 -0
- package/dist/generators/kubernetes-knative/generator.d.ts +1 -1
- package/dist/generators/kubernetes-knative/index.d.ts +1 -0
- package/dist/generators/kubernetes-knative/index.js +1 -0
- package/dist/generators/languages/entity-files.d.ts +3 -2
- package/dist/generators/languages/entity-files.js +0 -1
- package/dist/generators/languages/generator.d.ts +1 -0
- package/dist/generators/languages/generator.js +1 -0
- package/dist/generators/liquibase/files.js +8 -0
- package/dist/generators/liquibase/generator.d.ts +1 -1
- package/dist/generators/liquibase/generator.js +15 -0
- package/dist/generators/liquibase/templates/src/main/resources/META-INF/native-image/liquibase/reflect-config.json +145 -0
- package/dist/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/add_relationship_constraints.ejs +81 -0
- package/dist/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/added_entity_constraints.xml.ejs +2 -62
- package/dist/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/updated_entity_constraints.xml.ejs +3 -60
- package/dist/generators/maven/generators/frontend-plugin/generator.js +10 -5
- package/dist/generators/maven/types.d.ts +3 -6
- package/dist/generators/project-name/command.d.ts +25 -20
- package/dist/generators/project-name/command.js +20 -4
- package/dist/generators/project-name/generator.d.ts +3 -12
- package/dist/generators/project-name/generator.js +6 -38
- package/dist/generators/react/generator.d.ts +1 -1
- package/dist/generators/react/generator.js +15 -2
- package/dist/generators/react/resources/package.json +25 -24
- package/dist/generators/react/templates/package.json.ejs +0 -3
- package/dist/generators/server/generator.d.ts +1 -7
- package/dist/generators/server/generator.js +22 -50
- package/dist/generators/server/resources/Dockerfile +12 -12
- package/dist/generators/server/resources/gradle/libs.versions.toml +10 -7
- package/dist/generators/server/resources/pom.xml +11 -11
- package/dist/generators/server/types.d.ts +8 -0
- package/dist/generators/spring-boot/cleanup.js +2 -2
- package/dist/generators/spring-boot/command.d.ts +19 -0
- package/dist/generators/spring-boot/command.js +19 -0
- package/dist/generators/spring-boot/generator.d.ts +1 -1
- package/dist/generators/spring-boot/generator.js +4 -1
- package/dist/generators/spring-boot/prompts.js +12 -12
- package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +107 -106
- package/dist/generators/spring-boot/templates/README.md.jhi.spring-boot.ejs +22 -16
- package/dist/generators/spring-boot/templates/gradle/profile_dev.gradle.ejs +2 -46
- package/dist/generators/spring-boot/templates/gradle/profile_prod.gradle.ejs +1 -47
- package/dist/generators/spring-boot/templates/src/main/java/_package_/Application.java.ejs +4 -1
- package/dist/generators/spring-boot/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +29 -6
- package/dist/generators/spring-boot/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +32 -6
- package/dist/generators/spring-boot/templates/src/main/java/_package_/config/WebConfigurer.java.ejs +13 -8
- package/dist/generators/spring-boot/templates/src/main/java/_package_/domain/User.java.ejs +2 -3
- package/dist/generators/spring-boot/templates/src/main/resources/config/application-dev.yml.ejs +8 -3
- package/dist/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs +4 -2
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +8 -7
- package/dist/generators/spring-cache/generator.d.ts +2 -1
- package/dist/generators/spring-cache/generator.js +18 -0
- package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/spring-cloud/generators/gateway/generator.js +2 -2
- package/dist/generators/spring-data-couchbase/generator.js +2 -2
- package/dist/generators/spring-data-mongodb/generator.d.ts +1 -1
- package/dist/generators/spring-data-relational/files.d.ts +1 -0
- package/dist/generators/spring-data-relational/files.js +6 -0
- package/dist/generators/spring-data-relational/generator.d.ts +2 -1
- package/dist/generators/spring-data-relational/generator.js +63 -2
- package/dist/generators/spring-data-relational/internal/dependencies.d.ts +87 -7
- package/dist/generators/spring-data-relational/internal/dependencies.js +30 -18
- package/dist/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_persistable.ejs +6 -0
- package/dist/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_reactive.ejs +1 -2
- package/dist/generators/spring-data-relational/templates/src/main/java/_package_/config/DatabaseConfiguration.java.ejs +8 -3
- package/dist/generators/spring-data-relational/templates/src/main/java/_package_/config/JacksonNativeConfiguration.java.ejs +98 -0
- package/dist/generators/vue/files-vue.js +4 -1
- package/dist/generators/vue/generator.d.ts +1 -1
- package/dist/generators/vue/generator.js +84 -3
- package/dist/generators/vue/resources/package.json +20 -19
- package/dist/generators/vue/support/update-languages.js +1 -1
- package/dist/generators/vue/templates/module-federation.config.cjs.ejs +55 -0
- package/dist/generators/vue/templates/package.json.ejs +11 -62
- package/dist/generators/vue/templates/src/main/webapp/app/main.ts.ejs +1 -1
- package/dist/generators/vue/templates/vite.config.mts.ejs +15 -21
- package/dist/generators/workspaces/generator.d.ts +20 -9
- package/dist/generators/workspaces/generator.js +3 -3
- package/dist/lib/application/field-types.d.ts +2 -1
- package/dist/lib/command/converter.d.ts +6 -2
- package/dist/lib/command/converter.js +4 -1
- package/dist/lib/command/load.js +1 -0
- package/dist/lib/command/lookup-commands-configs.js +9 -12
- package/dist/lib/command/support/merge-union.d.ts +17 -6
- package/dist/lib/command/types.d.ts +38 -11
- package/dist/lib/eslint/index.d.ts +6 -14
- package/dist/lib/eslint/index.js +1 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +7 -3
- package/dist/lib/jdl/core/parsing/validator.js +2 -2
- package/dist/lib/jhipster/default-application-options.d.ts +83 -15
- package/dist/lib/jhipster/default-application-options.js +26 -27
- package/dist/lib/testing/get-generator.d.ts +1 -0
- package/dist/lib/testing/get-generator.js +6 -2
- package/dist/lib/testing/github-group.d.ts +6 -0
- package/dist/lib/testing/github-group.js +56 -0
- package/dist/lib/testing/github-matrix.d.ts +38 -0
- package/dist/lib/testing/github-matrix.js +72 -0
- package/dist/lib/testing/github.d.ts +1 -0
- package/dist/lib/testing/github.js +6 -2
- package/dist/lib/testing/helpers.d.ts +41 -3
- package/dist/lib/testing/helpers.js +74 -12
- package/dist/lib/testing/index.d.ts +2 -0
- package/dist/lib/testing/index.js +2 -0
- package/dist/lib/testing/support/matcher.d.ts +2 -2
- package/dist/lib/testing/support/matcher.js +3 -3
- package/dist/lib/types/application/application.d.ts +6 -1
- package/dist/lib/types/application/entity.d.ts +3 -1
- package/dist/lib/types/application/field.d.ts +16 -4
- package/dist/lib/types/application/options.d.ts +4 -0
- package/dist/lib/types/application/relationship.d.ts +1 -0
- package/dist/lib/types/application/yo-rc.d.ts +4 -0
- package/dist/lib/types/base/entity.d.ts +1 -0
- package/dist/lib/utils/logger.d.ts +1 -1
- package/dist/lib/utils/yo-rc.d.ts +27 -3
- package/package.json +33 -31
- package/dist/generators/generate-blueprint/templates/vitest.test-setup.ts.ejs +0 -6
- package/dist/generators/vue/templates/webpack/webpack.microfrontend.js.jhi.vue.ejs +0 -45
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2024 the original author or authors from the JHipster project.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
* for more information.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { extname } from 'path';
|
|
20
|
+
import { isFileStateDeleted, isFileStateModified } from 'mem-fs-editor/state';
|
|
21
|
+
import { passthrough } from '@yeoman/transform';
|
|
22
|
+
import BaseApplicationGenerator from '../../../base-application/index.js';
|
|
23
|
+
import { createNeedleCallback } from '../../../base/support/needles.js';
|
|
24
|
+
import { addJavaAnnotation, addJavaImport } from '../../../java/support/add-java-annotation.js';
|
|
25
|
+
import { javaMainPackageTemplatesBlock } from '../../../java/support/files.js';
|
|
26
|
+
import { mavenDefinition } from './internal/maven-definition.js';
|
|
27
|
+
export default class GraalvmGenerator extends BaseApplicationGenerator {
|
|
28
|
+
async beforeQueue() {
|
|
29
|
+
if (!this.fromBlueprint) {
|
|
30
|
+
await this.composeWithBlueprints();
|
|
31
|
+
}
|
|
32
|
+
if (!this.delegateToBlueprint) {
|
|
33
|
+
await this.dependsOnBootstrapApplication();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
get initializing() {
|
|
37
|
+
return this.asInitializingTaskGroup({
|
|
38
|
+
forceConfig() {
|
|
39
|
+
// Cache is not supported for GraalVM native image
|
|
40
|
+
this.jhipsterConfig.cacheProvider ??= 'no';
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
get [BaseApplicationGenerator.INITIALIZING]() {
|
|
45
|
+
return this.delegateTasksToBlueprint(() => this.initializing);
|
|
46
|
+
}
|
|
47
|
+
get preparing() {
|
|
48
|
+
return this.asPreparingTaskGroup({
|
|
49
|
+
load({ application }) {
|
|
50
|
+
this.loadJavaDependenciesFromGradleCatalog(application.javaDependencies);
|
|
51
|
+
},
|
|
52
|
+
addNativeHint({ source, application }) {
|
|
53
|
+
source.addNativeHint = ({ advanced = [], declaredConstructors = [], publicConstructors = [], resources = [] }) => {
|
|
54
|
+
this.editFile(`${application.javaPackageSrcDir}config/NativeConfiguration.java`, addJavaImport('org.springframework.aot.hint.MemberCategory'), createNeedleCallback({
|
|
55
|
+
contentToAdd: [
|
|
56
|
+
...advanced,
|
|
57
|
+
...resources.map(resource => `hints.resources().registerPattern("${resource}");`),
|
|
58
|
+
...publicConstructors.map(classPath => `hints.reflection().registerType(${classPath}, (hint) -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));`),
|
|
59
|
+
...declaredConstructors.map(classPath => `hints.reflection().registerType(${classPath}, (hint) -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS));`),
|
|
60
|
+
],
|
|
61
|
+
needle: 'add-native-hints',
|
|
62
|
+
ignoreWhitespaces: true,
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
async packageJson({ application }) {
|
|
67
|
+
const { buildToolGradle, packageJsonScripts } = application;
|
|
68
|
+
const scripts = buildToolGradle
|
|
69
|
+
? {
|
|
70
|
+
'native-package': './gradlew nativeCompile -Pnative -Pprod -x test -x integrationTest',
|
|
71
|
+
'native-package-dev': './gradlew nativeCompile -Pnative -Pdev -x test -x integrationTest',
|
|
72
|
+
'native-start': './build/native/nativeCompile/native-executable',
|
|
73
|
+
}
|
|
74
|
+
: {
|
|
75
|
+
'native-package': './mvnw package -B -ntp -Pnative,prod -DskipTests',
|
|
76
|
+
'native-package-dev': './mvnw package -B -ntp -Pnative,dev,webapp -DskipTests',
|
|
77
|
+
'native-start': './target/native-executable',
|
|
78
|
+
};
|
|
79
|
+
Object.assign(packageJsonScripts, {
|
|
80
|
+
'native-e2e': 'concurrently -k -s first -n application,e2e -c red,blue npm:native-start npm:e2e:headless',
|
|
81
|
+
...scripts,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
get [BaseApplicationGenerator.PREPARING]() {
|
|
87
|
+
return this.delegateTasksToBlueprint(() => this.preparing);
|
|
88
|
+
}
|
|
89
|
+
get default() {
|
|
90
|
+
return this.asDefaultTaskGroup({
|
|
91
|
+
// workaround for https://github.com/spring-projects/spring-boot/issues/32195
|
|
92
|
+
async disabledInAotModeAnnotation({ application }) {
|
|
93
|
+
this.queueTransformStream({
|
|
94
|
+
name: 'adding @DisabledInAotMode annotations',
|
|
95
|
+
filter: file => !isFileStateDeleted(file) &&
|
|
96
|
+
isFileStateModified(file) &&
|
|
97
|
+
file.path.startsWith(this.destinationPath(application.srcTestJava)) &&
|
|
98
|
+
extname(file.path) === '.java',
|
|
99
|
+
refresh: false,
|
|
100
|
+
}, passthrough(file => {
|
|
101
|
+
const contents = file.contents.toString('utf8');
|
|
102
|
+
if (/@(MockBean|SpyBean)/.test(contents) || (application.reactive && /@AuthenticationIntegrationTest/.test(contents))) {
|
|
103
|
+
file.contents = Buffer.from(addJavaAnnotation(contents, { package: 'org.springframework.test.context.aot', annotation: 'DisabledInAotMode' }));
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
get [BaseApplicationGenerator.DEFAULT]() {
|
|
110
|
+
return this.delegateTasksToBlueprint(() => this.default);
|
|
111
|
+
}
|
|
112
|
+
get writing() {
|
|
113
|
+
return this.asWritingTaskGroup({
|
|
114
|
+
async writingTemplateTask({ application }) {
|
|
115
|
+
await this.writeFiles({
|
|
116
|
+
sections: {
|
|
117
|
+
common: [{ templates: ['README.md.jhi.native'] }],
|
|
118
|
+
config: [
|
|
119
|
+
javaMainPackageTemplatesBlock({
|
|
120
|
+
templates: ['config/NativeConfiguration.java'],
|
|
121
|
+
}),
|
|
122
|
+
],
|
|
123
|
+
gradle: [
|
|
124
|
+
{
|
|
125
|
+
condition: ctx => ctx.buildToolGradle,
|
|
126
|
+
templates: ['gradle/native.gradle'],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
context: application,
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
get [BaseApplicationGenerator.WRITING]() {
|
|
136
|
+
return this.delegateTasksToBlueprint(() => this.writing);
|
|
137
|
+
}
|
|
138
|
+
get postWriting() {
|
|
139
|
+
return this.asPostWritingTaskGroup({
|
|
140
|
+
async customizeGradle({ application, source }) {
|
|
141
|
+
const { buildToolGradle, javaDependencies } = application;
|
|
142
|
+
if (!buildToolGradle)
|
|
143
|
+
return;
|
|
144
|
+
source.addGradleDependencyCatalogPlugin({
|
|
145
|
+
addToBuild: true,
|
|
146
|
+
pluginName: 'graalvm',
|
|
147
|
+
id: 'org.graalvm.buildtools.native',
|
|
148
|
+
version: javaDependencies.nativeBuildTools,
|
|
149
|
+
});
|
|
150
|
+
source.applyFromGradle({ script: 'gradle/native.gradle' });
|
|
151
|
+
},
|
|
152
|
+
async customizeMaven({ application, source }) {
|
|
153
|
+
const { buildToolMaven, reactive, databaseTypeSql, javaDependencies, nativeLanguageDefinition, languagesDefinition } = application;
|
|
154
|
+
if (!buildToolMaven)
|
|
155
|
+
return;
|
|
156
|
+
source.addMavenDefinition(mavenDefinition({
|
|
157
|
+
reactive,
|
|
158
|
+
nativeBuildToolsVersion: javaDependencies.nativeBuildTools,
|
|
159
|
+
databaseTypeSql,
|
|
160
|
+
userLanguage: nativeLanguageDefinition.languageTag,
|
|
161
|
+
languages: languagesDefinition.map(def => def.languageTag),
|
|
162
|
+
}));
|
|
163
|
+
},
|
|
164
|
+
springBootHintsConfiguration({ application, source }) {
|
|
165
|
+
const { mainClass, javaPackageSrcDir, packageName, backendTypeSpringBoot } = application;
|
|
166
|
+
if (backendTypeSpringBoot) {
|
|
167
|
+
source.editJavaFile(`${javaPackageSrcDir}${mainClass}.java`, {
|
|
168
|
+
annotations: [
|
|
169
|
+
{
|
|
170
|
+
package: 'org.springframework.context.annotation',
|
|
171
|
+
annotation: 'ImportRuntimeHints',
|
|
172
|
+
parameters: () => `{ ${packageName}.config.NativeConfiguration.JHipsterNativeRuntimeHints.class }`,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
springBootRestErrors({ application, source }) {
|
|
179
|
+
const { javaPackageSrcDir, backendTypeSpringBoot } = application;
|
|
180
|
+
if (backendTypeSpringBoot) {
|
|
181
|
+
source.editJavaFile(`${javaPackageSrcDir}/web/rest/errors/FieldErrorVM.java`, {
|
|
182
|
+
annotations: [
|
|
183
|
+
{
|
|
184
|
+
package: 'org.springframework.aot.hint.annotation',
|
|
185
|
+
annotation: 'RegisterReflectionForBinding',
|
|
186
|
+
parameters: () => '{ FieldErrorVM.class }',
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
// workaround for arch error in backend:unit:test caused by gradle's org.graalvm.buildtools.native plugin
|
|
193
|
+
springBootTechnicalStructureTest({ application, source }) {
|
|
194
|
+
const { buildToolGradle, javaPackageTestDir, backendTypeSpringBoot } = application;
|
|
195
|
+
if (!buildToolGradle || !backendTypeSpringBoot)
|
|
196
|
+
return;
|
|
197
|
+
source.editJavaFile(`${javaPackageTestDir}/TechnicalStructureTest.java`, {
|
|
198
|
+
staticImports: ['com.tngtech.archunit.core.domain.JavaClass.Predicates.simpleNameEndingWith'],
|
|
199
|
+
}, contents => contents.includes('__BeanFactoryRegistrations')
|
|
200
|
+
? contents
|
|
201
|
+
: contents.replace('.ignoreDependency(belongToAnyOf', `.ignoreDependency(simpleNameEndingWith("_BeanFactoryRegistrations"), alwaysTrue())
|
|
202
|
+
.ignoreDependency(belongToAnyOf`));
|
|
203
|
+
},
|
|
204
|
+
nativeHints({ source, application }) {
|
|
205
|
+
if (!application.backendTypeSpringBoot)
|
|
206
|
+
return;
|
|
207
|
+
source.addNativeHint({
|
|
208
|
+
advanced: [
|
|
209
|
+
// Undertow
|
|
210
|
+
'hints.reflection().registerType(sun.misc.Unsafe.class, (hint) -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));',
|
|
211
|
+
// Thymeleaf template
|
|
212
|
+
'hints.reflection().registerType(java.util.Locale.class, (hint) -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));',
|
|
213
|
+
],
|
|
214
|
+
resources: ['i18n/*'],
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
get [BaseApplicationGenerator.POST_WRITING]() {
|
|
220
|
+
return this.delegateTasksToBlueprint(() => this.postWriting);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2024 the original author or authors from the JHipster project.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
* for more information.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
export { default } from './generator.js';
|
|
20
|
+
export { default as command } from './command.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2024 the original author or authors from the JHipster project.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
* for more information.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
export { default } from './generator.js';
|
|
20
|
+
export { default as command } from './command.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MavenDefinition } from '../../../../maven/types.js';
|
|
2
|
+
export declare const mavenDefinition: ({ reactive, nativeBuildToolsVersion, databaseTypeSql, userLanguage, languages, }: {
|
|
3
|
+
reactive?: boolean;
|
|
4
|
+
nativeBuildToolsVersion?: string;
|
|
5
|
+
databaseTypeSql?: boolean;
|
|
6
|
+
userLanguage: string;
|
|
7
|
+
languages: string[];
|
|
8
|
+
}) => MavenDefinition;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export const mavenDefinition = ({ reactive, nativeBuildToolsVersion, databaseTypeSql, userLanguage, languages, }) => ({
|
|
2
|
+
properties: [
|
|
3
|
+
{ property: 'repackage.classifier' },
|
|
4
|
+
{ property: 'native-image-name', value: 'native-executable' },
|
|
5
|
+
{ property: 'native-buildtools.version', value: nativeBuildToolsVersion },
|
|
6
|
+
],
|
|
7
|
+
pluginManagement: [
|
|
8
|
+
{
|
|
9
|
+
groupId: 'org.graalvm.buildtools',
|
|
10
|
+
artifactId: 'native-maven-plugin',
|
|
11
|
+
version: '${native-buildtools.version}',
|
|
12
|
+
additionalContent: `
|
|
13
|
+
<configuration>
|
|
14
|
+
<fallback>false</fallback>
|
|
15
|
+
<classesDirectory>\${project.build.outputDirectory}</classesDirectory>
|
|
16
|
+
<metadataRepository>
|
|
17
|
+
<enabled>true</enabled>
|
|
18
|
+
</metadataRepository>
|
|
19
|
+
<imageName>\${native-image-name}</imageName>
|
|
20
|
+
<verbose>true</verbose>
|
|
21
|
+
<buildArgs>
|
|
22
|
+
<buildArg>-Duser.language=${userLanguage}</buildArg>
|
|
23
|
+
<buildArg>-H:IncludeLocales=${languages.join(',')}</buildArg>
|
|
24
|
+
</buildArgs>
|
|
25
|
+
<jvmArgs>
|
|
26
|
+
<arg>-Xms4g</arg>
|
|
27
|
+
<arg>-Xmx10g</arg>
|
|
28
|
+
</jvmArgs>
|
|
29
|
+
</configuration>`,
|
|
30
|
+
},
|
|
31
|
+
...(reactive || !databaseTypeSql
|
|
32
|
+
? []
|
|
33
|
+
: [
|
|
34
|
+
{
|
|
35
|
+
groupId: 'org.hibernate.orm.tooling',
|
|
36
|
+
artifactId: 'hibernate-enhance-maven-plugin',
|
|
37
|
+
version: '${hibernate.version}',
|
|
38
|
+
additionalContent: `
|
|
39
|
+
<configuration>
|
|
40
|
+
<enableLazyInitialization>true</enableLazyInitialization>
|
|
41
|
+
</configuration>`,
|
|
42
|
+
},
|
|
43
|
+
]),
|
|
44
|
+
],
|
|
45
|
+
profiles: [
|
|
46
|
+
{
|
|
47
|
+
id: 'native',
|
|
48
|
+
content: `
|
|
49
|
+
<properties>
|
|
50
|
+
<repackage.classifier>exec</repackage.classifier>
|
|
51
|
+
<modernizer.skip>true</modernizer.skip>
|
|
52
|
+
<spring.h2.console.enabled>false</spring.h2.console.enabled>
|
|
53
|
+
</properties>
|
|
54
|
+
<build>
|
|
55
|
+
<plugins>${databaseTypeSql && !reactive
|
|
56
|
+
? `
|
|
57
|
+
<plugin>
|
|
58
|
+
<groupId>org.hibernate.orm.tooling</groupId>
|
|
59
|
+
<artifactId>hibernate-enhance-maven-plugin</artifactId>
|
|
60
|
+
<executions>
|
|
61
|
+
<execution>
|
|
62
|
+
<goals>
|
|
63
|
+
<goal>enhance</goal>
|
|
64
|
+
</goals>
|
|
65
|
+
</execution>
|
|
66
|
+
</executions>
|
|
67
|
+
</plugin>`
|
|
68
|
+
: ``}
|
|
69
|
+
<plugin>
|
|
70
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
71
|
+
<artifactId>maven-jar-plugin</artifactId>
|
|
72
|
+
<configuration>
|
|
73
|
+
<archive>
|
|
74
|
+
<manifestEntries>
|
|
75
|
+
<Spring-Boot-Native-Processed>true</Spring-Boot-Native-Processed>
|
|
76
|
+
</manifestEntries>
|
|
77
|
+
</archive>
|
|
78
|
+
</configuration>
|
|
79
|
+
</plugin>
|
|
80
|
+
<plugin>
|
|
81
|
+
<groupId>org.springframework.boot</groupId>
|
|
82
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
83
|
+
<configuration>
|
|
84
|
+
<image>
|
|
85
|
+
<builder>paketobuildpacks/builder:tiny</builder>
|
|
86
|
+
<env>
|
|
87
|
+
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
|
88
|
+
</env>
|
|
89
|
+
</image>
|
|
90
|
+
</configuration>
|
|
91
|
+
<executions>
|
|
92
|
+
<execution>
|
|
93
|
+
<id>process-aot</id>
|
|
94
|
+
<goals>
|
|
95
|
+
<goal>process-aot</goal>
|
|
96
|
+
</goals>
|
|
97
|
+
</execution>
|
|
98
|
+
</executions>
|
|
99
|
+
</plugin>
|
|
100
|
+
<plugin>
|
|
101
|
+
<groupId>org.graalvm.buildtools</groupId>
|
|
102
|
+
<artifactId>native-maven-plugin</artifactId>
|
|
103
|
+
<executions>
|
|
104
|
+
<execution>
|
|
105
|
+
<id>add-reachability-metadata</id>
|
|
106
|
+
<goals>
|
|
107
|
+
<goal>add-reachability-metadata</goal>
|
|
108
|
+
</goals>
|
|
109
|
+
</execution>
|
|
110
|
+
<execution>
|
|
111
|
+
<id>build-native</id>
|
|
112
|
+
<goals>
|
|
113
|
+
<goal>compile-no-fork</goal>
|
|
114
|
+
</goals>
|
|
115
|
+
<phase>package</phase>
|
|
116
|
+
</execution>
|
|
117
|
+
<execution>
|
|
118
|
+
<id>test-native</id>
|
|
119
|
+
<goals>
|
|
120
|
+
<goal>test</goal>
|
|
121
|
+
</goals>
|
|
122
|
+
<phase>test</phase>
|
|
123
|
+
</execution>
|
|
124
|
+
</executions>
|
|
125
|
+
</plugin>
|
|
126
|
+
</plugins>
|
|
127
|
+
</build>`,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// required by dependabot
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2024 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
<%#
|
|
20
|
+
This is a fragment file, it will be merged into to root template if available.
|
|
21
|
+
EJS fragments will process % delimiter tags in template and & delimiter tags in the merge process.
|
|
22
|
+
-%>
|
|
23
|
+
<&_ if (fragment.othersSection) { -&>
|
|
24
|
+
### About Native Build
|
|
25
|
+
|
|
26
|
+
#### Installation
|
|
27
|
+
|
|
28
|
+
To build a Native image, you need to install a JDK that is compatible with GraalVM. Please refer to the [GraalVM Release Notes](https://www.graalvm.org/release-notes/) and install the appropriate JDK. Using SDKMAN simplifies the installation process.
|
|
29
|
+
```
|
|
30
|
+
sdk install java 21-graalce
|
|
31
|
+
```
|
|
32
|
+
#### How to Build a Native Image
|
|
33
|
+
|
|
34
|
+
To build a native image, execute the following command:
|
|
35
|
+
```bash
|
|
36
|
+
npm run native-package
|
|
37
|
+
# <%- packageJsonScripts['native-package'] %>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
After that, set up peripheral services like PostgreSQL using `npm run services:up`(<%- packageJsonScripts['services:up'] %>) and ensure everything is ready.
|
|
41
|
+
|
|
42
|
+
Lastly, run the Native image and experience its fast startup 😊.
|
|
43
|
+
```bash
|
|
44
|
+
npm run native-start
|
|
45
|
+
# <%- packageJsonScripts['native-start'] %>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If you've enabled e2e testing with Cypress, you can verify its operation using the following command:
|
|
49
|
+
```bash
|
|
50
|
+
npm run native-e2e
|
|
51
|
+
# <%- packageJsonScripts['native-e2e'] %>
|
|
52
|
+
```
|
|
53
|
+
<&_ } -&>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
graalvmNative {
|
|
2
|
+
toolchainDetection = true
|
|
3
|
+
binaries {
|
|
4
|
+
main {
|
|
5
|
+
imageName = 'native-executable'
|
|
6
|
+
//this is only needed when you toolchain can't be detected
|
|
7
|
+
//javaLauncher = javaToolchains.launcherFor {
|
|
8
|
+
// languageVersion = JavaLanguageVersion.of(19)
|
|
9
|
+
// vendor = JvmVendorSpec.matching("GraalVM Community")
|
|
10
|
+
//}
|
|
11
|
+
buildArgs.add("-Duser.language=<%- nativeLanguageDefinition.languageTag %>")
|
|
12
|
+
buildArgs.add("-H:IncludeLocales=<%- languagesDefinition.map(def => def.languageTag).join(',') %>")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
binaries.all {
|
|
16
|
+
verbose = true
|
|
17
|
+
jvmArgs.add('-Xms4g')
|
|
18
|
+
jvmArgs.add('-Xmx10g')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
processTestAot {
|
|
23
|
+
jvmArgs += ["-XX:+AllowRedefinitionToAddDeleteMethods"]
|
|
24
|
+
}
|
|
25
|
+
<%_ if (!reactive && databaseTypeSql) { _%>
|
|
26
|
+
<%_ if (devDatabaseTypeH2Any) { _%>
|
|
27
|
+
|
|
28
|
+
processResources {
|
|
29
|
+
filesMatching("**/application-dev.yml") {
|
|
30
|
+
filter {
|
|
31
|
+
it.replace("@spring.h2.console.enabled@", String.valueOf(!project.hasProperty("native")))
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
<%_ } _%>
|
|
36
|
+
|
|
37
|
+
if (project.hasProperty("native")) {
|
|
38
|
+
hibernate {
|
|
39
|
+
enhancement {
|
|
40
|
+
enableLazyInitialization = true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
<%_ } _%>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package <%=packageName%>.config;
|
|
2
|
+
|
|
3
|
+
import org.springframework.aot.hint.RuntimeHints;
|
|
4
|
+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|
5
|
+
|
|
6
|
+
public class NativeConfiguration {
|
|
7
|
+
|
|
8
|
+
public static class JHipsterNativeRuntimeHints implements RuntimeHintsRegistrar {
|
|
9
|
+
@Override
|
|
10
|
+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
11
|
+
// jhipster-needle-add-native-hints - JHipster will add native hints here
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-2024 the original author or authors from the JHipster project.
|
|
3
|
-
*
|
|
4
|
-
* This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
-
* for more information.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
1
|
import BaseApplicationGenerator from '../../../base-application/index.js';
|
|
20
2
|
export default class NodeGenerator extends BaseApplicationGenerator {
|
|
21
3
|
beforeQueue(): Promise<void>;
|
|
22
4
|
get composing(): import("../../../../lib/types/base/tasks.js").GenericTaskGroup<any, import("../../../../lib/types/base/tasks.js").TaskParamWithControl, "compose">;
|
|
5
|
+
get postPreparing(): import("../../../../lib/types/base/tasks.js").GenericTaskGroup<any, import("../../../../lib/types/base/tasks.js").TaskParamWithControl & {
|
|
6
|
+
source: import("../../../../lib/types/application/application.js").BaseApplicationSource;
|
|
7
|
+
} & {
|
|
8
|
+
application: import("../../../../lib/types/application/application.js").ApplicationType<import("../../../base-application/index.js").Entity<import("../../../base-application/index.js").Field, never>>;
|
|
9
|
+
}, "useNpmWrapper">;
|
|
23
10
|
get writing(): import("../../../../lib/types/base/tasks.js").GenericTaskGroup<any, import("../../../../lib/types/application/tasks.js").WritingTaskParam<import("../../../base-application/index.js").Entity<import("../../../base-application/index.js").Field, never>, import("../../../../lib/types/application/application.js").ApplicationType<import("../../../base-application/index.js").Entity<import("../../../base-application/index.js").Field, never>>>, "writing">;
|
|
11
|
+
useNpmWrapperInstallTask(): void;
|
|
24
12
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
+
import chalk from 'chalk';
|
|
19
20
|
import BaseApplicationGenerator from '../../../base-application/index.js';
|
|
20
21
|
export default class NodeGenerator extends BaseApplicationGenerator {
|
|
21
22
|
async beforeQueue() {
|
|
@@ -43,6 +44,18 @@ export default class NodeGenerator extends BaseApplicationGenerator {
|
|
|
43
44
|
get [BaseApplicationGenerator.COMPOSING]() {
|
|
44
45
|
return this.delegateTasksToBlueprint(() => this.composing);
|
|
45
46
|
}
|
|
47
|
+
get postPreparing() {
|
|
48
|
+
return this.asPostPreparingTaskGroup({
|
|
49
|
+
useNpmWrapper({ application }) {
|
|
50
|
+
if (application.useNpmWrapper) {
|
|
51
|
+
this.useNpmWrapperInstallTask();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
get [BaseApplicationGenerator.POST_PREPARING]() {
|
|
57
|
+
return this.delegateTasksToBlueprint(() => this.postPreparing);
|
|
58
|
+
}
|
|
46
59
|
get writing() {
|
|
47
60
|
return this.asWritingTaskGroup({
|
|
48
61
|
async writing({ application }) {
|
|
@@ -62,4 +75,22 @@ export default class NodeGenerator extends BaseApplicationGenerator {
|
|
|
62
75
|
get [BaseApplicationGenerator.WRITING]() {
|
|
63
76
|
return this.delegateTasksToBlueprint(() => this.writing);
|
|
64
77
|
}
|
|
78
|
+
useNpmWrapperInstallTask() {
|
|
79
|
+
this.setFeatures({
|
|
80
|
+
customInstallTask: async (preferredPm, defaultInstallTask) => {
|
|
81
|
+
const buildTool = this.jhipsterConfigWithDefaults.buildTool;
|
|
82
|
+
if ((preferredPm && preferredPm !== 'npm') || this.jhipsterConfig.skipClient || (buildTool !== 'gradle' && buildTool !== 'maven')) {
|
|
83
|
+
await defaultInstallTask();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const npmCommand = process.platform === 'win32' ? 'npmw' : './npmw';
|
|
87
|
+
try {
|
|
88
|
+
await this.spawn(npmCommand, ['install'], { preferLocal: true });
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.log.error(chalk.red(`Error executing '${npmCommand} install', please execute it yourself. (${error.shortMessage})`));
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
65
96
|
}
|
|
@@ -31,8 +31,8 @@ export default class OpenapiGeneratorGenerator extends BaseApplicationGenerator
|
|
|
31
31
|
}
|
|
32
32
|
get writing() {
|
|
33
33
|
return this.asWritingTaskGroup({
|
|
34
|
-
cleanup({ application, control }) {
|
|
35
|
-
control.cleanupFiles({
|
|
34
|
+
async cleanup({ application, control }) {
|
|
35
|
+
await control.cleanupFiles({
|
|
36
36
|
'8.6.1': [[application.buildToolGradle, 'gradle/swagger.gradle']],
|
|
37
37
|
});
|
|
38
38
|
},
|
|
@@ -28,7 +28,10 @@ export type JavaArtifact = {
|
|
|
28
28
|
|
|
29
29
|
export type JavaArtifactVersion = RequireOneOrNone<{ version?: string; versionRef?: string }, 'version' | 'versionRef'>;
|
|
30
30
|
|
|
31
|
-
export type JavaDependency = JavaArtifact &
|
|
31
|
+
export type JavaDependency = JavaArtifact &
|
|
32
|
+
JavaArtifactVersion & {
|
|
33
|
+
exclusions?: JavaArtifact[];
|
|
34
|
+
};
|
|
32
35
|
|
|
33
36
|
export type JavaDefinition = {
|
|
34
37
|
versions?: JavaDependencyVersion[];
|