Skip to content

Commit

Permalink
Merge pull request #413 from mshima/modularize-entity-templates
Browse files Browse the repository at this point in the history
Modularize entity templates
  • Loading branch information
DanielFran authored Jul 31, 2024
2 parents b1f1fd7 + cbf6e7c commit ada11d9
Show file tree
Hide file tree
Showing 43 changed files with 439 additions and 139 deletions.
24 changes: 0 additions & 24 deletions generators/migration/__snapshots__/generator.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,8 @@

exports[`SubGenerator migration of kotlin JHipster blueprint > run > should succeed 1`] = `
{
".mvn/jvm.config": {
"stateCleared": "modified",
},
".mvn/wrapper/maven-wrapper.jar": {
"stateCleared": "modified",
},
".mvn/wrapper/maven-wrapper.properties": {
"stateCleared": "modified",
},
".yo-rc.json": {
"stateCleared": "modified",
},
"mvnw": {
"stateCleared": "modified",
},
"mvnw.cmd": {
"stateCleared": "modified",
},
"pom.xml": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/GeneratedByJHipster.java": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/package-info.java": {
"stateCleared": "modified",
},
}
`;
28 changes: 19 additions & 9 deletions generators/migration/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ import BaseApplicationGenerator from 'generator-jhipster/generators/base-applica
import { passthrough } from '@yeoman/transform';

export default class extends BaseApplicationGenerator {
async beforeQueue() {
await this.dependsOnJHipster('jhipster:java:build-tool');
}

get [BaseApplicationGenerator.PREPARING]() {
return this.asPreparingTaskGroup({
async source({ application, source }) {
if (application.buildToolGradle) {
// Add a noop needles for spring-gateway generator
source.addJavaDefinition = () => {};
source.addJavaDependencies = () => {};
}
this.queueTask({
method: () => {
source.addAllowBlockingCallsInside = () => undefined;
source.addApplicationPropertiesContent = () => undefined;
source.addIntegrationTestAnnotation = () => undefined;
source.addTestSpringFactory = () => undefined;

if (application.buildToolGradle) {
// Add a noop needles for spring-gateway generator
source.addJavaDefinition = () => {};
source.addJavaDependencies = () => {};
}
},
taskName: `${this.runningState.methodName}(delayed)`,
queueName: this.runningState.queueName,
});
},
});
}
Expand Down Expand Up @@ -56,6 +63,9 @@ export default class extends BaseApplicationGenerator {
}
},
async postWritingTemplateTask({ application }) {
this.editFile('src/main/resources/logback-spring.xml', contents => contents.replaceAll('jakarta.', 'javax.'));
this.editFile('src/test/resources/logback.xml', contents => contents.replaceAll('jakarta.', 'javax.'));

if (application.buildToolGradle) {
// JHipster 8 have needles fixed
this.editFile('build.gradle', contents => contents.replaceAll('//jhipster', '// jhipster'));
Expand Down
3 changes: 3 additions & 0 deletions generators/spring-boot/__snapshots__/generator.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ exports[`SubGenerator kotlin of kotlin JHipster blueprint > run > should succeed
"src/test/kotlin/com/mycompany/myapp/config/timezone/HibernateTimeZoneIT.kt": {
"stateCleared": "modified",
},
"src/test/kotlin/com/mycompany/myapp/domain/AuthorityTest.kt": {
"stateCleared": "modified",
},
"src/test/kotlin/com/mycompany/myapp/management/SecurityMetersServiceTests.kt": {
"stateCleared": "modified",
},
Expand Down
Loading

0 comments on commit ada11d9

Please sign in to comment.