Skip to content

Commit 0543ab1

Browse files
committed
liquibase: add spring-boot:liquibase and cleanup graalvm support
1 parent a372dd1 commit 0543ab1

File tree

14 files changed

+206
-234
lines changed

14 files changed

+206
-234
lines changed

generators/generate-blueprint/__snapshots__/generator.spec.ts.snap

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,21 @@ exports[`generator - generate-blueprint with all option should match snapshot 1`
12531253
"generators/spring-boot/generators/jwt/templates/template-file-spring-boot:jwt.ejs": {
12541254
"stateCleared": "modified",
12551255
},
1256+
"generators/spring-boot/generators/liquibase/command.js": {
1257+
"stateCleared": "modified",
1258+
},
1259+
"generators/spring-boot/generators/liquibase/generator.js": {
1260+
"stateCleared": "modified",
1261+
},
1262+
"generators/spring-boot/generators/liquibase/generator.spec.js": {
1263+
"stateCleared": "modified",
1264+
},
1265+
"generators/spring-boot/generators/liquibase/index.js": {
1266+
"stateCleared": "modified",
1267+
},
1268+
"generators/spring-boot/generators/liquibase/templates/template-file-spring-boot:liquibase.ejs": {
1269+
"stateCleared": "modified",
1270+
},
12561271
"generators/spring-boot/generators/oauth2/command.js": {
12571272
"stateCleared": "modified",
12581273
},

generators/generate-blueprint/internal/lookup-namespaces.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe('lookupGeneratorsNamespaces', () => {
106106
"spring-boot:data-neo4j",
107107
"spring-boot:data-relational",
108108
"spring-boot:jwt",
109+
"spring-boot:liquibase",
109110
"spring-boot:oauth2",
110111
"spring-boot:websocket",
111112
"spring-cloud",

generators/liquibase/generator.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import { getFKConstraintName, getUXConstraintName, prepareField as prepareServer
4949
import type { Entity as ServerEntity } from '../server/types.ts';
5050
import { prepareSqlApplicationProperties } from '../spring-boot/generators/data-relational/support/index.ts';
5151
import type { Application as SpringDataRelationalApplication } from '../spring-boot/generators/data-relational/types.ts';
52-
import type { Source as SpringBootSource } from '../spring-boot/index.ts';
5352

5453
import { addEntityFiles, fakeFiles, updateConstraintsFiles, updateEntityFiles, updateMigrateFiles } from './changelog-files.ts';
5554
import { liquibaseFiles } from './files.ts';
@@ -337,27 +336,6 @@ export default class LiquibaseGenerator<
337336
source.addTestLog?.({ name: 'liquibase', level: 'WARN' });
338337
source.addTestLog?.({ name: 'LiquibaseSchemaResolver', level: 'INFO' });
339338
},
340-
customizeApplicationProperties({ source, application }) {
341-
if (application.databaseTypeSql && !application.reactive) {
342-
(source as SpringBootSource).addApplicationPropertiesClass?.({
343-
propertyType: 'Liquibase',
344-
classStructure: { asyncStart: ['Boolean', 'true'] },
345-
});
346-
}
347-
},
348-
addDependencies({ application, source }) {
349-
if (application.springBoot4 && (application as SpringDataRelationalApplication).backendTypeSpringBoot) {
350-
source.addJavaDependencies?.([
351-
{
352-
groupId: 'org.springframework.boot',
353-
artifactId: 'spring-boot-starter-liquibase',
354-
exclusions: (application as SpringDataRelationalApplication).databaseTypeNeo4j
355-
? [{ groupId: 'org.springframework.boot', artifactId: 'spring-boot-starter-jdbc' }]
356-
: undefined,
357-
},
358-
]);
359-
}
360-
},
361339
customizeMaven({ source, application }) {
362340
if (!application.buildToolMaven || !this.injectBuildTool) return;
363341
if (!application.javaDependencies) {
@@ -495,9 +473,6 @@ export default class LiquibaseGenerator<
495473
}
496474

497475
if (application.databaseTypeNeo4j) {
498-
if (application.backendTypeSpringBoot && !application.springBoot4) {
499-
source.addMavenDependency?.([{ groupId: 'org.springframework', artifactId: 'spring-jdbc' }]);
500-
}
501476
source.addMavenDependency?.([
502477
{
503478
groupId: 'org.liquibase.ext',
@@ -562,22 +537,6 @@ export default class LiquibaseGenerator<
562537
});
563538
}
564539
},
565-
nativeHints({ source, application }) {
566-
if (!application.graalvmSupport) return;
567-
// Latest liquibase version supported by Reachability Repository is 4.23.0
568-
// Hints may be dropped if newer version is supported
569-
// https://github.com/oracle/graalvm-reachability-metadata/blob/master/metadata/org.liquibase/liquibase-core/index.json
570-
(source as SpringBootSource).addNativeHint!({
571-
resources: ['config/liquibase/**'],
572-
declaredConstructors: [
573-
'liquibase.database.LiquibaseTableNamesFactory.class',
574-
'liquibase.report.ShowSummaryGeneratorFactory.class',
575-
'liquibase.changelog.FastCheckService.class',
576-
'liquibase.changelog.visitor.ValidatingVisitorGeneratorFactory.class',
577-
],
578-
publicConstructors: ['liquibase.ui.LoggerUIService.class'],
579-
});
580-
},
581540
});
582541
}
583542

generators/liquibase/incremental-liquibase.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ const exceptMockedGenerators: (keyof GeneratorsByNamespace)[] = [
176176
'spring-boot',
177177
'jhipster:java:bootstrap',
178178
'jhipster:java:domain',
179-
'liquibase',
180179
'jhipster:spring-boot:data-relational',
180+
'jhipster:spring-boot:liquibase',
181+
'liquibase',
181182
];
182183

183184
describe('generator - app - --incremental-changelog', function () {
Lines changed: 1 addition & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,184 +1 @@
1-
[
2-
{
3-
"name": "liquibase.configuration.ConfiguredValueModifierFactory",
4-
"methods": [
5-
{ "name": "<init>", "parameterTypes": [] },
6-
{ "name": "<init>", "parameterTypes": ["liquibase.Scope"] }
7-
]
8-
},
9-
{
10-
"name": "liquibase.executor.ExecutorService",
11-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
12-
},
13-
{
14-
"name": "liquibase.change.ChangeFactory",
15-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
16-
},
17-
{
18-
"name": "liquibase.change.ColumnConfig",
19-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
20-
},
21-
{
22-
"name": "liquibase.change.core.CreateTableChange",
23-
"allPublicMethods": true,
24-
"allDeclaredMethods": true,
25-
"queryAllPublicMethods": true,
26-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
27-
},
28-
{
29-
"name": "liquibase.logging.mdc.MdcManagerFactory",
30-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
31-
},
32-
{
33-
"name": "liquibase.change.core.LoadDataColumnConfig",
34-
"queryAllPublicMethods": true,
35-
"allDeclaredMethods": true,
36-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
37-
},
38-
{
39-
"name": "liquibase.change.core.LoadDataChange",
40-
"queryAllPublicMethods": true,
41-
"allDeclaredMethods": true,
42-
"allPublicConstructors": true,
43-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
44-
},
45-
{
46-
"name": "liquibase.change.AbstractTableChange",
47-
"queryAllPublicMethods": true,
48-
"allDeclaredMethods": true,
49-
"allPublicConstructors": true
50-
},
51-
{
52-
"name": "liquibase.command.CommandFactory",
53-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
54-
},
55-
{
56-
"name": "liquibase.changelog.ChangeLogHistoryServiceFactory",
57-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
58-
},
59-
{
60-
"name": "liquibase.datatype.core.BigIntType",
61-
"allPublicMethods": true,
62-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
63-
},
64-
{
65-
"name": "liquibase.datatype.core.BlobType",
66-
"allPublicMethods": true,
67-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
68-
},
69-
{
70-
"name": "liquibase.datatype.core.BooleanType",
71-
"allPublicMethods": true,
72-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
73-
},
74-
{
75-
"name": "liquibase.datatype.core.CharType",
76-
"allPublicMethods": true,
77-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
78-
},
79-
{
80-
"name": "liquibase.datatype.core.ClobType",
81-
"allPublicMethods": true,
82-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
83-
},
84-
{
85-
"name": "liquibase.datatype.core.CurrencyType",
86-
"allPublicMethods": true,
87-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
88-
},
89-
{
90-
"name": "liquibase.datatype.core.DatabaseFunctionType",
91-
"allPublicMethods": true,
92-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
93-
},
94-
{
95-
"name": "liquibase.datatype.core.DateTimeType",
96-
"allPublicMethods": true,
97-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
98-
},
99-
{
100-
"name": "liquibase.datatype.core.DateType",
101-
"allPublicMethods": true,
102-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
103-
},
104-
{
105-
"name": "liquibase.datatype.core.DecimalType",
106-
"allPublicMethods": true,
107-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
108-
},
109-
{
110-
"name": "liquibase.datatype.core.DoubleType",
111-
"allPublicMethods": true,
112-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
113-
},
114-
{
115-
"name": "liquibase.datatype.core.FloatType",
116-
"allPublicMethods": true,
117-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
118-
},
119-
{
120-
"name": "liquibase.datatype.core.IntType",
121-
"allPublicMethods": true,
122-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
123-
},
124-
{
125-
"name": "liquibase.datatype.core.MediumIntType",
126-
"allPublicMethods": true,
127-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
128-
},
129-
{
130-
"name": "liquibase.datatype.core.NCharType",
131-
"allPublicMethods": true,
132-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
133-
},
134-
{
135-
"name": "liquibase.datatype.core.NumberType",
136-
"allPublicMethods": true,
137-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
138-
},
139-
{
140-
"name": "liquibase.datatype.core.NVarcharType",
141-
"allPublicMethods": true,
142-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
143-
},
144-
{
145-
"name": "liquibase.datatype.core.SmallIntType",
146-
"allPublicMethods": true,
147-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
148-
},
149-
{
150-
"name": "liquibase.datatype.core.TimestampType",
151-
"allPublicMethods": true,
152-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
153-
},
154-
{
155-
"name": "liquibase.datatype.core.TimeType",
156-
"allPublicMethods": true,
157-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
158-
},
159-
{
160-
"name": "liquibase.datatype.core.TinyIntType",
161-
"allPublicMethods": true,
162-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
163-
},
164-
{
165-
"name": "liquibase.datatype.core.UnknownType",
166-
"allPublicMethods": true,
167-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
168-
},
169-
{
170-
"name": "liquibase.datatype.core.UUIDType",
171-
"allPublicMethods": true,
172-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
173-
},
174-
{
175-
"name": "liquibase.datatype.core.VarcharType",
176-
"allPublicMethods": true,
177-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
178-
},
179-
{
180-
"name": "liquibase.datatype.core.XMLType",
181-
"allPublicMethods": true,
182-
"methods": [{ "name": "<init>", "parameterTypes": [] }]
183-
}
184-
]
1+
[]

generators/spring-boot/generators/data-neo4j/generator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import cleanupTask from './cleanup.ts';
2525
import writeEntitiesTask, { cleanupEntitiesTask } from './entity-files.ts';
2626
import writeTask from './files.ts';
2727

28-
const GENERATOR_LIQUIBASE = 'liquibase';
29-
3028
export default class Neo4jGenerator extends SpringBootApplicationGenerator {
3129
async beforeQueue() {
3230
if (!this.fromBlueprint) {
@@ -43,7 +41,7 @@ export default class Neo4jGenerator extends SpringBootApplicationGenerator {
4341
return this.asComposingTaskGroup({
4442
async composing() {
4543
if (this.jhipsterConfigWithDefaults.databaseMigration === 'liquibase') {
46-
await this.composeWithJHipster(GENERATOR_LIQUIBASE);
44+
await this.composeWithJHipster('jhipster:spring-boot:liquibase');
4745
}
4846
},
4947
});

generators/spring-boot/generators/data-relational/generator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ import type {
3636
Source as SpringDataRelationalSource,
3737
} from './types.ts';
3838

39-
const GENERATOR_LIQUIBASE = 'liquibase';
40-
4139
const { SQL } = databaseTypes;
4240

4341
export default class SqlGenerator extends BaseApplicationGenerator<
@@ -61,7 +59,7 @@ export default class SqlGenerator extends BaseApplicationGenerator<
6159
get composing() {
6260
return this.asComposingTaskGroup({
6361
async composing() {
64-
await this.composeWithJHipster(GENERATOR_LIQUIBASE);
62+
await this.composeWithJHipster('jhipster:spring-boot:liquibase');
6563
},
6664
});
6765
}

generators/spring-boot/generators/data-relational/sql-entities.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ describe(`generator - ${databaseType} - entities`, () => {
8484
it(`should ${enableTranslation ? '' : 'not '}compose with jhipster:languages`, () => {
8585
expect(runResult.getGeneratorComposeCount('jhipster:languages')).toBe(enableTranslation ? 1 : 0);
8686
});
87-
it('should compose with jhipster:liquibase', () => {
88-
runResult.assertGeneratorComposedOnce('jhipster:liquibase');
87+
it('should compose with jhipster:spring-boot:liquibase', () => {
88+
runResult.assertGeneratorComposedOnce('jhipster:spring-boot:liquibase');
8989
});
9090
it('should match generated files snapshot', () => {
9191
expect(runResult.getStateSnapshot()).toMatchSnapshot();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2+
3+
exports[`generator - spring-boot:liquibase with defaults options should call source snapshot 1`] = `
4+
{
5+
"addApplicationPropertiesClass": [
6+
{
7+
"classStructure": {
8+
"asyncStart": [
9+
"Boolean",
10+
"true",
11+
],
12+
},
13+
"propertyType": "Liquibase",
14+
},
15+
],
16+
"addJavaDependencies": [
17+
[
18+
{
19+
"artifactId": "spring-boot-starter-liquibase",
20+
"exclusions": undefined,
21+
"groupId": "org.springframework.boot",
22+
},
23+
],
24+
],
25+
}
26+
`;
27+
28+
exports[`generator - spring-boot:liquibase with defaults options should match files snapshot 1`] = `
29+
{
30+
".yo-rc.json": {
31+
"stateCleared": "modified",
32+
},
33+
}
34+
`;

0 commit comments

Comments
 (0)