Skip to content

Commit

Permalink
Merge pull request #1742 from pascalgrimaud/prettier-format-gradle
Browse files Browse the repository at this point in the history
Fix prettier for Gradle folder
  • Loading branch information
pascalgrimaud authored May 16, 2022
2 parents fdb0b5a + fcfd843 commit 331f4dc
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ package-lock.json
.mvn
gradle
.gradle
!src/main/java/tech/jhipster/lite/generator/buildtool/gradle
!src/test/java/tech/jhipster/lite/generator/buildtool/gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package tech.jhipster.lite.generator.buildtool.gradle.domain;

import tech.jhipster.lite.common.domain.WordUtils;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.project.domain.ProjectFile;
import tech.jhipster.lite.generator.project.domain.ProjectRepository;

import static tech.jhipster.lite.common.domain.FileUtils.getPath;
import static tech.jhipster.lite.generator.project.domain.Constants.BUILD_GRADLE_KTS;
import static tech.jhipster.lite.generator.project.domain.Constants.SETTINGS_GRADLE_KTS;
Expand All @@ -13,6 +8,10 @@
import static tech.jhipster.lite.generator.project.domain.DefaultConfig.PROJECT_NAME;

import java.util.List;
import tech.jhipster.lite.common.domain.WordUtils;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.project.domain.ProjectFile;
import tech.jhipster.lite.generator.project.domain.ProjectRepository;

public class GradleDomainService implements GradleService {

Expand All @@ -36,8 +35,7 @@ public void addJavaBuildGradleKts(Project project) {
project.addDefaultConfig(PROJECT_NAME);
project.addDefaultConfig(BASE_NAME);

String baseName = project.getBaseName()
.orElse("");
String baseName = project.getBaseName().orElse("");
project.addConfig("dasherizedBaseName", WordUtils.kebabCase(baseName));

projectRepository.template(project, SOURCE, BUILD_GRADLE_KTS);
Expand All @@ -46,13 +44,17 @@ public void addJavaBuildGradleKts(Project project) {

@Override
public void addGradleWrapper(Project project) {
List<ProjectFile> files = Gradle.gradleWrapper()
.entrySet()
.stream()
.map(entry -> ProjectFile.forProject(project)
.withSource(getPath(SOURCE, entry.getValue()), entry.getKey())
.withDestinationFolder(entry.getValue()))
.toList();
List<ProjectFile> files = Gradle
.gradleWrapper()
.entrySet()
.stream()
.map(entry ->
ProjectFile
.forProject(project)
.withSource(getPath(SOURCE, entry.getValue()), entry.getKey())
.withDestinationFolder(entry.getValue())
)
.toList();

projectRepository.add(files);
projectRepository.setExecutable(project, "", "gradlew");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import tech.jhipster.lite.generator.project.domain.Project;

public interface GradleService {

void initJava(Project project);

void addJavaBuildGradleKts(Project project);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package tech.jhipster.lite.generator.buildtool.gradle.application;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import tech.jhipster.lite.IntegrationTest;
import tech.jhipster.lite.generator.project.domain.Project;

import static tech.jhipster.lite.TestUtils.assertFileContent;
import static tech.jhipster.lite.TestUtils.tmpProject;
import static tech.jhipster.lite.generator.buildtool.gradle.application.GradleAssertFiles.assertFilesGradle;
import static tech.jhipster.lite.generator.project.domain.Constants.BUILD_GRADLE_KTS;
import static tech.jhipster.lite.generator.project.domain.Constants.SETTINGS_GRADLE_KTS;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import tech.jhipster.lite.IntegrationTest;
import tech.jhipster.lite.generator.project.domain.Project;

@IntegrationTest
class GradleApplicationServiceIT {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package tech.jhipster.lite.generator.buildtool.gradle.application;

import tech.jhipster.lite.common.domain.FileUtils;
import tech.jhipster.lite.generator.project.domain.Project;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;
import java.util.Set;

import static org.assertj.core.api.Assertions.assertThat;
import static tech.jhipster.lite.TestUtils.assertFileExist;
import static tech.jhipster.lite.common.domain.FileUtils.getPathOf;
import static tech.jhipster.lite.generator.project.domain.Constants.BUILD_GRADLE_KTS;
import static tech.jhipster.lite.generator.project.domain.Constants.SETTINGS_GRADLE_KTS;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;
import java.util.Set;
import tech.jhipster.lite.common.domain.FileUtils;
import tech.jhipster.lite.generator.project.domain.Project;

public class GradleAssertFiles {

public static void assertFilesBuildGradleKts(Project project) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package tech.jhipster.lite.generator.buildtool.gradle.infrastructure.config;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import tech.jhipster.lite.IntegrationTest;
import tech.jhipster.lite.generator.buildtool.gradle.domain.GradleDomainService;

import static org.assertj.core.api.Assertions.assertThat;

@IntegrationTest
class GradleBeanConfigurationIT {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
package tech.jhipster.lite.generator.buildtool.gradle.infrastructure.primary.rest;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import tech.jhipster.lite.IntegrationTest;
import tech.jhipster.lite.TestUtils;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.project.infrastructure.primary.dto.ProjectDTO;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static tech.jhipster.lite.TestUtils.assertFileContent;
Expand All @@ -21,6 +11,16 @@
import static tech.jhipster.lite.generator.project.domain.Constants.BUILD_GRADLE_KTS;
import static tech.jhipster.lite.generator.project.domain.Constants.SETTINGS_GRADLE_KTS;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import tech.jhipster.lite.IntegrationTest;
import tech.jhipster.lite.TestUtils;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.project.infrastructure.primary.dto.ProjectDTO;

@IntegrationTest
@AutoConfigureMockMvc
class GradleResourceIT {
Expand Down

0 comments on commit 331f4dc

Please sign in to comment.