From 1f0bd49675452212f1486e306ef8c7cd9480a660 Mon Sep 17 00:00:00 2001 From: Goooler Date: Tue, 15 Sep 2026 18:57:29 +0800 Subject: [PATCH] Fix NPN tests on ARM based runners ----- Bump Node to v22.14.0 in NpmTestsWithDynamicallyInstalledNpmInstallationTest Fixes 404 download failure on Windows ARM64 runners when frontend-maven-plugin attempts to download Node 18 (which has no official win-arm64 binaries on nodejs.org): ``` [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.3:install-node-and-npm (default-cli) on project spotless-maven-plugin-tests: Could not download Node.js: Got error code 404 from the server. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.3:install-node-and-npm (default-cli) on project spotless-maven-plugin-tests: Could not download Node.js: Got error code 404 from the server. Caused by: org.apache.maven.plugin.MojoFailureException: Could not download Node.js: Got error code 404 from the server. at com.github.eirslett.maven.plugins.frontend.mojo.MojoUtils.toMojoFailureException(MojoUtils.java:28) at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:103) ``` ----- Bump Node to 22.14.0 and npm to 10.9.2 in NpmTestsWithoutNpmInstallationTest Node.js official distribution did not provide Windows ARM64 (win-arm64.zip) prebuilt binaries for Node 18.x, causing download failures on Windows on ARM runners: ``` Could not determine the dependencies of task ':nodeSetup'. > Failed to query the value of task ':nodeSetup' property 'nodeArchiveFile'. > Could not resolve all files for configuration ':detachedConfiguration1'. > Could not find org.nodejs:node:18.16.1. Searched in the following locations: - https://nodejs.org/dist/v18.16.1/node-v18.16.1-win-arm64.zip ``` ----- Bump gradle-node-plugin to 7.1.0 in NpmTestsWithoutNpmInstallationTest Fixes configuration cache failure on Linux ARM runners where gradle-node-plugin 3.5.1 attempted to run `uname -m` during configuration time: ``` Caused by: org.gradle.api.InvalidUserCodeException: Starting an external process 'uname -m' during configuration time is unsupported. at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:87) at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110) at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501) at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:509) at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:363) at com.github.gradle.node.util.KotlinUtilsKt.execute(KotlinUtils.kt:14) ``` --- .../NpmTestsWithoutNpmInstallationTest.java | 16 ++++++++-------- ...ationTest_gradle_node_plugin_example_1.gradle | 6 +++--- ...ationTest_gradle_node_plugin_example_2.gradle | 4 ++-- ...hDynamicallyInstalledNpmInstallationTest.java | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java index b41331765c..2df13ef405 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2025 DiffPlug + * Copyright 2016-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,13 @@ void useNodeAndNpmFromNodeGradlePlugin() throws Exception { setFile("build.gradle").toLines( "plugins {", " id 'com.diffplug.spotless'", - " id 'com.github.node-gradle.node' version '3.5.1'", + " id 'com.github.node-gradle.node' version '7.1.0'", "}", "repositories { mavenCentral() }", "node {", " download = true", - " version = '18.16.1'", - " npmVersion = '9.5.1'", + " version = '22.14.0'", + " npmVersion = '10.9.2'", " workDir = file(\"${buildDir}/nodejs\")", " npmWorkDir = file(\"${buildDir}/npm\")", "}", @@ -106,12 +106,12 @@ void useNpmFromNodeGradlePlugin() throws Exception { setFile("build.gradle").toLines( "plugins {", " id 'com.diffplug.spotless'", - " id 'com.github.node-gradle.node' version '3.5.1'", + " id 'com.github.node-gradle.node' version '7.1.0'", "}", "repositories { mavenCentral() }", "node {", " download = true", - " version = '18.16.1'", + " version = '22.14.0'", " workDir = file(\"${buildDir}/nodejs\")", "}", "def prettierConfig = [:]", @@ -145,12 +145,12 @@ void useNpmNextToConfiguredNodePluginFromNodeGradlePlugin() throws Exception { setFile("build.gradle").toLines( "plugins {", " id 'com.diffplug.spotless'", - " id 'com.github.node-gradle.node' version '3.5.1'", + " id 'com.github.node-gradle.node' version '7.1.0'", "}", "repositories { mavenCentral() }", "node {", " download = true", - " version = '18.13.0'", + " version = '22.14.0'", " workDir = file(\"${buildDir}/nodejs\")", "}", "def prettierConfig = [:]", diff --git a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle index c0fa255bcc..67789283e3 100644 --- a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle +++ b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle @@ -4,13 +4,13 @@ */ plugins { id 'com.diffplug.spotless' - id 'com.github.node-gradle.node' version '3.5.1' + id 'com.github.node-gradle.node' version '7.1.0' } repositories { mavenCentral() } node { download = true - version = '18.16.1' - npmVersion = '9.5.1' + version = '22.14.0' + npmVersion = '10.9.2' // when setting both these directories, npm and node will be in separate directories workDir = file("${buildDir}/nodejs") npmWorkDir = file("${buildDir}/npm") diff --git a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle index 6d77bc3d69..59f694b299 100644 --- a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle +++ b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle @@ -4,12 +4,12 @@ */ plugins { id 'com.diffplug.spotless' - id 'com.github.node-gradle.node' version '3.5.1' + id 'com.github.node-gradle.node' version '7.1.0' } repositories { mavenCentral() } node { download = true - version = '18.16.1' + version = '22.14.0' // when not setting an explicit `npmWorkDir`, the npm binary will be installed next to the node binary workDir = file("${buildDir}/nodejs") } diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java index 78830bf09d..dd840796b7 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 DiffPlug + * Copyright 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public class NpmTestsWithDynamicallyInstalledNpmInstallationTest extends MavenIn @Test void useDownloadedNpmInstallation() throws Exception { writePomWithPrettierSteps( - pomPluginLines("v18.13.0", null), + pomPluginLines("v22.14.0", null), "src/main/typescript/test.ts", "", " " + installedNpmPath() + "",