Skip to content

Commit

Permalink
java: checksum adjusts (#28057)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Dec 3, 2024
1 parent 9705d01 commit 52a1732
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 132 deletions.
6 changes: 6 additions & 0 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ export default class AngularGenerator extends BaseApplicationGenerator {

application.addPrettierExtensions?.(['html', 'css', 'scss']);
},
async javaNodeBuildPaths({ application }) {
application.javaNodeBuildPaths?.push('angular.json', 'tsconfig.json', 'tsconfig.app.json');
if (application.clientBundlerWebpack) {
application.javaNodeBuildPaths?.push('webpack/');
}
},
addNeedles({ source, application }) {
source.addEntitiesToClient = param => {
this.addEntitiesToModule(param);
Expand Down
1 change: 1 addition & 0 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"xmemcached-provider": "'XMEMCACHED-PROVIDER-VERSION'",
},
"javaManagedProperties": {},
"javaNodeBuildPaths": [],
"javaPackageSrcDir": "src/main/java/com/mycompany/myapp/",
"javaPackageTestDir": "src/test/java/com/mycompany/myapp/",
"javaProperties": {},
Expand Down
1 change: 1 addition & 0 deletions generators/bootstrap-application-server/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class BoostrapApplicationServer extends BaseApplicationGenerator
applicationDefaults({
javaVersion: this.useVersionPlaceholders ? 'JAVA_VERSION' : JAVA_VERSION,
packageInfoJavadocs: [],
javaNodeBuildPaths: [],
javaProperties: {},
javaManagedProperties: {},
javaDependencies: ({ javaDependencies }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,65 +30,16 @@ if (project.hasProperty("nodeInstall")) {
<%_ if (!skipClient) { _%>
task webapp_test(type: NpmTask) {
inputs.property('appVersion', project.version)
inputs.files("package-lock.json")
.withPropertyName('package-lock')
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("build.gradle")
.withPropertyName('build.gradle')
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ if (clientFrameworkAngular) { _%>
inputs.files(<%- javaNodeBuildPaths.filter(file => !file.endsWith('/')).map(file => `'${file}'`).join(', ') %>)
.withPropertyName('angular-build')
.withPropertyName('<%= clientFramework %>-build')
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ for (const file of javaNodeBuildPaths.filter(file => file.endsWith('/'))) { _%>
<%_ for (const file of javaNodeBuildPaths.filter(file => file.endsWith('/'))) { _%>
inputs.dir("<%= file %>")
.withPropertyName("<%= file %>")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ } else { _%>
inputs.dir("<%= clientSrcDir %>")
.withPropertyName("webapp-source-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ if (clientFrameworkReact) { _%>
inputs.files("tsconfig.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
def webpackDevFiles = fileTree("<%= CLIENT_WEBPACK_DIR %>")
webpackDevFiles.exclude("webpack.prod.js")
inputs.files(webpackDevFiles)
.withPropertyName("webpack-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ if (clientFrameworkVue) { _%>
inputs.files("tsconfig.json", "tsconfig.app.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files(".postcssrc")
.withPropertyName("postcssrc")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ if (clientBundlerVite && clientFrameworkBuiltIn) { _%>
inputs.files("vite.config.mts")
.withPropertyName("vite")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ if (clientFrameworkVue) { _%>
<%_ if (clientBundlerWebpack) { _%>
def webpackDevFiles = fileTree("<%= CLIENT_WEBPACK_DIR %>")
webpackDevFiles.exclude("webpack.prod.js")
inputs.files(webpackDevFiles)
.withPropertyName("webpack-dir")
<%_ } _%>
<%_ if (microfrontend) { _%>
inputs.files("module-federation.config.cjs")
.withPropertyName("module-federation")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ } _%>
<%_ } _%>
outputs.dir("build/test-results/jest/")
Expand Down
35 changes: 5 additions & 30 deletions generators/java/generators/node/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,37 +52,12 @@ export default class NodeGenerator extends BaseApplicationGenerator {
get preparing() {
return this.asPreparingTaskGroup({
async javaNodeBuildPaths({ application }) {
application.javaNodeBuildPaths ??= [];
const {
clientBundlerVite,
clientBundlerWebpack,
clientFrameworkAngular,
clientFrameworkReact,
clientFrameworkVue,
clientFrameworkBuiltIn,
microfrontend,
srcMainWebapp,
javaNodeBuildPaths,
clientDistDir,
} = application;
const { buildToolMaven, srcMainWebapp, javaNodeBuildPaths, clientDistDir } = application;

javaNodeBuildPaths.push(srcMainWebapp, clientDistDir!, 'package-lock.json', 'package.json', 'tsconfig.json');
if (clientFrameworkAngular) {
javaNodeBuildPaths.push('angular.json', 'tsconfig.app.json');
} else if (clientFrameworkReact) {
javaNodeBuildPaths.push('.postcss.config.js');
} else if (clientFrameworkVue) {
javaNodeBuildPaths.push('.postcssrc.js', 'tsconfig.app.json');
if (microfrontend) {
javaNodeBuildPaths.push('module-federation.config.cjs');
}
}
if (clientFrameworkBuiltIn) {
if (clientBundlerWebpack) {
javaNodeBuildPaths.push('webpack/');
} else if (clientBundlerVite) {
javaNodeBuildPaths.push('vite.config.mts');
}
javaNodeBuildPaths.push(srcMainWebapp, 'package-lock.json', 'package.json');
if (buildToolMaven) {
// Gradle throws an error if the directory does not exist
javaNodeBuildPaths.push(clientDistDir!);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,10 @@ exports[`generator - maven:frontend-plugin with defaults options should call sou
<fileSet>
<directory>\${project.basedir}</directory>
<includes>
<include>angular.json</include>
<include>package-lock.json</include>
<include>package.json</include>
<include>src/main/webapp/**/*.*</include>
<include>target/classes/static/**/*.*</include>
<include>tsconfig.app.json</include>
<include>tsconfig.json</include>
<include>webpack/**/*.*</include>
</includes>
<excludes>
<exclude>**/app/**/service-worker.js</exclude>
Expand Down
8 changes: 8 additions & 0 deletions generators/react/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ export default class ReactGenerator extends BaseApplicationGenerator {
webappEnumerationsDir: app => `${app.clientSrcDir}app/shared/model/enumerations/`,
});
},
async javaNodeBuildPaths({ application }) {
const { clientBundlerWebpack, javaNodeBuildPaths } = application;

javaNodeBuildPaths?.push('.postcss.config.js', 'tsconfig.json');
if (clientBundlerWebpack) {
javaNodeBuildPaths?.push('webpack/');
}
},
prepareForTemplates({ application, source }) {
source.addWebpackConfig = args => {
const webpackPath = `${application.clientRootDir}webpack/webpack.common.js`;
Expand Down
53 changes: 6 additions & 47 deletions generators/spring-boot/templates/gradle/profile_dev.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -51,59 +51,18 @@ bootRun {
<%_ if (!skipClient) { _%>
task webapp(type: NpmTask) {
inputs.property('appVersion', project.version)
inputs.files("package-lock.json")
.withPropertyName('package-lock')
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("build.gradle")
.withPropertyName('build.gradle')
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ if (clientFrameworkAngular) { _%>
inputs.files("angular.json")
.withPropertyName('angular.json')
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("tsconfig.json", "tsconfig.app.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.dir("<%= CLIENT_WEBPACK_DIR %>")
.withPropertyName("<%= CLIENT_WEBPACK_DIR %>")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
inputs.dir("<%= clientSrcDir %>")
.withPropertyName("webapp-source-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ if (clientFrameworkReact) { _%>
inputs.files("tsconfig.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
def webpackDevFiles = fileTree("<%= CLIENT_WEBPACK_DIR %>")
webpackDevFiles.exclude("webpack.prod.js")
inputs.files(webpackDevFiles)
.withPropertyName("webpack-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ if (clientFrameworkVue) { _%>
inputs.files("tsconfig.json", "tsconfig.app.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files(".postcssrc")
.withPropertyName("postcssrc")
inputs.files(<%- javaNodeBuildPaths.filter(file => !file.endsWith('/')).map(file => `'${file}'`).join(', ') %>)
.withPropertyName('<%= clientFramework %>-build')
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ if (microfrontend) { _%>
def webpackDevFiles = fileTree("<%= CLIENT_WEBPACK_DIR %>")
webpackDevFiles.exclude("webpack.prod.js")
inputs.files(webpackDevFiles)
.withPropertyName("webpack-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } else { _%>
inputs.files("vite.config.ts")
.withPropertyName("vite")
<%_ for (const file of javaNodeBuildPaths.filter(file => file.endsWith('/'))) { _%>
inputs.dir("<%= file %>")
.withPropertyName("<%= file %>")
.withPathSensitivity(PathSensitivity.RELATIVE)
<%_ } _%>
<%_ } _%>
outputs.dir("<%= clientDistDir %>")
.withPropertyName("webapp-build-dir")
Expand Down
13 changes: 13 additions & 0 deletions generators/vue/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ export default class VueGenerator extends BaseApplicationGenerator {
webappEnumerationsDir: app => `${app.clientWebappDir}shared/model/enumerations/`,
});
},
async javaNodeBuildPaths({ application }) {
const { clientBundlerVite, clientBundlerWebpack, microfrontend, javaNodeBuildPaths } = application;

javaNodeBuildPaths?.push('.postcssrc.js', 'tsconfig.json', 'tsconfig.app.json');
if (microfrontend) {
javaNodeBuildPaths?.push('module-federation.config.cjs');
}
if (clientBundlerWebpack) {
javaNodeBuildPaths?.push('webpack/');
} else if (clientBundlerVite) {
javaNodeBuildPaths?.push('vite.config.mts');
}
},
prepareForTemplates({ application, source }) {
application.addPrettierExtensions?.(['html', 'vue', 'css', 'scss']);

Expand Down

0 comments on commit 52a1732

Please sign in to comment.