Skip to content

Commit

Permalink
Move load domains logic to java generator and make relational depend …
Browse files Browse the repository at this point in the history
…on server (#25392)

* modify spring-data-relational spec to run server generator

fixes #25391

* modify spring-data-relational spec to run server generator

fixes #25391

* add spring-boot dependency to spring-data-relational & refactor default priority

* refactor spring-data-relation dependency

* Apply suggestions from code review

* drop load domains from server

---------

Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
  • Loading branch information
dwarakaprasad and mshima committed Mar 7, 2024
1 parent 3e8aaf9 commit e35acfb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
5 changes: 5 additions & 0 deletions generators/java/generator.ts
Expand Up @@ -185,6 +185,11 @@ export default class JavaGenerator extends BaseApplicationGenerator<GeneratorDef
);
}
},
loadDomains({ application, entities }) {
(application as any).domains = [
...new Set([application.packageName, ...entities.map(entity => (entity as any).entityAbsolutePackage).filter(Boolean)]),
];
},
});
}

Expand Down
5 changes: 0 additions & 5 deletions generators/server/generator.js
Expand Up @@ -561,11 +561,6 @@ export default class JHipsterServerGenerator extends BaseApplicationGenerator {
);
}
},
loadDomains({ application, entities }) {
application.domains = [
...new Set([application.packageName, ...entities.map(entity => entity.entityAbsolutePackage).filter(Boolean)]),
];
},

insight({ application }) {
statistics.sendSubGenEvent('generator', GENERATOR_SERVER, {
Expand Down
4 changes: 2 additions & 2 deletions generators/spring-data-relational/generator.ts
Expand Up @@ -18,7 +18,7 @@
*/

import BaseApplicationGenerator from '../base-application/index.js';
import { GENERATOR_SPRING_DATA_RELATIONAL, GENERATOR_BOOTSTRAP_APPLICATION, GENERATOR_LIQUIBASE } from '../generator-list.js';
import { GENERATOR_SPRING_DATA_RELATIONAL, GENERATOR_LIQUIBASE, GENERATOR_SERVER } from '../generator-list.js';
import writeTask from './files.js';
import cleanupTask from './cleanup.js';
import writeEntitiesTask, { cleanupEntitiesTask } from './entity-files.js';
Expand All @@ -45,7 +45,7 @@ export default class SqlGenerator extends BaseApplicationGenerator<SpringBootGen
}

if (!this.delegateToBlueprint) {
await this.dependsOnJHipster(GENERATOR_BOOTSTRAP_APPLICATION);
await this.dependsOnJHipster(GENERATOR_SERVER);
}
}

Expand Down
28 changes: 28 additions & 0 deletions test-integration/generate-blueprint-samples/default/.yo-rc.json
Expand Up @@ -128,6 +128,34 @@
],
"sbs": false,
"written": true
},
"spring-data-relational": {
"command": true,
"priorities": [
"initializing",
"prompting",
"configuring",
"composing",
"loading",
"preparing",
"configuringEachEntity",
"loadingEntities",
"preparingEachEntity",
"preparingEachEntityField",
"preparingEachEntityRelationship",
"postPreparingEachEntity",
"default",
"writing",
"writingEntities",
"postWriting",
"postWritingEntities",
"loadingTranslations",
"install",
"postInstall",
"end"
],
"sbs": false,
"written": true
}
},
"jhipsterVersion": "7.5.0",
Expand Down

0 comments on commit e35acfb

Please sign in to comment.