-
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2150 from antarus/feature/devtools
Update devtools to new module system
- Loading branch information
Showing
13 changed files
with
161 additions
and
334 deletions.
There are no files selected for viewing
23 changes: 8 additions & 15 deletions
23
...ter/lite/generator/server/springboot/devtools/application/DevToolsApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
package tech.jhipster.lite.generator.server.springboot.devtools.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import tech.jhipster.lite.generator.project.domain.Project; | ||
import tech.jhipster.lite.generator.server.springboot.devtools.domain.DevToolsService; | ||
import tech.jhipster.lite.generator.module.domain.JHipsterModule; | ||
import tech.jhipster.lite.generator.module.domain.properties.JHipsterModuleProperties; | ||
import tech.jhipster.lite.generator.server.springboot.devtools.domain.DevToolsModuleFactory; | ||
|
||
@Service | ||
public class DevToolsApplicationService { | ||
|
||
private final DevToolsService devToolsService; | ||
private final DevToolsModuleFactory devToolsFactory; | ||
|
||
public DevToolsApplicationService(DevToolsService devToolsService) { | ||
this.devToolsService = devToolsService; | ||
public DevToolsApplicationService() { | ||
devToolsFactory = new DevToolsModuleFactory(); | ||
} | ||
|
||
public void init(Project project) { | ||
devToolsService.init(project); | ||
} | ||
|
||
public void addSpringBootDevTools(Project project) { | ||
devToolsService.addSpringBootDevTools(project); | ||
} | ||
|
||
public void addProperties(Project project) { | ||
devToolsService.addProperties(project); | ||
public JHipsterModule buildModule(JHipsterModuleProperties properties) { | ||
return devToolsFactory.buildModule(properties); | ||
} | ||
} |
54 changes: 0 additions & 54 deletions
54
...tech/jhipster/lite/generator/server/springboot/devtools/domain/DevToolsDomainService.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
...tech/jhipster/lite/generator/server/springboot/devtools/domain/DevToolsModuleFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package tech.jhipster.lite.generator.server.springboot.devtools.domain; | ||
|
||
import static tech.jhipster.lite.generator.module.domain.JHipsterModule.*; | ||
|
||
import tech.jhipster.lite.error.domain.Assert; | ||
import tech.jhipster.lite.generator.module.domain.JHipsterModule; | ||
import tech.jhipster.lite.generator.module.domain.JHipsterSource; | ||
import tech.jhipster.lite.generator.module.domain.javadependency.GroupId; | ||
import tech.jhipster.lite.generator.module.domain.javaproperties.SpringProfile; | ||
import tech.jhipster.lite.generator.module.domain.properties.JHipsterModuleProperties; | ||
|
||
public class DevToolsModuleFactory { | ||
|
||
private static final GroupId SPRING_GROUP = groupId("org.springframework.boot"); | ||
|
||
private static final JHipsterSource SOURCE = from("server/springboot/devtools"); | ||
|
||
public JHipsterModule buildModule(JHipsterModuleProperties properties) { | ||
Assert.notNull("properties", properties); | ||
|
||
//@formatter:off | ||
JHipsterModuleBuilder builder = moduleBuilder(properties) | ||
.context() | ||
.packageName(properties.basePackage()) | ||
.put("applicationName", properties.projectBaseName() | ||
.capitalized()) | ||
.and(); | ||
//@formatter:on | ||
|
||
appendDependencies(builder); | ||
appendSpringProperties(builder); | ||
|
||
builder.documentation(documentationTitle("Dev tools"), SOURCE.append("devtools.md.mustache")); | ||
|
||
return builder.build(); | ||
} | ||
|
||
private void appendDependencies(JHipsterModuleBuilder builder) { | ||
builder.javaDependencies().add(SPRING_GROUP, artifactId("spring-boot-devtools")); | ||
} | ||
|
||
private void appendSpringProperties(JHipsterModuleBuilder builder) { | ||
builder | ||
.springMainProperties() | ||
.set(propertyKey("spring.devtools.livereload.enabled"), propertyValue("false")) | ||
.set(propertyKey("spring.devtools.restart.enabled"), propertyValue("false")); | ||
|
||
builder | ||
.springMainProperties(new SpringProfile("local")) | ||
.set(propertyKey("spring.devtools.livereload.enabled"), propertyValue("true")) | ||
.set(propertyKey("spring.devtools.restart.enabled"), propertyValue("true")); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
.../java/tech/jhipster/lite/generator/server/springboot/devtools/domain/DevToolsService.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...generator/server/springboot/devtools/infrastructure/config/DevToolsBeanConfiguration.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...erator/server/springboot/devtools/infrastructure/primary/DevToolsModuleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tech.jhipster.lite.generator.server.springboot.devtools.infrastructure.primary; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import tech.jhipster.lite.generator.module.domain.properties.JHipsterModulePropertiesDefinition; | ||
import tech.jhipster.lite.generator.module.infrastructure.primary.JHipsterModuleApiDoc; | ||
import tech.jhipster.lite.generator.module.infrastructure.primary.JHipsterModuleResource; | ||
import tech.jhipster.lite.generator.server.springboot.devtools.application.DevToolsApplicationService; | ||
|
||
@Configuration | ||
class DevToolsModuleConfiguration { | ||
|
||
@Bean | ||
JHipsterModuleResource devTools(DevToolsApplicationService devtools) { | ||
return JHipsterModuleResource | ||
.builder() | ||
.legacyUrl("/api/servers/spring-boot/technical-tools/devtools") | ||
.slug("springboot-devtools") | ||
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addProjectBaseName().addIndentation().build()) | ||
.apiDoc(new JHipsterModuleApiDoc("Spring Boot - Tools", "Add spring boot tools.")) | ||
.factory(devtools::buildModule); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...te/generator/server/springboot/devtools/infrastructure/primary/rest/DevToolsResource.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/main/resources/generator/server/springboot/devtools/devtools.md.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Introduction | ||
|
||
Add the spring dev tool and enable it in local profile. | ||
|
||
# How to use it | ||
|
||
[official documentation:](https://docs.spring.io/spring-boot/docs/2.7.x/reference/html/using.html#using.devtools) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Feature: Cucumber module | ||
|
||
Scenario: Should add devtools elements using legacy url | ||
When I apply legacy module "/api/servers/spring-boot/technical-tools/devtools" to default project with maven file | ||
Then I should have files in "documentation" | ||
| dev-tools.md | | ||
|
||
Scenario: Should get devtools module properties definition | ||
When I get module "springboot-devtools" properties definition | ||
Then I should have properties definitions | ||
| Key | Type | Mandatory | | ||
| packageName | STRING | true | | ||
| baseName | STRING | true | | ||
| prettierDefaultIndent | INTEGER | false | | ||
|
||
Scenario: Should add devtools elements using module url | ||
When I apply "springboot-devtools" module to default project with maven file | ||
| packageName | tech.jhipster.chips | | ||
| baseName | jhipster | | ||
Then I should have files in "documentation" | ||
| dev-tools.md | | ||
And I should have history entry for "springboot-devtools" |
102 changes: 0 additions & 102 deletions
102
...r/lite/generator/server/springboot/devtools/application/DevToolsApplicationServiceIT.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.