From 261d375f48fa5f57e8c386d33ac83a9095155a84 Mon Sep 17 00:00:00 2001 From: v1nc3n4 <5869062+v1nc3n4@users.noreply.github.com> Date: Thu, 13 Jun 2024 04:30:47 +0200 Subject: [PATCH] build: initialized JDK 21 build --- .github/ISSUE_TEMPLATE/bug_report.md | 8 ++++---- .github/ISSUE_TEMPLATE/feature_request.md | 9 +++++---- .github/workflows/build.yml | 4 ++-- CONTRIBUTING.md | 4 ++-- README.md | 2 +- .../build.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- .../frontend/build.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- .../node-subproject/build.gradle.kts | 2 +- .../npm-6-subproject/build.gradle.kts | 2 +- .../npm-9-subproject/build.gradle.kts | 2 +- .../pnpm-6-subproject/build.gradle.kts | 2 +- .../pnpm-8-subproject/build.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- .../yarn-1-subproject/build.gradle.kts | 2 +- examples/npm-application/build.gradle.kts | 2 +- examples/npm-application/settings.gradle.kts | 2 +- examples/pnpm-application/build.gradle.kts | 2 +- examples/pnpm-application/settings.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../settings.gradle.kts | 2 +- plugin/build.gradle.kts | 4 ++-- plugin/buildSrc/build.gradle.kts | 2 +- plugin/gradle.properties | 2 +- .../gradle/AssembleFrontedTaskFuncTest.java | 9 ++++----- .../gradle/AuthenticationAndProxyFuncTest.java | 4 ++-- .../gradle/CheckFrontendTaskFuncTest.java | 9 ++++----- .../gradle/CleanFrontendTaskFuncTest.java | 9 ++++----- .../gradle/InstallCorepackTaskFuncTest.java | 5 ++--- .../gradle/InstallFrontendTaskFuncTest.java | 7 +++---- .../gradle/InstallNodeTaskFuncTest.java | 4 ++-- .../InstallPackageManagerTaskFuncTest.java | 5 ++--- .../gradle/MultiProjectsFuncTest.java | 3 +-- .../gradle/PublishFrontendTaskFuncTest.java | 9 ++++----- .../ResolvePackageManagerTaskFuncTest.java | 3 +-- .../test/FrontendMapBuilder.java | 10 ++++------ .../test/GradleBuildFiles.java | 2 +- .../domain/installer/GetDistribution.java | 5 ++++- .../installer/InstallNodeDistribution.java | 4 +++- .../installer/ResolveNodeDistributionUrl.java | 3 ++- .../installer/ValidateNodeDistribution.java | 8 +++++--- .../infrastructure/archiver/ZipArchiver.java | 4 ++-- .../infrastructure/archiver/ZipEntry.java | 9 --------- .../bean/BeanRegistryException.java | 7 +++---- .../infrastructure/gradle/InstallNodeTask.java | 7 ++++--- .../domain/ResolvePackageManagerTest.java | 6 +++--- .../installer/AbstractHttpClientTest.java | 4 +++- .../domain/installer/GetDistributionTest.java | 15 +++++++++------ .../installer/InstallNodeDistributionTest.java | 13 ++++++++----- .../ResolveProxySettingsByUrlTest.java | 11 ++++++----- .../ValidateNodeDistributionTest.java | 8 +++++--- .../archiver/TarArchiverTest.java | 18 +++++++++++++----- .../infrastructure/archiver/ZipEntryTest.java | 2 +- site/build.gradle.kts | 4 ++-- site/src/components/property/property.vue | 2 +- .../components/task/install-corepack-task.vue | 4 ++-- site/src/pages/getting-started.vue | 16 ++++++++++++++++ 60 files changed, 163 insertions(+), 139 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9d8c0695..6669a91c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,10 +23,10 @@ Actual results: ... **Environment** -- OS: [e.g. Ubuntu 22.04.1, Windows 11 Pro, Mac OS X] -- JDK: [e.g. Adoptium Temurin JDK 17 64 bits] -- Gradle: [e.g. Gradle 8.2.1] -- Frontend Gradle plugin: [e.g. 8.1.0 JDK 17] +- OS: [e.g. Ubuntu 22.04.4, Windows 11 Pro, Mac OS X] +- JDK: [e.g. Adoptium Temurin JDK 21 64 bits] +- Gradle: [e.g. Gradle 8.8] +- Frontend Gradle plugin: [e.g. 8.1.0 JDK 21] Settings in `build.gradle[.kts]` file: ```groovy diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index df6dab84..107cbe1b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -20,10 +20,11 @@ Hi, Explain what you would like the plugin do: ... **Target environment** - -- OS: [e.g. Ubuntu 18.04.1, Windows 10 Pro, Mac OS X] -- JDK: [e.g. Oracle JDK 11 64 bits] -- Gradle: [e.g. Gradle 6.3] + +- OS: [e.g. Ubuntu 22.04.4, Windows 11 Pro, Mac OS X] +- JDK: [e.g. Adoptium Temurin JDK 21 64 bits] +- Gradle: [e.g. Gradle 8.8] +- Frontend Gradle plugin: [e.g. 8.1.0 JDK 21] Settings in `build.gradle[.kts]` file: ```groovy diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12cf7b09..8cbcb021 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,11 +42,11 @@ jobs: with: fetch-depth: 1 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: temurin - java-version: '17' + java-version: '21' architecture: x64 - name: Cache Gradle's cache and wrapper diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 068c7d4d..5aa632ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,7 +110,7 @@ gradlew pluginUnderTestMetadata ## Continuous integration The project relies on [GitHub Actions][github-actions] to integrate continuously every changes (pull requests) in the -repository. The configuration actually allows to build and test the plugin with Adoptium Temurin JDK 17 64 bits, on the +repository. The configuration actually allows to build and test the plugin with Adoptium Temurin JDK 21 64 bits, on the environments below: - Linux Ubuntu 22.04.4 @@ -118,7 +118,7 @@ environments below: - Windows Server 2022 Ubuntu is the reference O/S, used to analyze the source code with SonarCloud. Developments are frequently done on a -Windows 10 Professionnal workstation with Adoptium Temurin JDK 17 64 bits and [IntelliJ IDEA][intellij-idea]. +Windows 10 Professionnal workstation with Adoptium Temurin JDK 21 64 bits and [IntelliJ IDEA][intellij-idea]. [apache-commons-compress]: (Apache Commons Compress) [apache-http-components]: (Apache HttpComponents) diff --git a/README.md b/README.md index 1d32f274..4658bec4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Latest release 8.1.0 License Apache 2.0
- Build status + Build status Quality gate status Code coverage Reliability diff --git a/examples/application-with-preinstalled-nodejs-distribution/build.gradle.kts b/examples/application-with-preinstalled-nodejs-distribution/build.gradle.kts index d70ee558..de1148e4 100644 --- a/examples/application-with-preinstalled-nodejs-distribution/build.gradle.kts +++ b/examples/application-with-preinstalled-nodejs-distribution/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNode import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpm plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } //val preinstalledNodeDistributionDirectory = file(); diff --git a/examples/application-with-preinstalled-nodejs-distribution/settings.gradle.kts b/examples/application-with-preinstalled-nodejs-distribution/settings.gradle.kts index ce0f296e..10f0d1a6 100644 --- a/examples/application-with-preinstalled-nodejs-distribution/settings.gradle.kts +++ b/examples/application-with-preinstalled-nodejs-distribution/settings.gradle.kts @@ -1,5 +1,5 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/fullstack-war-application/frontend/build.gradle.kts b/examples/fullstack-war-application/frontend/build.gradle.kts index c363b01f..81c3dd32 100644 --- a/examples/fullstack-war-application/frontend/build.gradle.kts +++ b/examples/fullstack-war-application/frontend/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/fullstack-war-application/settings.gradle.kts b/examples/fullstack-war-application/settings.gradle.kts index 0c99d01c..dd06787a 100644 --- a/examples/fullstack-war-application/settings.gradle.kts +++ b/examples/fullstack-war-application/settings.gradle.kts @@ -4,7 +4,7 @@ pluginManagement { id("war") id("org.springframework.boot") version "2.7.12" id("io.spring.dependency-management") version "1.1.0" - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/node-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/node-subproject/build.gradle.kts index 1fd4a360..127f008e 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/node-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/node-subproject/build.gradle.kts @@ -1,7 +1,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNode plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-6-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-6-subproject/build.gradle.kts index 072de7b2..8d7fe352 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-6-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-6-subproject/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.ResolvePackageManag import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpm plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-9-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-9-subproject/build.gradle.kts index 4ef330d3..39777a0e 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-9-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/npm-9-subproject/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.ResolvePackageManag import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpm plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-6-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-6-subproject/build.gradle.kts index aad53c3f..e5de1405 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-6-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-6-subproject/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.ResolvePackageManag import org.siouan.frontendgradleplugin.infrastructure.gradle.RunPnpm plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-8-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-8-subproject/build.gradle.kts index 0e59c4fe..ebef803f 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-8-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/pnpm-8-subproject/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.ResolvePackageManag import org.siouan.frontendgradleplugin.infrastructure.gradle.RunPnpm plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/settings.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/settings.gradle.kts index 44234335..11eafe6b 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/settings.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/multiple-package-managers-with-shared-nodejs-distribution/yarn-1-subproject/build.gradle.kts b/examples/multiple-package-managers-with-shared-nodejs-distribution/yarn-1-subproject/build.gradle.kts index d1f5c26c..a6fe0e11 100644 --- a/examples/multiple-package-managers-with-shared-nodejs-distribution/yarn-1-subproject/build.gradle.kts +++ b/examples/multiple-package-managers-with-shared-nodejs-distribution/yarn-1-subproject/build.gradle.kts @@ -2,7 +2,7 @@ import org.siouan.frontendgradleplugin.infrastructure.gradle.ResolvePackageManag import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/npm-application/build.gradle.kts b/examples/npm-application/build.gradle.kts index 827c8fd1..f267d9b5 100644 --- a/examples/npm-application/build.gradle.kts +++ b/examples/npm-application/build.gradle.kts @@ -3,7 +3,7 @@ import kotlin.io.path.Path import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallFrontendTask plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/npm-application/settings.gradle.kts b/examples/npm-application/settings.gradle.kts index ce0f296e..10f0d1a6 100644 --- a/examples/npm-application/settings.gradle.kts +++ b/examples/npm-application/settings.gradle.kts @@ -1,5 +1,5 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/pnpm-application/build.gradle.kts b/examples/pnpm-application/build.gradle.kts index d9e748cb..7b628f82 100644 --- a/examples/pnpm-application/build.gradle.kts +++ b/examples/pnpm-application/build.gradle.kts @@ -3,7 +3,7 @@ import kotlin.io.path.Path import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallFrontendTask plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/pnpm-application/settings.gradle.kts b/examples/pnpm-application/settings.gradle.kts index ce0f296e..10f0d1a6 100644 --- a/examples/pnpm-application/settings.gradle.kts +++ b/examples/pnpm-application/settings.gradle.kts @@ -1,5 +1,5 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/yarn-application-with-node-modules-linker/build.gradle.kts b/examples/yarn-application-with-node-modules-linker/build.gradle.kts index 88fcf497..c9373cf1 100644 --- a/examples/yarn-application-with-node-modules-linker/build.gradle.kts +++ b/examples/yarn-application-with-node-modules-linker/build.gradle.kts @@ -3,7 +3,7 @@ import kotlin.io.path.Path import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallFrontendTask plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/yarn-application-with-node-modules-linker/settings.gradle.kts b/examples/yarn-application-with-node-modules-linker/settings.gradle.kts index ce0f296e..10f0d1a6 100644 --- a/examples/yarn-application-with-node-modules-linker/settings.gradle.kts +++ b/examples/yarn-application-with-node-modules-linker/settings.gradle.kts @@ -1,5 +1,5 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/examples/yarn-application-with-pnp-linker/build.gradle.kts b/examples/yarn-application-with-pnp-linker/build.gradle.kts index 80248b4c..27aecfbe 100644 --- a/examples/yarn-application-with-pnp-linker/build.gradle.kts +++ b/examples/yarn-application-with-pnp-linker/build.gradle.kts @@ -3,7 +3,7 @@ import kotlin.io.path.Path import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallFrontendTask plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/examples/yarn-application-with-pnp-linker/settings.gradle.kts b/examples/yarn-application-with-pnp-linker/settings.gradle.kts index ce0f296e..10f0d1a6 100644 --- a/examples/yarn-application-with-pnp-linker/settings.gradle.kts +++ b/examples/yarn-application-with-pnp-linker/settings.gradle.kts @@ -1,5 +1,5 @@ pluginManagement { plugins { - id("org.siouan.frontend-jdk17") version "8.1.0" + id("org.siouan.frontend-jdk21") version "8.1.0" } } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ff4aabcc..1affd4b6 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -28,7 +28,7 @@ description = fgpDescription java { toolchain { - languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(21) } withJavadocJar() withSourcesJar() @@ -106,7 +106,7 @@ sonarqube { property("sonar.organization", "siouan") property("sonar.projectKey", "siouan_frontend-gradle-plugin") property("sonar.projectName", "frontend-gradle-plugin") - property("sonar.projectVersion", "${fgpVersion}-jdk17") + property("sonar.projectVersion", "${fgpVersion}-jdk21") property("sonar.links.homepage", "https://github.com/siouan/frontend-gradle-plugin") property("sonar.links.ci", "https://github.com/siouan/frontend-gradle-plugin/actions") diff --git a/plugin/buildSrc/build.gradle.kts b/plugin/buildSrc/build.gradle.kts index 268f1d70..75c36ea9 100644 --- a/plugin/buildSrc/build.gradle.kts +++ b/plugin/buildSrc/build.gradle.kts @@ -8,6 +8,6 @@ dependencies { java { toolchain { - languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(21) } } diff --git a/plugin/gradle.properties b/plugin/gradle.properties index fc257e4d..466d55d8 100644 --- a/plugin/gradle.properties +++ b/plugin/gradle.properties @@ -1,4 +1,4 @@ -fgpArtifactId=frontend-jdk17 +fgpArtifactId=frontend-jdk21 fgpGroup=org.siouan fgpVersion=8.1.0 fgpDisplayName=Frontend Gradle plugin diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AssembleFrontedTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AssembleFrontedTaskFuncTest.java index bbb732e8..fb02861d 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AssembleFrontedTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AssembleFrontedTaskFuncTest.java @@ -9,7 +9,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -42,7 +41,7 @@ void setUp() throws IOException { void should_skip_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .assembleScript("run assemble") .packageJsonDirectory(packageJsonDirectoryPath); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -61,7 +60,7 @@ void should_skip_task_when_script_is_not_defined() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -79,7 +78,7 @@ void should_skip_task_when_running_gradle_task_and_script_is_not_defined() throw Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -97,7 +96,7 @@ void should_assemble_frontend() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath) .assembleScript("run assemble"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AuthenticationAndProxyFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AuthenticationAndProxyFuncTest.java index 61fc7ee8..738f3e6d 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AuthenticationAndProxyFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/AuthenticationAndProxyFuncTest.java @@ -10,7 +10,7 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import java.io.IOException; -import java.net.URL; +import java.net.URI; import java.nio.file.Path; import com.github.tomakehurst.wiremock.WireMockServer; @@ -168,7 +168,7 @@ void should_install_node_when_authentication_succeeds_on_proxy_server() throws I private FrontendMapBuilder configureNodeServerAndPluginWithDirectConnection(final String distributionServerPassword) throws IOException { return configureServerAndPlugin( - new URL("http", DISTRIBUTION_SERVER_HOST, DISTRIBUTION_SERVER_PORT, "/").toString(), + URI.create("http://" + DISTRIBUTION_SERVER_HOST + ':' + DISTRIBUTION_SERVER_PORT + "/").toString(), NODE_DISTRIBUTION_URL_PATH_PATTERN, DISTRIBUTION_SERVER_USERNAME, distributionServerPassword, null, null, null, null); } diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CheckFrontendTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CheckFrontendTaskFuncTest.java index 15f6928e..c1d4eb83 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CheckFrontendTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CheckFrontendTaskFuncTest.java @@ -9,7 +9,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -34,7 +33,7 @@ class CheckFrontendTaskFuncTest { void should_skip_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .checkScript("run check"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -52,7 +51,7 @@ void should_skip_task_when_script_is_not_defined() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, CHECK_TASK_NAME); @@ -69,7 +68,7 @@ void should_skip_task_when_running_gradle_task_and_script_is_not_defined() throw Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, GRADLE_CHECK_TASK_NAME); @@ -86,7 +85,7 @@ void should_check_frontend() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .checkScript("run check"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CleanFrontendTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CleanFrontendTaskFuncTest.java index 113aa4dd..d84c12c4 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CleanFrontendTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/CleanFrontendTaskFuncTest.java @@ -9,7 +9,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -34,7 +33,7 @@ class CleanFrontendTaskFuncTest { void should_skip_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .cleanScript("run clean"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -52,7 +51,7 @@ void should_skip_task_when_script_is_not_defined() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, CLEAN_TASK_NAME); @@ -69,7 +68,7 @@ void should_skip_task_when_running_gradle_task_and_script_is_not_defined() throw Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, GRADLE_CLEAN_TASK_NAME); @@ -86,7 +85,7 @@ void should_clean_frontend() throws IOException { Files.copy(getResourcePath("package-npm.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .cleanScript("run clean"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallCorepackTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallCorepackTaskFuncTest.java index 21c1d8ea..d9af3948 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallCorepackTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallCorepackTaskFuncTest.java @@ -11,7 +11,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -36,7 +35,7 @@ class InstallCorepackTaskFuncTest { void should_skip_task_when_corepack_version_property_is_null() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result = runGradle(projectDirectoryPath, INSTALL_COREPACK_TASK_NAME); @@ -61,7 +60,7 @@ void should_install_corepack() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") .corepackVersion(LATEST_VERSION_ARGUMENT) - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, INSTALL_COREPACK_TASK_NAME); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallFrontendTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallFrontendTaskFuncTest.java index fde86bda..5f57b932 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallFrontendTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallFrontendTaskFuncTest.java @@ -8,7 +8,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -33,7 +32,7 @@ class InstallFrontendTaskFuncTest { void should_skip_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, INSTALL_FRONTEND_TASK_NAME); @@ -50,7 +49,7 @@ void should_succeed_with_default_script() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, INSTALL_FRONTEND_TASK_NAME); @@ -67,7 +66,7 @@ void should_succeed_with_custom_script() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .installScript("ci"); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTaskFuncTest.java index 83da0ecb..c040ea27 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTaskFuncTest.java @@ -9,7 +9,7 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SKIPPED; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; +import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; import java.io.IOException; import java.nio.file.Path; @@ -72,7 +72,7 @@ void should_fail_when_distribution_download_url_is_invalid() throws IOException void should_succeed_first_time_and_be_up_to_date_next_time() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, INSTALL_NODE_TASK_NAME); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallPackageManagerTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallPackageManagerTaskFuncTest.java index 9787de9b..6de847ba 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallPackageManagerTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallPackageManagerTaskFuncTest.java @@ -10,7 +10,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -36,7 +35,7 @@ class InstallPackageManagerTaskFuncTest { void should_skip_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, INSTALL_PACKAGE_MANAGER_TASK_NAME); @@ -63,7 +62,7 @@ void should_install_package_managers() throws IOException { Files.copy(getResourcePath("package-npm.json"), projectDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")); + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); final BuildResult installNpmResult1 = runGradle(projectDirectoryPath, INSTALL_PACKAGE_MANAGER_TASK_NAME); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/MultiProjectsFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/MultiProjectsFuncTest.java index b4dc778c..b329bf2f 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/MultiProjectsFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/MultiProjectsFuncTest.java @@ -11,7 +11,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -65,7 +64,7 @@ void should_run_tasks_in_sub_projects() throws IOException { final FrontendMapBuilder yarnSubProjectFrontendProperties = new FrontendMapBuilder() .nodeVersion("20.14.0") .nodeInstallDirectory(nodeInstallDirectory) - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .installScript("run install") .cleanScript("run clean") .assembleScript("run assemble") diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/PublishFrontendTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/PublishFrontendTaskFuncTest.java index 9316a3e2..91603c1c 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/PublishFrontendTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/PublishFrontendTaskFuncTest.java @@ -9,7 +9,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.file.Files; @@ -44,7 +43,7 @@ void setUp() throws IOException { void should_skip_plugin_task_when_package_json_file_does_not_exist() throws IOException { final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .assembleScript("run assemble") .publishScript("run publish") .packageJsonDirectory(packageJsonDirectoryPath); @@ -64,7 +63,7 @@ void should_skip_plugin_task_when_script_is_not_defined() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -82,7 +81,7 @@ void should_skip_plugin_task_when_running_gradle_task_and_script_is_not_defined( Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath); createBuildFile(projectDirectoryPath, frontendMapBuilder.toMap()); @@ -100,7 +99,7 @@ void should_publish_frontend() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), packageJsonDirectoryPath.resolve("package.json")); final FrontendMapBuilder frontendMapBuilder = new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .packageJsonDirectory(packageJsonDirectoryPath) .assembleScript("run assemble") .publishScript("run publish"); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolvePackageManagerTaskFuncTest.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolvePackageManagerTaskFuncTest.java index ada47290..cc52f7b8 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolvePackageManagerTaskFuncTest.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/infrastructure/gradle/ResolvePackageManagerTaskFuncTest.java @@ -16,7 +16,6 @@ import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.SUCCESS; import static org.siouan.frontendgradleplugin.test.PluginTaskOutcome.UP_TO_DATE; import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; -import static org.siouan.frontendgradleplugin.test.Resources.getResourceUrl; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -109,7 +108,7 @@ void should_pass_when_package_manager_property_is_valid() throws IOException { Files.copy(getResourcePath("package-any-manager.json"), projectDirectoryPath.resolve("package.json")); createBuildFile(projectDirectoryPath, new FrontendMapBuilder() .nodeVersion("20.14.0") - .nodeDistributionUrl(getResourceUrl("node-v20.14.0.zip")) + .nodeDistributionUrl(getResourcePath("node-v20.14.0.zip")) .toMap()); final BuildResult result1 = runGradle(projectDirectoryPath, RESOLVE_PACKAGE_MANAGER_TASK_NAME); diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/FrontendMapBuilder.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/FrontendMapBuilder.java index 92d00f9c..5c1b530f 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/FrontendMapBuilder.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/FrontendMapBuilder.java @@ -1,6 +1,5 @@ package org.siouan.frontendgradleplugin.test; -import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -68,11 +67,10 @@ public FrontendMapBuilder nodeDistributionUrlPathPattern(final String nodeDistri return this; } - public FrontendMapBuilder nodeDistributionUrl(final URL nodeDistributionUrl) { - final String fileName = nodeDistributionUrl.getFile(); - final String nodeDistributionUrlAsString = nodeDistributionUrl.toString(); - return nodeDistributionUrlRoot(nodeDistributionUrlAsString.substring(0, - nodeDistributionUrlAsString.indexOf(fileName))).nodeDistributionUrlPathPattern(fileName); + public FrontendMapBuilder nodeDistributionUrl(final Path nodeDistributionFilePath) { + final String fileName = nodeDistributionFilePath.getFileName().toString(); + final String nodeDistributionUrlAsString = nodeDistributionFilePath.getParent().toUri().toString(); + return nodeDistributionUrlRoot(nodeDistributionUrlAsString).nodeDistributionUrlPathPattern(fileName); } public FrontendMapBuilder nodeDistributionServerUsername(final String nodeDistributionServerUsername) { diff --git a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/GradleBuildFiles.java b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/GradleBuildFiles.java index 42fe224d..5a9b934a 100644 --- a/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/GradleBuildFiles.java +++ b/plugin/src/integrationTest/java/org/siouan/frontendgradleplugin/test/GradleBuildFiles.java @@ -114,7 +114,7 @@ public static void createBuildFile(final Path projectDirectory, final boolean pl final String additionalContent) throws IOException { final Set pluginsWithFrontend = new HashSet<>(plugins); if (pluginEnabled) { - pluginsWithFrontend.add("id 'org.siouan.frontend-jdk17' apply " + pluginApplied); + pluginsWithFrontend.add("id 'org.siouan.frontend-jdk21' apply " + pluginApplied); } createBuildFile(projectDirectory, pluginsWithFrontend, properties, additionalContent); } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/GetDistribution.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/GetDistribution.java index 95608317..35edc11a 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/GetDistribution.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/GetDistribution.java @@ -1,6 +1,7 @@ package org.siouan.frontendgradleplugin.domain.installer; import java.io.IOException; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; import java.util.regex.Matcher; @@ -51,10 +52,12 @@ public class GetDistribution { * @throws ResourceDownloadException If the distribution download or the shasums file download fails. * @throws InvalidNodeDistributionException If the downloaded distribution is corrupted. * @throws IOException If an I/O error occurs. + * @throws URISyntaxException If the distribution URL is not a valid URL. */ public Path execute(final GetDistributionCommand command) throws IOException, InvalidDistributionUrlException, ResourceDownloadException, - InvalidNodeDistributionException, NodeDistributionShasumNotFoundException, UnsupportedPlatformException { + InvalidNodeDistributionException, NodeDistributionShasumNotFoundException, UnsupportedPlatformException, + URISyntaxException { // Resolve the URL to download the distribution final ResolveNodeDistributionUrlCommand resolveNodeDistributionUrlCommand = new ResolveNodeDistributionUrlCommand( command.getPlatform(), command.getVersion(), command.getDistributionUrlRoot(), diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java index 32487e15..a9c790f6 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistribution.java @@ -1,6 +1,7 @@ package org.siouan.frontendgradleplugin.domain.installer; import java.io.IOException; +import java.net.URISyntaxException; import java.nio.file.Path; import lombok.RequiredArgsConstructor; @@ -45,11 +46,12 @@ public class InstallNodeDistribution { * @throws InvalidNodeDistributionException If the downloaded distribution is corrupted. * @throws ArchiverException If an error occurs in the archiver exploding the distribution. * @throws IOException If an I/O error occurs. + * @throws URISyntaxException If the distribution URL is not a valid URL. */ public void execute(final InstallNodeDistributionCommand command) throws IOException, InvalidNodeDistributionException, NodeDistributionShasumNotFoundException, UnsupportedPlatformException, InvalidDistributionUrlException, ResourceDownloadException, ArchiverException, - UnsupportedDistributionArchiveException { + UnsupportedDistributionArchiveException, URISyntaxException { logger.info("Removing install directory '{}'", command.installDirectoryPath()); fileManager.deleteFileTree(command.installDirectoryPath(), true); diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveNodeDistributionUrl.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveNodeDistributionUrl.java index f7be7ce4..dd1d6a4e 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveNodeDistributionUrl.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ResolveNodeDistributionUrl.java @@ -1,6 +1,7 @@ package org.siouan.frontendgradleplugin.domain.installer; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import lombok.RequiredArgsConstructor; @@ -63,6 +64,6 @@ public URL execute(final ResolveNodeDistributionUrlCommand resolveNodeDistributi } else { pathPatternWithTypeResolved = pathPatternWithArchIdResolved; } - return new URL(resolveNodeDistributionUrlCommand.getDownloadUrlRoot() + pathPatternWithTypeResolved); + return URI.create(resolveNodeDistributionUrlCommand.getDownloadUrlRoot() + pathPatternWithTypeResolved).toURL(); } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistribution.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistribution.java index 8b8b33c6..f9ef0dab 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistribution.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistribution.java @@ -1,6 +1,7 @@ package org.siouan.frontendgradleplugin.domain.installer; import java.io.IOException; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; @@ -34,19 +35,20 @@ public class ValidateNodeDistribution { * actual shasum of the distribution file matches this expected shasum. * * @param command Command providing parameters to validate the distribution. + * @throws URISyntaxException If the distribution URL is not a valid URL. * @throws ResourceDownloadException If downloading the file providing shasums fails. * @throws InvalidNodeDistributionException If the distribution is invalid. * @throws NodeDistributionShasumNotFoundException If validation cannot be done for other reason. * @throws IOException If an I/O error occurs. */ public void execute(final ValidateNodeDistributionCommand command) - throws InvalidNodeDistributionException, IOException, NodeDistributionShasumNotFoundException, - ResourceDownloadException { + throws URISyntaxException, InvalidNodeDistributionException, IOException, + NodeDistributionShasumNotFoundException, ResourceDownloadException { final Path shasumsFilePath = command.getTemporaryDirectoryPath().resolve(SHASUMS_FILE_NAME); // Resolve the URL to download the shasum file final String expectedShasum; try { - final URL shasumsFileUrl = new URL(command.getDistributionUrl(), SHASUMS_FILE_NAME); + final URL shasumsFileUrl = command.getDistributionUrl().toURI().resolve(SHASUMS_FILE_NAME).toURL(); // Download the shasum file logger.debug("Downloading shasums at '{}'", shasumsFileUrl); diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipArchiver.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipArchiver.java index 879fe2b9..25caa311 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipArchiver.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipArchiver.java @@ -49,13 +49,13 @@ protected Optional getNextEntry(final ZipArchiverContext context) { @Override protected String getSymbolicLinkTarget(final ZipArchiverContext context, final ZipEntry entry) throws IOException { - return readSymbolicLinkTarget(context.getZipFile(), entry.getLowLevelEntry()); + return readSymbolicLinkTarget(context.getZipFile(), entry.lowLevelEntry()); } @Override protected void writeRegularFile(final ZipArchiverContext context, final ZipEntry entry, final Path filePath) throws IOException { - try (final InputStream entryInputStream = context.getZipFile().getInputStream(entry.getLowLevelEntry())) { + try (final InputStream entryInputStream = context.getZipFile().getInputStream(entry.lowLevelEntry())) { fileManager.copy(entryInputStream, filePath); } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java index 849ad712..57dcd066 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntry.java @@ -15,15 +15,6 @@ @Builder public record ZipEntry(ZipArchiveEntry lowLevelEntry) implements ArchiveEntry { - /** - * Gets the low-level entry this entry is mapped to. - * - * @return Entry. - */ - public ZipArchiveEntry getLowLevelEntry() { - return lowLevelEntry; - } - @Override public String getName() { return lowLevelEntry.getName(); diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/bean/BeanRegistryException.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/bean/BeanRegistryException.java index 8a179d46..71a4cf7d 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/bean/BeanRegistryException.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/bean/BeanRegistryException.java @@ -1,10 +1,13 @@ package org.siouan.frontendgradleplugin.infrastructure.bean; +import lombok.Getter; + /** * Base class of exceptions thrown by the bean registry. * * @since 2.0.0 */ +@Getter public abstract class BeanRegistryException extends Exception { private final Class beanClass; @@ -17,8 +20,4 @@ protected BeanRegistryException(final Class beanClass, final String message, super(message, cause); this.beanClass = beanClass; } - - public Class getBeanClass() { - return beanClass; - } } diff --git a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTask.java b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTask.java index 8d3ced38..471779ff 100644 --- a/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTask.java +++ b/plugin/src/main/java/org/siouan/frontendgradleplugin/infrastructure/gradle/InstallNodeTask.java @@ -2,7 +2,8 @@ import java.io.File; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import javax.inject.Inject; import org.gradle.api.DefaultTask; @@ -425,7 +426,7 @@ public RegularFileProperty getNodeExecutableFile() { * @throws ResourceDownloadException If the distribution download failed. */ @TaskAction - public void execute() throws BeanRegistryException, FrontendException, IOException { + public void execute() throws BeanRegistryException, FrontendException, IOException, URISyntaxException { final BeanRegistry beanRegistry = beanRegistryBuildService.get().getBeanRegistry(); TaskLoggerInitializer.initAdapter(this, verboseModeEnabled.get(), beanRegistry.getBean(GradleLoggerAdapter.class), beanRegistry.getBean(GradleSettings.class)); @@ -456,7 +457,7 @@ public void execute() throws BeanRegistryException, FrontendException, IOExcepti .httpProxyHost(httpProxyHost.getOrNull()) .httpProxyPort(httpProxyPort.get()) .httpProxyCredentials(httpProxyCredentials) - .resourceUrl(new URL(nodeDistributionUrlRoot.get())) + .resourceUrl(URI.create(nodeDistributionUrlRoot.get()).toURL()) .systemHttpProxyHost(systemHttpProxyHost.getOrNull()) .systemHttpProxyPort(systemHttpProxyPort.get()) .systemHttpsProxyHost(systemHttpsProxyHost.getOrNull()) diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerTest.java index ea48144a..e3f45196 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/ResolvePackageManagerTest.java @@ -41,11 +41,10 @@ void should_delete_output_files_when_package_json_file_does_not_exist() throws IOException, InvalidJsonFileException, MalformedPackageManagerSpecification, UnsupportedPackageManagerException { final Path nodeInstallDirectoryPath = Paths.get("node"); - final Platform platform = LOCAL_PLATFORM; final Path packageManagerSpecificationFilePath = Paths.get("name.txt"); final Path packageManagerExecutablePathFilePath = Paths.get("executable-path.txt"); - usecase.execute(new ResolvePackageManagerCommand(null, nodeInstallDirectoryPath, platform, + usecase.execute(new ResolvePackageManagerCommand(null, nodeInstallDirectoryPath, LOCAL_PLATFORM, packageManagerSpecificationFilePath, packageManagerExecutablePathFilePath)); final ArgumentCaptor pathArgumentCaptor = ArgumentCaptor.forClass(Path.class); @@ -70,7 +69,8 @@ void should_resolve_package_manager_and_cache_output_files() PackageManager.builder().type(packageManagerType).version(packageManagerVersion).build()); final Path executablePath = Paths.get("executable"); when(fileManager.writeString(packageManagerSpecificationFilePath, "pnpm@5.9.2", StandardCharsets.UTF_8, - StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)).thenReturn(packageManagerSpecificationFilePath); + StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)).thenReturn( + packageManagerSpecificationFilePath); when(getExecutablePath.execute(any(GetExecutablePathCommand.class))).thenReturn(executablePath); when(fileManager.writeString(packageManagerExecutablePathFilePath, executablePath.toString(), StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)).thenReturn( diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/AbstractHttpClientTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/AbstractHttpClientTest.java index e8952351..4e228f4c 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/AbstractHttpClientTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/AbstractHttpClientTest.java @@ -3,6 +3,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; +import java.net.URI; import java.net.URL; import java.nio.file.Path; @@ -38,7 +39,8 @@ void should_return_local_file_http_response_when_protocol_is_file() throws IOExc @Test void should_return_real_http_response_when_protocol_is_not_file() throws IOException { - assertThat(httpClient.sendGetRequest(new URL("http://localhost"), null, null)).isEqualTo(httpResponse); + assertThat(httpClient.sendGetRequest(URI.create("http://localhost").toURL(), null, null)).isEqualTo( + httpResponse); } private static class HttpClientImpl extends AbstractHttpClient { diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/GetDistributionTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/GetDistributionTest.java index 011dfa2a..a6a3f419 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/GetDistributionTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/GetDistributionTest.java @@ -11,6 +11,8 @@ import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; @@ -126,7 +128,7 @@ void should_fail_getting_distribution_when_resolved_url_is_invalid() .version(version) .downloadUrlRoot(distributionUrlRoot) .downloadUrlPathPattern(distributionUrlPathPattern) - .build())).thenReturn(new URL("https://domain.com/")); + .build())).thenReturn(URI.create("https://domain.com/").toURL()); final GetDistributionCommand getDistributionCommand = new GetDistributionCommand(platform, version, distributionUrlRoot, distributionUrlPathPattern, CredentialsFixture.someCredentials(), ProxySettingsFixture.someProxySettings(), RetrySettingsFixture.someRetrySettings(), temporaryDirectoryPath); @@ -148,7 +150,7 @@ void should_fail_getting_distribution_when_download_fails() final Credentials distributionServerCredentials = CredentialsFixture.someCredentials(); final ProxySettings proxySettings = ProxySettingsFixture.someProxySettings(); final RetrySettings retrySettings = RetrySettingsFixture.someRetrySettings(); - final URL downloadUrl = new URL(distributionUrlRoot + distributionUrlPathPattern); + final URL downloadUrl = URI.create(distributionUrlRoot + distributionUrlPathPattern).toURL(); when(resolveNodeDistributionUrl.execute(ResolveNodeDistributionUrlCommand .builder() .platform(platform) @@ -182,7 +184,7 @@ void should_fail_getting_distribution_when_download_fails() @Test void should_fail_getting_distribution_when_distribution_is_invalid_after_download() - throws FrontendException, IOException { + throws FrontendException, IOException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -190,7 +192,7 @@ void should_fail_getting_distribution_when_distribution_is_invalid_after_downloa final Credentials distributionServerCredentials = CredentialsFixture.someCredentials(); final ProxySettings proxySettings = ProxySettingsFixture.someProxySettings(); final RetrySettings retrySettings = RetrySettingsFixture.someRetrySettings(); - final URL downloadUrl = new URL(distributionUrlRoot + distributionUrlPathPattern); + final URL downloadUrl = URI.create(distributionUrlRoot + distributionUrlPathPattern).toURL(); when(resolveNodeDistributionUrl.execute(ResolveNodeDistributionUrlCommand .builder() .platform(platform) @@ -232,7 +234,8 @@ void should_fail_getting_distribution_when_distribution_is_invalid_after_downloa } @Test - void should_get_valid_distribution_when_validator_is_available() throws FrontendException, IOException { + void should_get_valid_distribution_when_validator_is_available() + throws FrontendException, IOException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -240,7 +243,7 @@ void should_get_valid_distribution_when_validator_is_available() throws Frontend final Credentials distributionServerCredentials = CredentialsFixture.someCredentials(); final ProxySettings proxySettings = ProxySettingsFixture.someProxySettings(); final RetrySettings retrySettings = RetrySettingsFixture.someRetrySettings(); - final URL downloadUrl = new URL(distributionUrlRoot + distributionUrlPathPattern); + final URL downloadUrl = URI.create(distributionUrlRoot + distributionUrlPathPattern).toURL(); when(resolveNodeDistributionUrl.execute(ResolveNodeDistributionUrlCommand .builder() .platform(platform) diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionTest.java index 29504311..fe223086 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/InstallNodeDistributionTest.java @@ -10,6 +10,7 @@ import static org.siouan.frontendgradleplugin.domain.PlatformFixture.LOCAL_PLATFORM; import java.io.IOException; +import java.net.URISyntaxException; import java.nio.file.Path; import org.junit.jupiter.api.BeforeEach; @@ -73,7 +74,7 @@ void should_fail_when_install_directory_cannot_be_deleted() throws IOException { } @Test - void should_fail_when_distribution_cannot_be_retrieved() throws IOException, FrontendException { + void should_fail_when_distribution_cannot_be_retrieved() throws IOException, FrontendException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -104,7 +105,8 @@ void should_fail_when_distribution_cannot_be_retrieved() throws IOException, Fro } @Test - void should_fail_when_temporary_extract_directory_cannot_be_deleted() throws IOException, FrontendException { + void should_fail_when_temporary_extract_directory_cannot_be_deleted() + throws IOException, FrontendException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -137,7 +139,7 @@ void should_fail_when_temporary_extract_directory_cannot_be_deleted() throws IOE } @Test - void should_fail_when_distribution_cannot_be_deployed() throws IOException, FrontendException { + void should_fail_when_distribution_cannot_be_deployed() throws IOException, FrontendException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -179,7 +181,8 @@ void should_fail_when_distribution_cannot_be_deployed() throws IOException, Fron } @Test - void should_fail_when_downloaded_distribution_file_cannot_be_deleted() throws IOException, FrontendException { + void should_fail_when_downloaded_distribution_file_cannot_be_deleted() + throws IOException, FrontendException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; @@ -220,7 +223,7 @@ void should_fail_when_downloaded_distribution_file_cannot_be_deleted() throws IO } @Test - void should_install_distribution() throws IOException, FrontendException { + void should_install_distribution() throws IOException, FrontendException, URISyntaxException { final Platform platform = LOCAL_PLATFORM; final String version = VERSION; final String distributionUrlRoot = DISTRIBUTION_URL_ROOT; diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlTest.java index b621f4d1..494f40a8 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ResolveProxySettingsByUrlTest.java @@ -8,6 +8,7 @@ import java.net.MalformedURLException; import java.net.Proxy; +import java.net.URI; import java.net.URL; import java.util.Set; @@ -50,7 +51,7 @@ class ResolveProxySettingsByUrlTest { @Test void should_fail_when_url_uses_unsupported_protocol() throws MalformedURLException { - final URL resourceUrl = new URL("ftp", HOST, PORT, "/"); + final URL resourceUrl = URI.create("ftp://" + HOST + ':' + PORT + "/").toURL(); final ResolveProxySettingsByUrlCommand command = ResolveProxySettingsByUrlCommand .builder() .httpProxyPort(80) @@ -70,7 +71,7 @@ void should_return_direct_connection_when_url_uses_file_protocol() throws Malfor .builder() .httpProxyPort(80) .httpsProxyPort(443) - .resourceUrl(new URL(FILE_RESOURCE_URL)) + .resourceUrl(URI.create(FILE_RESOURCE_URL).toURL()) .build()) .getProxyType()).isEqualTo(Proxy.Type.DIRECT); @@ -80,7 +81,7 @@ void should_return_direct_connection_when_url_uses_file_protocol() throws Malfor @Test void should_return_direct_connection_when_url_uses_non_proxy_host() throws MalformedURLException { final Set nonProxyHosts = Set.of(PLUGIN_PROXY_HOST); - final URL resourceUrl = new URL(HTTP_RESOURCE_URL); + final URL resourceUrl = URI.create(HTTP_RESOURCE_URL).toURL(); when(isNonProxyHost.execute(IsNonProxyHostCommand .builder() .nonProxyHosts(nonProxyHosts) @@ -103,7 +104,7 @@ void should_return_direct_connection_when_url_uses_non_proxy_host() throws Malfo @Test void should_return_http_proxy_settings_when_url_uses_non_secure_http_protocol() throws MalformedURLException { final Set nonProxyHosts = Set.of(); - final URL resourceUrl = new URL(HTTP_RESOURCE_URL); + final URL resourceUrl = URI.create(HTTP_RESOURCE_URL).toURL(); when(isNonProxyHost.execute(IsNonProxyHostCommand .builder() .nonProxyHosts(nonProxyHosts) @@ -141,7 +142,7 @@ void should_return_http_proxy_settings_when_url_uses_non_secure_http_protocol() @Test void should_return_https_proxy_settings_when_url_uses_secure_http_protocol() throws MalformedURLException { final Set nonProxyHosts = Set.of(); - final URL resourceUrl = new URL(HTTPS_RESOURCE_URL); + final URL resourceUrl = URI.create(HTTPS_RESOURCE_URL).toURL(); when(isNonProxyHost.execute(IsNonProxyHostCommand .builder() .nonProxyHosts(nonProxyHosts) diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistributionTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistributionTest.java index d69b97a4..beb3d051 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistributionTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/domain/installer/ValidateNodeDistributionTest.java @@ -12,6 +12,8 @@ import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Path; import java.util.Optional; @@ -42,8 +44,8 @@ class ValidateNodeDistributionTest { static { try { - DISTRIBUTION_URL = new URL(DISTRIBUTION_BASE_URL + "node-v9.2.4-win-x64.zip"); - CHECKSUM_URL = new URL(DISTRIBUTION_BASE_URL + SHASUMS_FILE_NAME); + DISTRIBUTION_URL = URI.create(DISTRIBUTION_BASE_URL + "node-v9.2.4-win-x64.zip").toURL(); + CHECKSUM_URL = URI.create(DISTRIBUTION_BASE_URL + SHASUMS_FILE_NAME).toURL(); } catch (final MalformedURLException e) { throw new RuntimeException(e); } @@ -239,7 +241,7 @@ void should_fail_when_distribution_file_hash_is_incorrect() throws IOException, @Test void should_return_when_distribution_file_is_valid() throws IOException, NodeDistributionShasumNotFoundException, InvalidNodeDistributionException, - ResourceDownloadException { + ResourceDownloadException, URISyntaxException { when(buildTemporaryFileName.execute(SHASUMS_FILE_NAME)).thenReturn(TMP_SHASUMS_FILE_NAME); final Path downloadedShasumFilepath = temporaryDirectoryPath.resolve(SHASUMS_FILE_NAME); final String expectedHash = "0123456789abcdef"; diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverTest.java index b1775733..03483ec3 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/TarArchiverTest.java @@ -7,8 +7,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; import static org.siouan.frontendgradleplugin.domain.PlatformFixture.LOCAL_PLATFORM; +import static org.siouan.frontendgradleplugin.test.Resources.getResourcePath; import java.io.IOException; import java.io.InputStream; @@ -56,7 +56,12 @@ void should_fail_initializing_context_when_tar_archive_does_not_exist() throws I .targetDirectoryPath(targetDirectoryPath) .build(); - assertThatThrownBy(() -> archiver.initializeContext(settings)).isInstanceOf(IOException.class); + assertThatThrownBy(() -> { + try (@SuppressWarnings("unused") final TarArchiverContext tarArchiverContext = archiver.initializeContext( + settings)) { + // Do nothing since context initialization is expected to fail. + } + }).isInstanceOf(IOException.class); verifyNoMoreInteractions(fileManager); } @@ -74,9 +79,12 @@ void should_fail_initializing_context_when_uncompressing_error_occurs() throws I .build(); final IOException expectedException = new IOException(); - assertThatThrownBy( - () -> new TarArchiverWithFailure(fileManager, expectedException).initializeContext(settings)).isEqualTo( - expectedException); + assertThatThrownBy(() -> { + try (@SuppressWarnings("unused") final TarArchiverContext tarArchiverContext = new TarArchiverWithFailure( + fileManager, expectedException).initializeContext(settings)) { + // Do nothing since context initialization is expected to fail. + } + }).isEqualTo(expectedException); verify(inputStream).close(); verifyNoMoreInteractions(inputStream, fileManager); diff --git a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntryTest.java b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntryTest.java index 2312d8e9..1a2faa15 100644 --- a/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntryTest.java +++ b/plugin/src/test/java/org/siouan/frontendgradleplugin/infrastructure/archiver/ZipEntryTest.java @@ -39,7 +39,7 @@ void should_map_entry_to_directory_archive_entry(final String entryName, final i final ZipEntry entry = new ZipEntry(lowLevelEntry); - assertThat(entry.getLowLevelEntry()).isEqualTo(lowLevelEntry); + assertThat(entry.lowLevelEntry()).isEqualTo(lowLevelEntry); assertThat(entry.getName()).isEqualTo(entryName); assertThat(entry.getUnixMode()).isEqualTo(unixMode); assertThat(entry.isDirectory()).isEqualTo(directory); diff --git a/site/build.gradle.kts b/site/build.gradle.kts index e7e48879..ad4c2af9 100644 --- a/site/build.gradle.kts +++ b/site/build.gradle.kts @@ -4,12 +4,12 @@ buildscript { } dependencies { - classpath("org.siouan", "frontend-jdk17", "8.1.0") + classpath("org.siouan", "frontend-jdk21", "8.1.0") } } plugins { - id("org.siouan.frontend-jdk17") + id("org.siouan.frontend-jdk21") } frontend { diff --git a/site/src/components/property/property.vue b/site/src/components/property/property.vue index 2bea5388..a461f515 100644 --- a/site/src/components/property/property.vue +++ b/site/src/components/property/property.vue @@ -70,7 +70,7 @@ const jdkHref = computed(() => { if (props.type) { const matches = QUALIFIED_JDK_CLASS_NAME_REGEXP.exec(props.type); if (matches && matches.groups?.fqcn) { - return `https://docs.oracle.com/en/java/javase/17/docs/api/java.base/${matches.groups.fqcn.replace(/\./g, '/')}.html`; + return `https://docs.oracle.com/en/java/javase/21/docs/api/java.base/${matches.groups.fqcn.replace(/\./g, '/')}.html`; } } return null; diff --git a/site/src/components/task/install-corepack-task.vue b/site/src/components/task/install-corepack-task.vue index 438fd393..dfdd7035 100644 --- a/site/src/components/task/install-corepack-task.vue +++ b/site/src/components/task/install-corepack-task.vue @@ -31,8 +31,8 @@

As the task touches the install directory, please pay attention when using a shared distribution ( is true), because this task will impact other projects using . This may be an - expected behavior, or lead to an undesirable side-effect. + >true), because this task will impact other projects using . This may be + desirable or not depending on your situation.

The task takes advantage of Requirements

The following tools must be installed to use the plugin:

    +
  • + JDK 21 build: + 8.5+ +
  • JDK 17 build: 8.5+ @@ -42,6 +46,8 @@