Skip to content

Commit

Permalink
feat: reported changes from branch 8.1-jdk17
Browse files Browse the repository at this point in the history
  • Loading branch information
v1nc3n4 committed Jun 13, 2024
1 parent fec4cdf commit 8ec6870
Show file tree
Hide file tree
Showing 255 changed files with 3,164 additions and 2,646 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
os: [ubuntu-22.04, macos-14, windows-2022]

steps:
- name: Init Ubuntu environment
if: matrix.os == 'ubuntu-22.04'
run: sudo rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/pnpm /usr/local/bin/yarn

- name: Init MacOS environment
if: matrix.os == 'macos-12'
run: sudo rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/pnpm /usr/bin/yarn /Users/runner/.yarn/bin/yarn
if: matrix.os == 'macos-14'
run: sudo rm -f /opt/homebrew/bin/node /usr/local/bin/npm /usr/local/bin/pnpm /usr/bin/yarn /Users/runner/.yarn/bin/yarn

- name: Init Windows environment
if: matrix.os == 'windows-2022'
Expand All @@ -31,26 +31,26 @@ jobs:
Rename-Item "C:\npm" "npm.old" -Force
- name: Git checkout for source code analysis
uses: actions/checkout@v3
uses: actions/checkout@v4
if: matrix.os == 'ubuntu-22.04'
with:
fetch-depth: 0

- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
if: matrix.os != 'ubuntu-22.04'
with:
fetch-depth: 1

- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'
architecture: x64

- name: Cache Gradle's cache and wrapper
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/
Expand All @@ -60,22 +60,22 @@ jobs:
${{ runner.os }}-gradle-
- name: Cache Sonar's cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os == 'ubuntu-22.04'
with:
path: |
~/.sonar/cache/
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle*') }}

- name: Grant executable permission
run: chmod +x gradlew plugin/src/intTest/resources/*/bin/*
run: chmod +x gradlew plugin/src/integrationTest/resources/*/bin/*

- name: Build plugin on Linux (with test coverage)
if: matrix.os == 'ubuntu-22.04'
run: ./gradlew :plugin:jacocoTestReport --console=plain

- name: Build plugin on MacOS
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-14'
run: ./gradlew :plugin:build --console=plain

- name: Build plugin on Windows
Expand All @@ -97,4 +97,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew :plugin:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m -Dsonar.verbose=true
run: ./gradlew :plugin:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ The project relies on [GitHub Actions][github-actions] to integrate continuously
repository. The configuration actually allows to build and test the plugin with Adoptium Temurin JDK 17 64 bits, on the
environments below:

- Linux Ubuntu 22.04.2
- Mac OS 12.6.5
- Linux Ubuntu 22.04.4
- Mac OS 14.5
- Windows Server 2022

Ubuntu is the reference O/S, used to analyze the source code with SonarCloud. Developments are frequently done on a
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ With their feedback, plugin improvement is possible. Special thanks to:
@[joschi](https://github.com/joschi),
@[jorgheymans](https://github.com/jorgheymans),
@[ludik0](https://github.com/ludik0),
@[marcospereira](https://github.com/marcospereira),
@[mgiorgino-iobeya](https://github.com/mgiorgino-iobeya),
@[mhalbritter](https://github.com/mhalbritter),
@[mike-howell](https://github.com/mike-howell),
@[napstr](https://github.com/napstr),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ frontend {
}

tasks.register<RunNode>("nodeVersion") {
dependsOn("installNode")
script.set("-v")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
nodeInstallDirectory.set(file(rootProject.ext.get("nodeInstallDirectory")!!))
}

Expand Down
2 changes: 1 addition & 1 deletion examples/npm-application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
2 changes: 1 addition & 1 deletion examples/pnpm-application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
2 changes: 1 addition & 1 deletion examples/yarn-application-with-pnp-linker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
145 changes: 73 additions & 72 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,102 +27,63 @@ version = fgpVersion
description = fgpDescription

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
withJavadocJar()
withSourcesJar()
}

sourceSets {
create("intTest") {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output
runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output
}
}

val intTestImplementation: Configuration by configurations.getting {
val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get())
extendsFrom(configurations.testImplementation.get())
}

configurations["intTestRuntimeOnly"]
configurations["integrationTestRuntimeOnly"]
.extendsFrom(configurations.runtimeOnly.get())
.extendsFrom(configurations.testRuntimeOnly.get())

dependencies {
implementation(gradleApi())
implementation("io.github.resilience4j:resilience4j-retry:1.7.1")
implementation("org.apache.httpcomponents.client5:httpclient5:5.2.1")
implementation("org.apache.commons:commons-compress:1.23.0")
implementation("org.json:json:20230618")
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
testImplementation("org.mockito:mockito-core:5.4.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.4.0")
testImplementation("org.junit-pioneer:junit-pioneer:2.0.1")
testImplementation("org.assertj:assertj-core:3.24.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
testCompileOnly("org.projectlombok:lombok:1.18.28")
testAnnotationProcessor("org.projectlombok:lombok:1.18.28")

intTestImplementation("com.github.tomakehurst:wiremock:2.27.2")
}

tasks.named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}

tasks.withType<Test> {
useJUnitPlatform()
jvmArgs(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
)
outputs.upToDateWhen { false }
}

tasks.register<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
// Yarn immutable installs prevents failures in integration tests due to missing yarn.lock file.
environment["YARN_ENABLE_IMMUTABLE_INSTALLS"] = "false"
shouldRunAfter("test")
outputs.upToDateWhen { false }
}

tasks.named<Task>("check") {
dependsOn(tasks.named("integrationTest"))
}

tasks.named<JacocoReport>("jacocoTestReport") {
dependsOn(tasks.named("test"), tasks.named("integrationTest"))
executionData.setFrom(
file("${project.buildDir}/jacoco/test.exec"),
file("${project.buildDir}/jacoco/integrationTest.exec")
)
reports {
xml.required.set(true)
xml.outputLocation.set(file("${buildDir}/reports/jacoco/report.xml"))
}
implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1")
implementation("org.apache.commons:commons-compress:1.26.2")
implementation("org.json:json:20240303")
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testImplementation("org.mockito:mockito-core:5.12.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.12.0")
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0")
testImplementation("org.assertj:assertj-core:3.26.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testCompileOnly("org.projectlombok:lombok:1.18.32")
testAnnotationProcessor("org.projectlombok:lombok:1.18.32")

integrationTestImplementation("org.wiremock:wiremock:3.6.0")
}

gradle.addListener(GradleTestListener(logger))

idea {
module {
// Force integration test source set as test folder
testSources.from(project.sourceSets.getByName("intTest").java.srcDirs)
testResources.from(project.sourceSets.getByName("intTest").resources.srcDirs)
testSources.from(project.sourceSets.getByName("integrationTest").java.srcDirs)
testResources.from(project.sourceSets.getByName("integrationTest").resources.srcDirs)
isDownloadJavadoc = true
isDownloadSources = true
}
}

jacoco {
toolVersion = "0.8.10"
toolVersion = "0.8.11"
}

gradlePlugin {
Expand All @@ -148,23 +109,63 @@ sonarqube {
property("sonar.projectVersion", "${fgpVersion}-jdk11")

property("sonar.links.homepage", "https://github.com/siouan/frontend-gradle-plugin")
property("sonar.links.ci", "https://travis-ci.com/siouan/frontend-gradle-plugin")
property("sonar.links.ci", "https://github.com/siouan/frontend-gradle-plugin/actions")
property("sonar.links.scm", "https://github.com/siouan/frontend-gradle-plugin")
property("sonar.links.issue", "https://github.com/siouan/frontend-gradle-plugin/issues")

property("sonar.sources", "src/main")
property("sonar.tests", "src/test,src/intTest")
property("sonar.tests", "src/test,src/integrationTest")

property("sonar.java.binaries", "build/classes/java/main")
property("sonar.java.test.binaries", "build/classes/java/test,build/classes/java/intTest")
property("sonar.java.test.binaries", "build/classes/java/test,build/classes/java/integrationTest")
property("sonar.junit.reportPaths", "build/test-results/test/,build/test-results/integrationTest/")
property("sonar.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/report.xml")
property("sonar.jacoco.xmlReportPaths", "build/reports/jacoco/report.xml")
property("sonar.verbose", true)

// Irrelevant duplications detected on task inputs
property(
"sonar.cpd.exclusions",
"**/org/siouan/frontendgradleplugin/domain/model/*.java,**/org/siouan/frontendgradleplugin/domain/usecase/Get*ExecutablePath.java"
"**/org/siouan/frontendgradleplugin/domain/Resolve*ExecutablePath.java,**/org/siouan/frontendgradleplugin/infrastructure/gradle/FrontendExtension.java"
)
}
}

tasks.named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.named<Test>("test") {
outputs.upToDateWhen { false }
}

tasks.register<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
// Yarn immutable installs prevents failures in integration tests due to missing yarn.lock file.
environment["YARN_ENABLE_IMMUTABLE_INSTALLS"] = "false"
shouldRunAfter("test")
outputs.upToDateWhen { false }
}

tasks.named<Task>("check") {
dependsOn(tasks.named("integrationTest"))
}

tasks.named<JacocoReport>("jacocoTestReport") {
dependsOn(tasks.named("test"), tasks.named("integrationTest"))
executionData.setFrom(
project.layout.buildDirectory.files("jacoco/test.exec", "jacoco/integrationTest.exec"),
)
reports {
xml.required.set(true)
xml.outputLocation.set(project.layout.buildDirectory.file("reports/jacoco/report.xml"))
}
}

gradle.addListener(GradleTestListener(logger))
5 changes: 3 additions & 2 deletions plugin/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
1 change: 1 addition & 0 deletions plugin/lombok.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.log.fieldName=LOGGER
Loading

0 comments on commit 8ec6870

Please sign in to comment.