Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 20, 2024
1 parent c97f390 commit 10d5c03
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 48 deletions.
32 changes: 16 additions & 16 deletions .blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -566,48 +566,48 @@ exports[`generator - github-build-matrix with graalvm should match matrix value
"{
"include": [
{
"job-name": "maven-h2Disk-nativeSupport(true)",
"sample": "maven-h2Disk-nativeSupport(true)",
"os": "ubuntu-latest",
"job-name": "maven-h2Disk-nativeSupport(true)-cacheProvider(no)",
"sample": "maven-h2Disk-nativeSupport(true)-cacheProvider(no)",
"os": "macos-15",
"node-version": "NODE-VERSION",
"java-version": "JAVA-VERSION",
"npm-version": "NPM-VERSION",
"default-environment": "prod",
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool maven\\n devDatabaseType h2Disk\\n nativeSupport true\\n }\\n}"
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool maven\\n devDatabaseType h2Disk\\n nativeSupport true\\n cacheProvider no\\n }\\n}"
},
{
"job-name": "maven-reactive(true)-h2Disk-nativeSupport(true)",
"sample": "maven-reactive(true)-h2Disk-nativeSupport(true)",
"os": "ubuntu-latest",
"job-name": "maven-reactive(true)-h2Disk-nativeSupport(true)-cacheProvider(no)",
"sample": "maven-reactive(true)-h2Disk-nativeSupport(true)-cacheProvider(no)",
"os": "macos-15",
"node-version": "NODE-VERSION",
"java-version": "JAVA-VERSION",
"npm-version": "NPM-VERSION",
"default-environment": "prod",
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool maven\\n reactive true\\n devDatabaseType h2Disk\\n nativeSupport true\\n }\\n}"
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool maven\\n reactive true\\n devDatabaseType h2Disk\\n nativeSupport true\\n cacheProvider no\\n }\\n}"
},
{
"job-name": "gradle-h2Disk-nativeSupport(true)",
"sample": "gradle-h2Disk-nativeSupport(true)",
"os": "ubuntu-latest",
"job-name": "gradle-h2Disk-nativeSupport(true)-cacheProvider(no)",
"sample": "gradle-h2Disk-nativeSupport(true)-cacheProvider(no)",
"os": "macos-15",
"node-version": "NODE-VERSION",
"java-version": "JAVA-VERSION",
"npm-version": "NPM-VERSION",
"default-environment": "prod",
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool gradle\\n devDatabaseType h2Disk\\n nativeSupport true\\n }\\n}"
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool gradle\\n devDatabaseType h2Disk\\n nativeSupport true\\n cacheProvider no\\n }\\n}"
},
{
"job-name": "gradle-reactive(true)-h2Disk-nativeSupport(true)",
"sample": "gradle-reactive(true)-h2Disk-nativeSupport(true)",
"os": "ubuntu-latest",
"job-name": "gradle-reactive(true)-h2Disk-nativeSupport(true)-cacheProvider(no)",
"sample": "gradle-reactive(true)-h2Disk-nativeSupport(true)-cacheProvider(no)",
"os": "macos-15",
"node-version": "NODE-VERSION",
"java-version": "JAVA-VERSION",
"npm-version": "NPM-VERSION",
"default-environment": "prod",
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool gradle\\n reactive true\\n devDatabaseType h2Disk\\n nativeSupport true\\n }\\n}"
"jdl": "application {\\n config {\\n testFrameworks [cypress]\\n buildTool gradle\\n reactive true\\n devDatabaseType h2Disk\\n nativeSupport true\\n cacheProvider no\\n }\\n}"
}
]
}"
Expand Down
2 changes: 1 addition & 1 deletion .blueprint/github-build-matrix/samples/graalvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export const graalvmMatrix = Object.fromEntries(
{ devDatabaseType: ['h2Disk'], nativeSupport: [true], cacheProvider: ['no'] },
),
),
].map(([key, value]) => [key, { jdl: convertOptionsToJDL(value) }]),
].map(([key, value]) => [key, { os: 'macos-15', jdl: convertOptionsToJDL(value) }]),
);
8 changes: 4 additions & 4 deletions .github/workflows/generator-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: bin/jhipster.cjs github-build-matrix graalvm --event-name ${{ github.event_name }}
applications:
name: ${{ matrix.job-name }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ github.workspace }}/app
Expand Down Expand Up @@ -118,10 +118,10 @@ jobs:
- name: 'TESTS: backend'
id: backend
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 'true'
run: npm run ci:backend:test
run: npm run native-test --if-present
continue-on-error: ${{matrix.continue-on-backend-tests-error || false}}
timeout-minutes: 15
- run: npm run native-package
- run: npm run native-package-dev
if: steps.compare.outputs.equals != 'true'
id: packaging
timeout-minutes: 60
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
name: screenshots-${{ matrix.sample }}
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
if: always() && contains(matrix.os, 'ubuntu')
uses: jwalton/gh-docker-logs@v2

check-graalvm:
Expand Down
4 changes: 4 additions & 0 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Options:
--sync-user-with-idp Allow relationships with User for oauth2 applications
--message-broker <value> message broker (choices: "kafka", "pulsar", "no")
--database-migration <value> Database migration (choices: "liquibase")
--native-support GraalVM Native support
--with-generated-flag Add a GeneratedByJHipster annotation to all generated java classes and interfaces
--package-name <value> The package name for the generated application
--build <value> Provide build tool for the application when skipping server side generation (default: maven) (choices: "maven", "gradle")
Expand Down Expand Up @@ -628,6 +629,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"name": "English",
"rtl": false,
},
"nativeSupport": undefined,
"nodeDependencies": {
"@angular-architects/module-federation": "ANGULAR_ARCHITECTS_MODULE_FEDERATION_VERSION",
"@angular-architects/module-federation-runtime": "ANGULAR_ARCHITECTS_MODULE_FEDERATION_RUNTIME_VERSION",
Expand Down Expand Up @@ -1268,6 +1270,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"name": "English",
"rtl": false,
},
"nativeSupport": undefined,
"nodeDependencies": {
"@angular-architects/module-federation": "ANGULAR_ARCHITECTS_MODULE_FEDERATION_VERSION",
"@angular-architects/module-federation-runtime": "ANGULAR_ARCHITECTS_MODULE_FEDERATION_RUNTIME_VERSION",
Expand Down Expand Up @@ -1913,6 +1916,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"name": "English",
"rtl": false,
},
"nativeSupport": undefined,
"nodeDependencies": {
"concurrently": "CONCURRENTLY_VERSION",
"eslint-config-prettier": "ESLINT_CONFIG_PRETTIER_VERSION",
Expand Down
1 change: 1 addition & 0 deletions generators/jdl/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Options:
--sync-user-with-idp Allow relationships with User for oauth2 applications
--message-broker <value> message broker (choices: "kafka", "pulsar", "no")
--database-migration <value> Database migration (choices: "liquibase")
--native-support GraalVM Native support
--with-generated-flag Add a GeneratedByJHipster annotation to all generated java classes and interfaces
--package-name <value> The package name for the generated application
--build <value> Provide build tool for the application when skipping server side generation (default: maven) (choices: "maven", "gradle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exports[`generator - spring-boot:graalvm with default options should call source
"content": " <properties>
<repackage.classifier>exec</repackage.classifier>
<native-buildtools.version>'NATIVE-BUILD-TOOLS-VERSION'</native-buildtools.version>
<modernizer.skip>true</modernizer.skip>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -87,7 +88,7 @@ exports[`generator - spring-boot:graalvm with default options should call source
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand All @@ -100,14 +101,16 @@ exports[`generator - spring-boot:graalvm with default options should call source
</execution>
</executions>
<configuration>
<fallback>false</fallback>
<classesDirectory>\${project.build.outputDirectory}</classesDirectory>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<imageName>\${native-image-name}</imageName>
<buildArgs>
<buildArg>--no-fallback \${native-build-args}</buildArg>
</buildArgs>
<verbose>true</verbose>
<jvmArgs>
<arg>-Xmx10g</arg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -151,6 +154,7 @@ exports[`generator - spring-boot:graalvm with default options should call source
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
Expand All @@ -167,10 +171,6 @@ exports[`generator - spring-boot:graalvm with default options should call source
"property": "native-image-name",
"value": "native-executable",
},
{
"property": "native-build-args",
"value": "--verbose -J-Xmx10g",
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe(`generator - ${generator}`, () => {
.runJHipster(generator)
.withMockedJHipsterGenerators()
.withMockedSource()
.withOptions({ ignoreNeedlesError: true })
.withSharedApplication({})
.withJHipsterConfig({ buildTool });
});
Expand Down
16 changes: 15 additions & 1 deletion generators/spring-boot/generators/graalvm/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,22 @@ export default class GraalvmGenerator extends BaseApplicationGenerator {
this.packageJson.merge({
scripts: {
'native-e2e': 'concurrently -k -s first "npm run native-start" "npm run e2e:headless"',
'prenative-start': 'npm run services:up',
},
});
if (buildToolMaven) {
this.packageJson.merge({
scripts: {
//'native-test': './mvnw -B -Pnative,dev -Dagent test',
'native-package': './mvnw package -B -ntp -Pnative,prod -DskipTests',
'native-package-dev': 'SPRING_PROFILES_ACTIVE=dev ./mvnw package -B -ntp -Pnative,dev,webapp -DskipTests',
'native-start': './target/native-executable',
},
});
} else if (buildToolGradle) {
this.packageJson.merge({
scripts: {
'native-package': './gradlew nativeCompile -Pprod -x test -x integrationTest',
'native-package-dev': 'SPRING_PROFILES_ACTIVE=dev ./gradlew nativeCompile -Pdev -x test -x integrationTest',
'native-start': './build/native/nativeCompile/native-executable',
},
});
Expand Down Expand Up @@ -273,6 +275,18 @@ import org.springframework.security.oauth2.core.oidc.user.OidcUser;`,
),
);
},

e2e({ application }) {
if (!application.devDatabaseTypeH2Any || !application.clientTestFrameworksCypress) return;
this.editFile(`${application.cypressDir}e2e/administration/administration.cy.ts`, { assertModified: true }, contents =>
contents.replace("describe('/docs')", `describe.skip('/docs')`),
);
this.editFile(`${application.cypressDir}e2e/account/login-page.cy.ts`, { assertModified: true }, contents =>
contents
.replace("it('requires username')", `it.skip('requires username')`)
.replace("it('requires password')", `it.skip('requires password')`),
);
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ export const mavenDefinition = ({
nativeBuildToolsVersion?: string;
databaseTypeSql?: boolean;
}): MavenDefinition => ({
properties: [
{ property: 'repackage.classifier' },
{ property: 'native-image-name', value: 'native-executable' },
{ property: 'native-build-args', value: '--verbose -J-Xmx10g' },
],
properties: [{ property: 'repackage.classifier' }, { property: 'native-image-name', value: 'native-executable' }],
plugins: [
{
inProfile: 'prod',
Expand Down Expand Up @@ -117,7 +113,7 @@ export const mavenDefinition = ({
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand All @@ -130,14 +126,16 @@ export const mavenDefinition = ({
</execution>
</executions>
<configuration>
<fallback>false</fallback>
<classesDirectory>\${project.build.outputDirectory}</classesDirectory>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<imageName>\${native-image-name}</imageName>
<buildArgs>
<buildArg>--no-fallback \${native-build-args}</buildArg>
</buildArgs>
<verbose>true</verbose>
<jvmArgs>
<arg>-Xmx10g</arg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -181,6 +179,7 @@ export const mavenDefinition = ({
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
bootBuildImage {
builder = "paketobuildpacks/builder:tiny"
environment = [
"BP_NATIVE_IMAGE" : "true",
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS": "--no-fallback \${findProperty('nativeImageProperties') ?: ''}"
]
}

graalvmNative {
toolchainDetection = true
binaries {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ jhipster:
registry:
password: admin
<%_ } _%>
<%_ if (!applicationTypeMicroservice) { _%>
<%_ if (!applicationTypeMicroservice && !nativeSupport) { _%>
# CORS is only enabled by default with the "dev" profile
cors:
# Allow Ionic for JHipster by default (* no longer allowed in Spring Boot 2.4+)
Expand Down

0 comments on commit 10d5c03

Please sign in to comment.