Skip to content

Commit

Permalink
Merge pull request #2249 from DamnClin/not-templatized-file-batch
Browse files Browse the repository at this point in the history
Allow not templatized files in batch
  • Loading branch information
pascalgrimaud authored Jun 28, 2022
2 parents 4b633cc + a5578ad commit 9b75cf5
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,38 @@ public JHipsterModule buildVueModule(JHipsterModuleProperties properties) {
.add(SOURCE.file("vite.config.ts"), to("vite.config.ts"))
.add(SOURCE.template("webapp/app/http/AxiosHttp.ts.mustache"), MAIN_DESTINATION.append("http/AxiosHttp.ts"))
.batch(SOURCE.file("test/spec/http"), to("src/test/javascript/spec/http"))
.add("AxiosHttp.spec.ts")
.add("AxiosHttpStub.ts")
.add("AxiosStub.ts")
.template("AxiosHttp.spec.ts")
.template("AxiosHttpStub.ts")
.template("AxiosStub.ts")
.and()
.add(SOURCE.template("webapp/index.html"), to("src/main/webapp/index.html"))
.batch(SOURCE.append("webapp/app"), MAIN_DESTINATION)
.add("env.d.ts")
.add("main.ts")
.template("env.d.ts")
.template("main.ts")
.and()
.batch(COMMON_PRIMARY_SOURCE.append("app"), MAIN_PRIMARY_DESTINATION.append("app"))
.add("App.component.ts")
.add("App.html")
.add("App.vue")
.add("index.ts")
.template("App.component.ts")
.template("App.html")
.template("App.vue")
.template("index.ts")
.and()
.batch(IMAGE_SOURCE, to("src/main/webapp/content/images"))
.file("JHipster-Lite-neon-green.png")
.file("VueLogo.png")
.and()
.add(IMAGE_SOURCE.file("JHipster-Lite-neon-green.png"), to("src/main/webapp/content/images/JHipster-Lite-neon-green.png"))
.add(IMAGE_SOURCE.file("VueLogo.png"), to("src/main/webapp/content/images/VueLogo.png"))
.add(COMMON_PRIMARY_TEST_SOURCE.template("app/App.spec.ts"), COMMON_PRIMARY_TEST_DESTINATION.append("app/App.spec.ts"))
.batch(COMMON_PRIMARY_SOURCE.append("homepage"), MAIN_PRIMARY_DESTINATION.append("homepage"))
.add("Homepage.component.ts")
.add("Homepage.html")
.add("Homepage.vue")
.add("index.ts")
.template("Homepage.component.ts")
.template("Homepage.html")
.template("Homepage.vue")
.template("index.ts")
.and()
.add(COMMON_PRIMARY_TEST_SOURCE.template("homepage/Homepage.spec.ts"), COMMON_PRIMARY_TEST_DESTINATION.append("homepage/Homepage.spec.ts"))
.add(SOURCE.template("webapp/app/router/router.ts"), MAIN_DESTINATION.append("router/router.ts"))
.add(SOURCE.template("test/spec/router/Router.spec.ts"), to("src/test/javascript/spec/router/Router.spec.ts"))
.batch(SOURCE.append("webapp/app/common/domain"), MAIN_DESTINATION.append("common/domain"))
.add("Logger.ts")
.add("Message.ts")
.template("Logger.ts")
.template("Message.ts")
.and()
.add(SOURCE.template("webapp/app/common/secondary/ConsoleLogger.ts"), MAIN_DESTINATION.append("common/secondary/ConsoleLogger.ts"))
.add(SOURCE.template("test/spec/common/domain/Logger.fixture.ts"), to("src/test/javascript/spec/common/domain/Logger.fixture.ts"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ private JHipsterModuleFileBatchBuilder(JHipsterSource source, JHipsterDestinatio
this.files = files;
}

public JHipsterModuleFileBatchBuilder add(String file) {
files.add(source.template(file), destination.append(file));
public JHipsterModuleFileBatchBuilder template(String file) {
return add(source.template(file), destination.append(file));
}

public JHipsterModuleFileBatchBuilder file(String file) {
return add(source.file(file), destination.append(file));
}

private JHipsterModuleFileBatchBuilder add(JHipsterSource source, JHipsterDestination destination) {
files.add(source, destination);

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,30 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.documentation(documentationTitle("Assertions"), SOURCE.template("assertions.md"))
.files()
.batch(SOURCE, mainDestination)
.add("BusinessContext.java")
.add("SharedKernel.java")
.template("BusinessContext.java")
.template("SharedKernel.java")
.and()
.batch(SOURCE, mainDestination.append(Destination.ERROR_DOMAIN.path()))
.add("Assert.java")
.add("MissingMandatoryValueException.java")
.add("AssertionException.java")
.add("NotAfterTimeException.java")
.add("NotBeforeTimeException.java")
.add("NullElementInCollectionException.java")
.add("NumberValueTooHighException.java")
.add("NumberValueTooLowException.java")
.add("StringTooLongException.java")
.add("StringTooShortException.java")
.add("TooManyElementsException.java")
.template("Assert.java")
.template("MissingMandatoryValueException.java")
.template("AssertionException.java")
.template("NotAfterTimeException.java")
.template("NotBeforeTimeException.java")
.template("NullElementInCollectionException.java")
.template("NumberValueTooHighException.java")
.template("NumberValueTooLowException.java")
.template("StringTooLongException.java")
.template("StringTooShortException.java")
.template("TooManyElementsException.java")
.and()
.batch(SOURCE, testDestination.append(Destination.ERROR_DOMAIN.path()))
.add("AssertTest.java")
.add("MissingMandatoryValueExceptionTest.java")
.template("AssertTest.java")
.template("MissingMandatoryValueExceptionTest.java")
.and()
.batch(SOURCE, testDestination)
.add("UnitTest.java")
.add("ComponentTest.java")
.add("ReplaceCamelCase.java")
.template("UnitTest.java")
.template("ComponentTest.java")
.template("ReplaceCamelCase.java")
.and()
.add(SOURCE.template("package-info-error.java"), packageInfoDestination(mainDestination, Destination.ERROR))
.add(SOURCE.template("package-info-common.java"), packageInfoDestination(mainDestination, Destination.COMMON))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.documentation(documentationTitle("Cucumber"), SOURCE.template("cucumber.md"))
.files()
.batch(SOURCE, destination)
.add("AsyncElementAsserter.java")
.add("AsyncHeaderAsserter.java")
.add("AsyncResponseAsserter.java")
.add("Awaiter.java")
.add("CucumberAssertions.java")
.add("CucumberConfiguration.java")
.add("CucumberJson.java")
.add("CucumberTest.java")
.add("CucumberTestContext.java")
.add("CucumberTestContextUnitTest.java")
.add("ElementAsserter.java")
.add("ElementAssertions.java")
.add("HeaderAsserter.java")
.add("HeaderAssertions.java")
.add("ResponseAsserter.java")
.add("SyncElementAsserter.java")
.add("SyncHeaderAsserter.java")
.add("SyncResponseAsserter.java")
.template("AsyncElementAsserter.java")
.template("AsyncHeaderAsserter.java")
.template("AsyncResponseAsserter.java")
.template("Awaiter.java")
.template("CucumberAssertions.java")
.template("CucumberConfiguration.java")
.template("CucumberJson.java")
.template("CucumberTest.java")
.template("CucumberTestContext.java")
.template("CucumberTestContextUnitTest.java")
.template("ElementAsserter.java")
.template("ElementAssertions.java")
.template("HeaderAsserter.java")
.template("HeaderAssertions.java")
.template("ResponseAsserter.java")
.template("SyncElementAsserter.java")
.template("SyncHeaderAsserter.java")
.template("SyncResponseAsserter.java")
.and()
.add(SOURCE.file("gitkeep"), to("src/test/features/.gitkeep"))
.and()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,40 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.files()
.add(ACCOUNT_MAIN_SOURCE.append(APPLICATION).template("AccountsApplicationService.java"), accountMainDestination.append(APPLICATION).append("AccountsApplicationService.java"))
.batch(ACCOUNT_MAIN_SOURCE.append(DOMAIN), accountMainDestination.append(DOMAIN))
.add("Account.java")
.add("AccountsRepository.java")
.template("Account.java")
.template("AccountsRepository.java")
.and()
.batch(ACCOUNT_MAIN_SOURCE.append(PRIMARY), accountMainDestination.append(PRIMARY))
.add("RestAccount.java")
.add("AccountsResource.java")
.template("RestAccount.java")
.template("AccountsResource.java")
.and()
.batch(ACCOUNT_MAIN_SOURCE.append(SECONDARY), accountMainDestination.append(SECONDARY))
.add("OAuth2AccountsRepository.java")
.add("OAuth2AuthenticationReader.java")
.add("UnknownAuthenticationSchemeException.java")
.template("OAuth2AccountsRepository.java")
.template("OAuth2AuthenticationReader.java")
.template("UnknownAuthenticationSchemeException.java")
.and()
.add(ACCOUNT_MAIN_SOURCE.template(PACKAGE_INFO), accountMainDestination.append(PACKAGE_INFO))
.add(ACCOUNT_TEST_SOURCE.append(DOMAIN).template("AccountsFixture.java"), accountTestDestination.append(DOMAIN).append("AccountsFixture.java"))
.batch(ACCOUNT_TEST_SOURCE.append(PRIMARY), accountTestDestination.append(PRIMARY))
.add("RestAccountTest.java")
.add("AccountsResourceIntTest.java")
.add("AccountsResourceTest.java")
.template("RestAccountTest.java")
.template("AccountsResourceIntTest.java")
.template("AccountsResourceTest.java")
.and()
.add(ACCOUNT_TEST_SOURCE.append(SECONDARY).template("OAuth2AuthenticationReaderTest.java"), accountTestDestination.append(SECONDARY).append("OAuth2AuthenticationReaderTest.java"))
.add(ACCOUNT_TEST_SOURCE.append(INFRASTRUCTURE).template("OAuth2TokenFixture.java"), accountTestDestination.append(INFRASTRUCTURE).append("OAuth2TokenFixture.java"))
.batch(USER_IDENTITY_MAIN_SOURCE.append(DOMAIN), userIdentityMainDestination.append(DOMAIN))
.add("Email.java")
.add("Firstname.java")
.add("Lastname.java")
.add("Name.java")
.template("Email.java")
.template("Firstname.java")
.template("Lastname.java")
.template("Name.java")
.and()
.add(USER_IDENTITY_MAIN_SOURCE.template(PACKAGE_INFO), userIdentityMainDestination.append(PACKAGE_INFO))
.batch(USER_IDENTITY_TEST_SOURCE.append(DOMAIN), userIdentityTestDestination.append(DOMAIN))
.add("EmailTest.java")
.add("FirstnameTest.java")
.add("LastnameTest.java")
.add("NameTest.java")
.add("UsersIdentitiesFixture.java")
.template("EmailTest.java")
.template("FirstnameTest.java")
.template("LastnameTest.java")
.template("NameTest.java")
.template("UsersIdentitiesFixture.java")
.and()
.and()
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private void appendKeycloak(JHipsterModuleBuilder builder) {
.files()
.add(DOCKER_SOURCE.template("keycloak.yml"), DOCKER_DESTINATION.append("keycloak.yml"))
.batch(DOCKER_SOURCE, DOCKER_DESTINATION.append("keycloak-realm-config"))
.add("jhipster-realm.json")
.add("jhipster-users-0.json");
.template("jhipster-realm.json")
.template("jhipster-users-0.json");
}

private void appendJavaFiles(JHipsterModuleBuilder builder, JHipsterModuleProperties properties) {
Expand All @@ -81,43 +81,43 @@ private void appendJavaFiles(JHipsterModuleBuilder builder, JHipsterModuleProper
.files()
.add(MAIN_SOURCE.template("package-info.java"), mainDestination.append("package-info.java"))
.batch(MAIN_SOURCE.append(DOMAIN), mainDestination.append(DOMAIN))
.add("Role.java")
.add("Roles.java")
.add("Username.java")
.template("Role.java")
.template("Roles.java")
.template("Username.java")
.and()
.batch(MAIN_SOURCE.append(PRIMARY), mainDestination.append(PRIMARY))
.add("ApplicationSecurityProperties.java")
.add("AudienceValidator.java")
.add("AuthenticatedUser.java")
.add("AuthenticationException.java")
.add("AuthenticationExceptionAdvice.java")
.add("Claims.java")
.add("CustomClaimConverter.java")
.add("JwtGrantedAuthorityConverter.java")
.add("NotAuthenticatedUserException.java")
.add("OAuth2Configuration.java")
.add("SecurityConfiguration.java")
.add("UnknownAuthenticationException.java")
.template("ApplicationSecurityProperties.java")
.template("AudienceValidator.java")
.template("AuthenticatedUser.java")
.template("AuthenticationException.java")
.template("AuthenticationExceptionAdvice.java")
.template("Claims.java")
.template("CustomClaimConverter.java")
.template("JwtGrantedAuthorityConverter.java")
.template("NotAuthenticatedUserException.java")
.template("OAuth2Configuration.java")
.template("SecurityConfiguration.java")
.template("UnknownAuthenticationException.java")
.and()
.batch(TEST_SOURCE.append(DOMAIN), testDestination.append(DOMAIN))
.add("RolesTest.java")
.add("RoleTest.java")
.add("UsernameTest.java")
.template("RolesTest.java")
.template("RoleTest.java")
.template("UsernameTest.java")
.and()
.batch(TEST_SOURCE.append(PRIMARY), testDestination.append(PRIMARY))
.add("AccountExceptionResource.java")
.add("ApplicationSecurityPropertiesTest.java")
.add("AudienceValidatorTest.java")
.add("AuthenticatedUserTest.java")
.add("AuthenticationExceptionAdviceIT.java")
.add("ClaimsTest.java")
.add("CustomClaimConverterIT.java")
.add("FakeRequestAttributes.java")
.add("JwtGrantedAuthorityConverterTest.java")
.add("SecurityConfigurationIT.java")
.add("SecurityConfigurationTest.java")
.add("TestSecurityConfiguration.java")
.add("WithUnauthenticatedMockUser.java");
.template("AccountExceptionResource.java")
.template("ApplicationSecurityPropertiesTest.java")
.template("AudienceValidatorTest.java")
.template("AuthenticatedUserTest.java")
.template("AuthenticationExceptionAdviceIT.java")
.template("ClaimsTest.java")
.template("CustomClaimConverterIT.java")
.template("FakeRequestAttributes.java")
.template("JwtGrantedAuthorityConverterTest.java")
.template("SecurityConfigurationIT.java")
.template("SecurityConfigurationTest.java")
.template("TestSecurityConfiguration.java")
.template("WithUnauthenticatedMockUser.java");
//@formatter:on
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static JHipsterModule module() {
.files()
.add(from("init/gitignore"), to(".gitignore"))
.batch(from("server/javatool/base"), to("src/main/java/com/company/myapp/errors"))
.add("Assert.java.mustache")
.add("AssertionException.java.mustache")
.template("Assert.java.mustache")
.template("AssertionException.java.mustache")
.and()
.add(from("server/springboot/core/MainApp.java.mustache"), to("src/main/java/com/company/myapp/MyApp.java"))
.add(from("init/README.md.mustache"), to("README.md"))
Expand Down

0 comments on commit 9b75cf5

Please sign in to comment.