-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
305 additions
and
373 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
generators/gradle/generators/code-quality/__snapshots__/generator.spec.ts.snap
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,135 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`generator - gradle:code-quality with gradle build tool should match files snapshot 1`] = ` | ||
{ | ||
"build.gradle": { | ||
"contents": " | ||
dependencies { | ||
// jhipster-needle-gradle-dependency | ||
} | ||
plugins { | ||
id "jhipster.code-quality-conventions" | ||
// jhipster-needle-gradle-plugins | ||
} | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/build.gradle": { | ||
"contents": "plugins { | ||
id 'groovy-gradle-plugin' | ||
} | ||
repositories { | ||
gradlePluginPortal() | ||
} | ||
dependencies { | ||
implementation libs.modernizer.plugin | ||
implementation libs.nohttp.plugin | ||
implementation libs.sonarqube.plugin | ||
implementation libs.spotless.plugin | ||
// jhipster-needle-gradle-dependency - JHipster will add additional dependencies for convention plugins here | ||
// jhipster-needle-gradle-build-src-dependency - Deprecated: JHipster will add additional dependencies for convention plugins here | ||
} | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/gradle/libs.versions.toml": { | ||
"contents": "[versions] | ||
checkstyle = "'CHECKSTYLE-VERSION'" | ||
# jhipster-needle-gradle-dependency-catalog-version - JHipster will add additional versions for convention plugins heref | ||
# jhipster-needle-gradle-build-src-dependency-catalog-version - Deprecated: JHipster will add additional versions for convention plugins here | ||
[libraries] | ||
modernizer-plugin = { module = "com.github.andygoossens:gradle-modernizer-plugin", version = "'GRADLE-MODERNIZER-PLUGIN-VERSION'" } | ||
nohttp-plugin = { module = "io.spring.nohttp:nohttp-gradle", version = "'NOHTTP-CHECKSTYLE-VERSION'" } | ||
sonarqube-plugin = { module = "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin", version = "'GRADLE-SONARQUBE-VERSION'" } | ||
spotless-plugin = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "'SPOTLESS-GRADLE-PLUGIN-VERSION'" } | ||
# jhipster-needle-gradle-dependency-catalog-libraries - JHipster will add additional libraries versions | ||
[plugins] | ||
# jhipster-needle-gradle-dependency-catalog-plugins - JHipster will add additional plugins versions | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/src/main/groovy/jhipster.code-quality-conventions.gradle": { | ||
"contents": "plugins { | ||
id "jacoco" | ||
id "org.sonarqube" | ||
id "com.diffplug.spotless" | ||
id "com.github.andygoossens.gradle-modernizer-plugin" | ||
id "io.spring.nohttp" | ||
} | ||
jacoco { | ||
toolVersion = "\${libs.versions.jacoco.get()}" | ||
} | ||
jacocoTestReport { | ||
executionData tasks.withType(Test) | ||
classDirectories.from = files(sourceSets.main.output.classesDirs) | ||
sourceDirectories.from = files(sourceSets.main.java.srcDirs) | ||
reports { | ||
xml.required = true | ||
} | ||
} | ||
file("sonar-project.properties").withReader { | ||
Properties sonarProperties = new Properties() | ||
sonarProperties.load(it) | ||
sonarProperties.each { key, value -> | ||
sonarqube { | ||
properties { | ||
property key, value | ||
} | ||
} | ||
} | ||
} | ||
spotless { | ||
java { | ||
target 'src/*/java/**/*.java' | ||
// removeUnusedImports() | ||
} | ||
} | ||
modernizer { | ||
failOnViolations = true | ||
includeTestClasses = true | ||
} | ||
checkstyle { | ||
toolVersion "\${libs.versions.checkstyle.get()}" | ||
configFile file("checkstyle.xml") | ||
checkstyleTest.enabled = false | ||
} | ||
nohttp { | ||
source.include "build.gradle", "README.md" | ||
} | ||
// workaround for https://github.com/checkstyle/checkstyle/issues/14123 | ||
configurations.checkstyle { | ||
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") { | ||
select("com.google.guava:guava:0") | ||
} | ||
}", | ||
"stateCleared": "modified", | ||
}, | ||
"gradle/libs.versions.toml": { | ||
"contents": "[versions] | ||
jacoco = "'JACOCO-MAVEN-PLUGIN-VERSION'" | ||
# jhipster-needle-gradle-dependency-catalog-version - JHipster will add additional versions for convention plugins heref | ||
[libraries] | ||
# jhipster-needle-gradle-dependency-catalog-libraries - JHipster will add additional libraries versions | ||
[plugins] | ||
# jhipster-needle-gradle-dependency-catalog-plugins - JHipster will add additional plugins versions | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
} | ||
`; |
27 changes: 27 additions & 0 deletions
27
generators/gradle/generators/code-quality/generator.spec.ts
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,27 @@ | ||
import { basename, dirname, resolve } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { before, it, describe, expect } from 'esmocha'; | ||
|
||
import { shouldSupportFeatures, testBlueprintSupport } from '../../../../test/support/tests.js'; | ||
import Generator from './index.js'; | ||
import { defaultHelpers as helpers, result } from '../../../../testing/index.js'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
const generator = `${basename(resolve(__dirname, '../../'))}:${basename(__dirname)}`; | ||
|
||
describe(`generator - ${generator}`, () => { | ||
shouldSupportFeatures(Generator); | ||
describe('blueprint support', () => testBlueprintSupport(generator)); | ||
|
||
describe('with gradle build tool', () => { | ||
before(async () => { | ||
await helpers.runJHipster(generator).withGradleBuildTool(); | ||
}); | ||
|
||
it('should match files snapshot', () => { | ||
expect(result.getSnapshot('**/{build.gradle,buildSrc/**,gradle/libs.versions.toml}')).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
96 changes: 96 additions & 0 deletions
96
generators/gradle/generators/jib/__snapshots__/generator.spec.ts.snap
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,96 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`generator - gradle:jib with gradle build tool should match files snapshot 1`] = ` | ||
{ | ||
"build.gradle": { | ||
"contents": " | ||
dependencies { | ||
// jhipster-needle-gradle-dependency | ||
} | ||
plugins { | ||
id "jhipster.docker-conventions" | ||
// jhipster-needle-gradle-plugins | ||
} | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/build.gradle": { | ||
"contents": "plugins { | ||
id 'groovy-gradle-plugin' | ||
} | ||
repositories { | ||
gradlePluginPortal() | ||
} | ||
dependencies { | ||
implementation libs.jib.plugin | ||
// jhipster-needle-gradle-dependency - JHipster will add additional dependencies for convention plugins here | ||
// jhipster-needle-gradle-build-src-dependency - Deprecated: JHipster will add additional dependencies for convention plugins here | ||
} | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/gradle/libs.versions.toml": { | ||
"contents": "[versions] | ||
# jhipster-needle-gradle-dependency-catalog-version - JHipster will add additional versions for convention plugins heref | ||
# jhipster-needle-gradle-build-src-dependency-catalog-version - Deprecated: JHipster will add additional versions for convention plugins here | ||
[libraries] | ||
jib-plugin = { module = "com.google.cloud.tools:jib-gradle-plugin", version = "'JIB-MAVEN-PLUGIN-VERSION'" } | ||
# jhipster-needle-gradle-dependency-catalog-libraries - JHipster will add additional libraries versions | ||
[plugins] | ||
# jhipster-needle-gradle-dependency-catalog-plugins - JHipster will add additional plugins versions | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
"buildSrc/src/main/groovy/jhipster.docker-conventions.gradle": { | ||
"contents": "plugins { | ||
id "com.google.cloud.tools.jib" | ||
} | ||
jib { | ||
from { | ||
image = "java-jre-placeholder" | ||
platforms { | ||
platform { | ||
architecture = "\${findProperty('jibArchitecture') ?: 'amd64'}" | ||
os = "linux" | ||
} | ||
} | ||
} | ||
to { | ||
image = "jhipster:latest" | ||
} | ||
container { | ||
entrypoint = ["bash", "-c", "/entrypoint.sh"] | ||
ports = ["8080"] | ||
environment = [ | ||
SPRING_OUTPUT_ANSI_ENABLED: "ALWAYS", | ||
JHIPSTER_SLEEP: "0" | ||
] | ||
creationTime = "USE_CURRENT_TIMESTAMP" | ||
user = 1000 | ||
} | ||
extraDirectories { | ||
paths = file("src/main/docker/jib") | ||
permissions = ["/entrypoint.sh": "755"] | ||
} | ||
}", | ||
"stateCleared": "modified", | ||
}, | ||
"gradle/libs.versions.toml": { | ||
"contents": "[versions] | ||
# jhipster-needle-gradle-dependency-catalog-version - JHipster will add additional versions for convention plugins heref | ||
[libraries] | ||
# jhipster-needle-gradle-dependency-catalog-libraries - JHipster will add additional libraries versions | ||
[plugins] | ||
# jhipster-needle-gradle-dependency-catalog-plugins - JHipster will add additional plugins versions | ||
", | ||
"stateCleared": "modified", | ||
}, | ||
} | ||
`; |
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,27 @@ | ||
import { basename, dirname, resolve } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { before, it, describe, expect } from 'esmocha'; | ||
|
||
import { shouldSupportFeatures, testBlueprintSupport } from '../../../../test/support/tests.js'; | ||
import Generator from './index.js'; | ||
import { defaultHelpers as helpers, result } from '../../../../testing/index.js'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
const generator = `${basename(resolve(__dirname, '../../'))}:${basename(__dirname)}`; | ||
|
||
describe(`generator - ${generator}`, () => { | ||
shouldSupportFeatures(Generator); | ||
describe('blueprint support', () => testBlueprintSupport(generator)); | ||
|
||
describe('with gradle build tool', () => { | ||
before(async () => { | ||
await helpers.runJHipster(generator).withGradleBuildTool(); | ||
}); | ||
|
||
it('should match files snapshot', () => { | ||
expect(result.getSnapshot('**/{build.gradle,buildSrc/**,gradle/libs.versions.toml}')).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
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
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
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
Oops, something went wrong.