From e27d64ec2743bb33ac424d39b4e79c4116ed18ac Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Thu, 1 Feb 2024 22:00:48 +0100 Subject: [PATCH 1/9] NodeSetupTask should not delete general files, only old node versions #297 --- .../github/gradle/node/task/NodeSetupTask.kt | 4 ++- .../github/gradle/AbstractIntegTest.groovy | 3 +- .../node/task/NodeSetupTask_integTest.groovy | 30 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/github/gradle/node/task/NodeSetupTask.kt b/src/main/kotlin/com/github/gradle/node/task/NodeSetupTask.kt index 0a193d0c..59c777e3 100644 --- a/src/main/kotlin/com/github/gradle/node/task/NodeSetupTask.kt +++ b/src/main/kotlin/com/github/gradle/node/task/NodeSetupTask.kt @@ -56,7 +56,9 @@ abstract class NodeSetupTask : BaseTask() { private fun deleteExistingNode() { projectHelper.delete { - delete(nodeDir.get().dir("../")) + delete(nodeDir.get().dir("../").asFileTree.matching { + include("node-v*/**") + }) } } diff --git a/src/test/groovy/com/github/gradle/AbstractIntegTest.groovy b/src/test/groovy/com/github/gradle/AbstractIntegTest.groovy index 63058189..207df14c 100644 --- a/src/test/groovy/com/github/gradle/AbstractIntegTest.groovy +++ b/src/test/groovy/com/github/gradle/AbstractIntegTest.groovy @@ -61,10 +61,11 @@ abstract class AbstractIntegTest extends Specification { return new File(temporaryFolder.getRoot(), name) } - protected final void writeFile(final String name, final String text) { + protected final File writeFile(final String name, final String text) { File file = createFile(name) file.parentFile.mkdirs() file << text + return file } protected final void writePackageJson(final String text) { diff --git a/src/test/groovy/com/github/gradle/node/task/NodeSetupTask_integTest.groovy b/src/test/groovy/com/github/gradle/node/task/NodeSetupTask_integTest.groovy index ef91ad7d..a0de1726 100644 --- a/src/test/groovy/com/github/gradle/node/task/NodeSetupTask_integTest.groovy +++ b/src/test/groovy/com/github/gradle/node/task/NodeSetupTask_integTest.groovy @@ -47,4 +47,34 @@ node { gv << GRADLE_VERSIONS_UNDER_TEST } + def 'nodeSetup should only delete old node versions (#gv.version)'() { + given: + gradleVersion = gv + + def badVersion = "node-v18.17.0" + def goodVersion = "18.17.1" + createFile("build.gradle") << """plugins { + id "com.github.node-gradle.node" + } + + node { + version = "${goodVersion}" + download = true + workDir = file("build/node") + }""" + def badFile = writeFile("build/node/$badVersion/bin/node.js", "console.log(\"bad\");") + def goodFile = writeFile("build/node/important.txt", "should not be deleted by nodeSetup") + + when: + def result1 = build("nodeSetup") + + then: + result1.task(":nodeSetup").outcome == TaskOutcome.SUCCESS + !badFile.exists() + goodFile.exists() + + where: + gv << GRADLE_VERSIONS_UNDER_TEST + } + } From 70eb5c1d013089ae99c7d86387b62adf3382b9a1 Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 2 Feb 2024 21:47:16 +0100 Subject: [PATCH 2/9] Update documentation --- CHANGELOG.md | 3 +++ README.md | 4 ++-- docs/installation.md | 4 ++-- docs/usage.md | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f14937..aafac324 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Version 7.x *(unreleased)* +## Version 7.0.2 *(2024-02-02)* +* Prevent misconfigured `workDir` from removing all unrelated files [#297](https://github.com/node-gradle/gradle-node-plugin/issues/297) + ## Version 7.0.1 *(2023-10-04)* * Adds missing `result` to NodeTask [#289](https://github.com/node-gradle/gradle-node-plugin/issues/289) diff --git a/README.md b/README.md index 5955cca9..329fd9d9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Build Status](https://github.com/node-gradle/gradle-node-plugin/workflows/Build/badge.svg?branch=master) [![License](https://img.shields.io/github/license/node-gradle/gradle-node-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) -![Version](https://img.shields.io/badge/Version-7.0.1-orange.svg) +![Version](https://img.shields.io/badge/Version-7.0.2-orange.svg) This plugin enables you to use a lot of [Node.js](https://nodejs.org)-based technologies as part of your build without having Node.js installed locally on your system. It integrates the following Node.js-based system @@ -39,7 +39,7 @@ issue to [GitHub Issues](https://github.com/node-gradle/gradle-node-plugin/issue Here's the documentation for older releases of the plugin: -* [7.0.1](https://github.com/node-gradle/gradle-node-plugin/blob/7.0.1/README.md) (current) +* [7.0.2](https://github.com/node-gradle/gradle-node-plugin/blob/7.0.2/README.md) (current) * [6.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/6.0.0/README.md) * [5.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/5.0.0/README.md) * [4.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/4.0.0/README.md) diff --git a/docs/installation.md b/docs/installation.md index 158b0192..daae414e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -5,7 +5,7 @@ in your `build.gradle` file: ```gradle plugins { - id "com.github.node-gradle.node" version "7.0.1" + id "com.github.node-gradle.node" version "7.0.2" } ``` @@ -18,7 +18,7 @@ buildscript { } dependencies { - classpath "com.github.node-gradle:gradle-node-plugin:7.0.1" + classpath "com.github.node-gradle:gradle-node-plugin:7.0.2" } } diff --git a/docs/usage.md b/docs/usage.md index 5d1954be..42ee1066 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -18,7 +18,7 @@ file (see [Installing](installation.md) for details): ```gradle plugins { - id "com.github.node-gradle.node" version "7.0.1" + id "com.github.node-gradle.node" version "7.0.2" } ``` From 8b2f4cfb049cfd8f9a1dda08f62e696457410f9e Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Wed, 31 Jul 2024 14:18:33 +0200 Subject: [PATCH 3/9] Add support for ARM64 Windows #315 This adds initial support for ARM64, but it's slightly limited as I couldn't get acquire a compatible device. The powershell invocation is somewhat slow (sometimes taking almost 700ms with my profile), which is unfortunate becuase it'd be way smoother to parse than the current os.arch solution --- CHANGELOG.md | 3 + .../com/github/gradle/node/NodePlugin.kt | 32 ++++++--- .../github/gradle/node/util/PlatformHelper.kt | 63 ++++++++++++++++- .../node/util/PlatformHelperTest.groovy | 67 ++++++++----------- 4 files changed, 117 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aafac324..46c4ccd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Version 7.x *(unreleased)* +## Version 7.0.3 *(unreleased)* +* Add support for ARM64 Windows [#315](https://github.com/node-gradle/gradle-node-plugin/issues/315) + ## Version 7.0.2 *(2024-02-02)* * Prevent misconfigured `workDir` from removing all unrelated files [#297](https://github.com/node-gradle/gradle-node-plugin/issues/297) diff --git a/src/main/kotlin/com/github/gradle/node/NodePlugin.kt b/src/main/kotlin/com/github/gradle/node/NodePlugin.kt index d9a7855c..ed10b953 100644 --- a/src/main/kotlin/com/github/gradle/node/NodePlugin.kt +++ b/src/main/kotlin/com/github/gradle/node/NodePlugin.kt @@ -16,10 +16,12 @@ import com.github.gradle.node.variant.computeNodeDir import com.github.gradle.node.yarn.task.YarnInstallTask import com.github.gradle.node.yarn.task.YarnSetupTask import com.github.gradle.node.yarn.task.YarnTask +import org.gradle.api.Action import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.provider.Property import org.gradle.kotlin.dsl.* +import org.gradle.process.ExecSpec import org.gradle.util.GradleVersion import java.io.ByteArrayOutputStream import java.io.File @@ -62,18 +64,32 @@ class NodePlugin : Plugin { } private fun addPlatform(extension: NodeExtension) { + val osType = parseOsType(System.getProperty("os.name")) + val arch = System.getProperty("os.arch") + + val unameSpec: Action = Action { + if (osType == OsType.WINDOWS) { + this.executable = "powershell" + this.args = listOf( + "-NoProfile", // Command runs in ~175ms, -NoProfile saves ~300ms + "-Command", + "(Get-WmiObject Win32_Processor).Architecture", + ) + } else { + this.executable = "uname" + this.args = listOf("-m") + } + } + val uname = { if (GradleVersion.current() >= GradleVersion.version("7.5")) { - val cmd = project.providers.exec { - this.executable = "uname" - this.args = listOf("-m") - } + val cmd = project.providers.exec(unameSpec) cmd.standardOutput.asText.get().trim() } else { val out = ByteArrayOutputStream() + project.exec(unameSpec) val cmd = project.exec { - this.executable = "uname" - this.args = listOf("-m") + unameSpec.execute(this) this.standardOutput = out } @@ -81,9 +97,7 @@ class NodePlugin : Plugin { out.toString().trim() } } - val name = System.getProperty("os.name") - val arch = System.getProperty("os.arch") - val platform = parsePlatform(name, arch, uname) + val platform = parsePlatform(osType, arch, uname) extension.resolvedPlatform.set(platform) extension.computedPlatform.convention(extension.resolvedPlatform) } diff --git a/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt b/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt index b25e27e0..b17f64b4 100644 --- a/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt +++ b/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt @@ -2,6 +2,32 @@ package com.github.gradle.node.util import java.util.concurrent.Callable +internal enum class OsType(val osName: String) { + WINDOWS("win"), + MAC("darwin"), + LINUX("linux"), + FREEBSD("linux"), // https://github.com/node-gradle/gradle-node-plugin/issues/178 + SUN("sunos"), +} + +internal fun parsePlatform(type: OsType, arch: String, uname: () -> String): Platform { + val osArch = if (type == OsType.WINDOWS) parseWindowsArch(arch.toLowerCase(), uname) + else parseOsArch(arch.toLowerCase(), uname) + return Platform(type.osName, osArch) +} + +internal fun parseOsType(type: String): OsType { + val name = type.toLowerCase() + return when { + name.contains("windows") -> OsType.WINDOWS + name.contains("mac") -> OsType.MAC + name.contains("linux") -> OsType.LINUX + name.contains("freebsd") -> OsType.FREEBSD + name.contains("sunos") -> OsType.SUN + else -> error("Unsupported OS: $name") + } +} + fun parsePlatform(name: String, arch: String, uname: () -> String): Platform { return Platform(parseOsName(name.toLowerCase()), parseOsArch(arch.toLowerCase(), uname)) } @@ -33,10 +59,45 @@ fun parseOsArch(arch: String, uname: Callable): String { } } +fun parseWindowsArch(arch: String, uname: Callable): String { + // + return when { + arch.startsWith("aarch") || arch.startsWith("arm") + -> { + val wmiArch = uname.call() + return when (wmiArch) { + /* + * Parse Win32_Processor.Architectures to real processor type + * + * Table from https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info#members + */ + "12" -> "arm64" + "9" -> "x64" + // "6" -> "IA64" + // "5" -> "arm" // 32-bit + "0" -> "x86" + // "0xffff" -> "Unknown" + else -> error("Unexpected Win32_Processor.Architecture: $arch") + } + } + arch.contains("64") -> "x64" + else -> "x86" + } +} + fun main(args: Array) { val osName = System.getProperty("os.name") val osArch = System.getProperty("os.arch") - val uname = { execute("uname", "-m", timeout = 10) } + + val osType = parseOsType(osName) + val uname = { + val args = if (osType == OsType.WINDOWS) { + listOf("powershell", "-NoProfile", "-Command", "(Get-WmiObject Win32_Processor).Architecture") + } else { + listOf("uname", "-m") + } + execute(*args.toTypedArray(), timeout = 10) + } val platform = parsePlatform(osName, osArch, uname) println("Your os.name is: '${osName}' and is parsed as: '${platform.name}'") diff --git a/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy b/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy index dd2f413e..37aa3d6b 100644 --- a/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy +++ b/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy @@ -16,53 +16,44 @@ class PlatformHelperTest extends Specification { platform.windows == isWindows where: - osProp | archProp | osName | osArch | isWindows - 'Windows 8' | 'x86' | 'win' | 'x86' | true - 'Windows 8' | 'x86_64' | 'win' | 'x64' | true - 'Mac OS X' | 'x86' | 'darwin' | 'x86' | false - 'Mac OS X' | 'x86_64' | 'darwin' | 'x64' | false - 'Linux' | 'x86' | 'linux' | 'x86' | false - 'Linux' | 'x86_64' | 'linux' | 'x64' | false - 'Linux' | 'ppc64le' | 'linux' | 'ppc64le' | false - 'Linux' | 's390x' | 'linux' | 's390x' | false - 'SunOS' | 'x86' | 'sunos' | 'x86' | false - 'SunOS' | 'x86_64' | 'sunos' | 'x64' | false + osProp | archProp || osName | osArch | isWindows + 'Windows 8' | 'x86' || 'win' | 'x86' | true + 'Windows 8' | 'x86_64' || 'win' | 'x64' | true + 'Windows 10' | 'x86_64' || 'win' | 'x64' | true + 'Mac OS X' | 'x86' || 'darwin' | 'x86' | false + 'Mac OS X' | 'x86_64' || 'darwin' | 'x64' | false + 'Linux' | 'x86' || 'linux' | 'x86' | false + 'Linux' | 'x86_64' || 'linux' | 'x64' | false + 'Linux' | 'ppc64le' || 'linux' | 'ppc64le' | false + 'Linux' | 's390x' || 'linux' | 's390x' | false + 'SunOS' | 'x86' || 'sunos' | 'x86' | false + 'SunOS' | 'x86_64' || 'sunos' | 'x64' | false } @Unroll - def "verify ARM handling #archProp (#unameProp)"() { + def "verify #osProp ARM handling #archProp (#unameProp)"() { given: - def platform = PlatformHelperKt.parsePlatform("Linux", archProp, { unameProp }) + def osType = PlatformHelperKt.parseOsType(osProp) + def platform = PlatformHelperKt.parsePlatform(osType, archProp, { unameProp }) expect: - platform.name == "linux" - platform.arch == osArch - - where: - archProp | unameProp | osArch - 'arm' | 'armv7l' | 'armv7l' // Raspberry Pi 3 - 'arm' | 'armv8l' | 'arm64' - 'aarch32' | 'arm' | 'arm' - 'aarch64' | 'arm64' | 'arm64' - 'aarch64' | 'aarch64' | 'arm64' - 'ppc64le' | 'ppc64le' | 'ppc64le' - } - - @Unroll - def "verify ARM handling Mac OS #archProp (#unameProp)"() { - given: - def platform = PlatformHelperKt.parsePlatform("Mac OS X", archProp, { unameProp }) - - expect: - platform.name == "darwin" + platform.name == osName platform.arch == osArch where: - archProp | unameProp | osArch - 'aarch32' | 'arm' | 'arm' - 'aarch64' | 'arm64' | 'arm64' - 'aarch64' | 'aarch64' | 'arm64' - 'aarch64' | 'x86_64' | 'x64' // This shouldn't really happen but according to PR #204 it does + osProp | archProp || osName | unameProp | osArch + 'Linux' | 'arm' || 'linux' | 'armv7l' | 'armv7l' // Raspberry Pi 3 + 'Linux' | 'arm' || 'linux' | 'armv8l' | 'arm64' + 'Linux' | 'aarch32' || 'linux' | 'arm' | 'arm' + 'Linux' | 'aarch64' || 'linux' | 'arm64' | 'arm64' + 'Linux' | 'aarch64' || 'linux' | 'aarch64' | 'arm64' + 'Linux' | 'ppc64le' || 'linux' | 'ppc64le' | 'ppc64le' + 'Mac OS X' | 'aarch32' || 'darwin' | 'arm' | 'arm' + 'Mac OS X' | 'aarch64' || 'darwin' | 'arm64' | 'arm64' + 'Mac OS X' | 'aarch64' || 'darwin' | 'aarch64' | 'arm64' + 'Mac OS X' | 'aarch64' || 'darwin' | 'x86_64' | 'x64' // This unfortunately happens see PR #204 + 'Windows 10' | 'aarch64' || 'win' | '12' | 'arm64' + 'Windows 11' | 'aarch64' || 'win' | '9' | 'x64' // Not sure if this can actually happen } def "throw exception if unsupported os"() { From f41c06c2cbe4b7b6b34298dbd666d2c5b79cb8dc Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 27 Sep 2024 11:23:59 +0200 Subject: [PATCH 4/9] Remove incorrect node_modules input in pnpm test fixture --- src/test/resources/fixtures/pnpm/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/resources/fixtures/pnpm/build.gradle b/src/test/resources/fixtures/pnpm/build.gradle index 713b6067..ec83fbd5 100644 --- a/src/test/resources/fixtures/pnpm/build.gradle +++ b/src/test/resources/fixtures/pnpm/build.gradle @@ -16,7 +16,6 @@ task test(type: PnpmTask) { dependsOn pnpmInstall pnpmCommand = changeInputs ? ['run', 'test'] : ['run'] args = changeInputs ? [] : ['test'] - inputs.dir('node_modules') inputs.file('package.json') inputs.files('index.js', 'test.js') outputs.upToDateWhen { From 76a5e30e6b4b96658d3bd304a73882f7b97e2033 Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 27 Sep 2024 13:45:34 +0200 Subject: [PATCH 5/9] Drop incorrect node_modules input from documentation and tests --- docs/faq.md | 2 -- src/test/resources/fixtures/kotlin/build.gradle.kts | 2 -- src/test/resources/fixtures/npm-in-subdirectory/build.gradle | 2 -- src/test/resources/fixtures/yarn-in-subdirectory/build.gradle | 1 - src/test/resources/fixtures/yarn/build.gradle | 1 - 5 files changed, 8 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 29ca132d..26d8a5ed 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -81,7 +81,6 @@ task buildWebapp(type: NpxTask) { args = ["build"] inputs.file("Gruntfile.js") inputs.dir("src") - inputs.dir("node_modules") outputs.dir("dist") } ``` @@ -105,7 +104,6 @@ task buildWebapp(type: NpxTask) { args = ["build"] inputs.file("gulpfile.js") inputs.dir("src") - inputs.dir("node_modules") outputs.dir("dist") } ``` diff --git a/src/test/resources/fixtures/kotlin/build.gradle.kts b/src/test/resources/fixtures/kotlin/build.gradle.kts index afe5235e..b99c8ec1 100644 --- a/src/test/resources/fixtures/kotlin/build.gradle.kts +++ b/src/test/resources/fixtures/kotlin/build.gradle.kts @@ -51,7 +51,6 @@ val testTaskUsingNpx = tasks.register("testNpx") { execOverrides { standardOutput = System.out } - inputs.dir("node_modules") inputs.file("package.json") inputs.dir("src") inputs.dir("test") @@ -70,7 +69,6 @@ val testTaskUsingNpm = tasks.register("testNpm") { execOverrides { standardOutput = System.out } - inputs.dir("node_modules") inputs.file("package.json") inputs.dir("src") inputs.dir("test") diff --git a/src/test/resources/fixtures/npm-in-subdirectory/build.gradle b/src/test/resources/fixtures/npm-in-subdirectory/build.gradle index 166d5bf8..d7ac7d1e 100644 --- a/src/test/resources/fixtures/npm-in-subdirectory/build.gradle +++ b/src/test/resources/fixtures/npm-in-subdirectory/build.gradle @@ -11,7 +11,6 @@ task buildNpx(type: NpxTask) { command = "babel" args = ["src", "--out-dir", "output-npx"] inputs.dir("javascript-project/src") - inputs.dir("javascript-project/node_modules") outputs.dir("javascript-project/output-npx") } @@ -20,7 +19,6 @@ task buildNpm(type: NpmTask) { npmCommand = ["run", "build"] args = ["--", "--out-dir", "output-npm"] inputs.dir("javascript-project/src") - inputs.dir("javascript-project/node_modules") outputs.dir("javascript-project/output-npm") } diff --git a/src/test/resources/fixtures/yarn-in-subdirectory/build.gradle b/src/test/resources/fixtures/yarn-in-subdirectory/build.gradle index 0352085d..ba968ada 100644 --- a/src/test/resources/fixtures/yarn-in-subdirectory/build.gradle +++ b/src/test/resources/fixtures/yarn-in-subdirectory/build.gradle @@ -11,6 +11,5 @@ task build(type: YarnTask) { yarnCommand = ["run", "build"] args = ["--out-dir", "output"] inputs.dir("javascript-project/src") - inputs.dir("javascript-project/node_modules") outputs.dir("javascript-project/output") } diff --git a/src/test/resources/fixtures/yarn/build.gradle b/src/test/resources/fixtures/yarn/build.gradle index ebf7a0bc..3d96d536 100644 --- a/src/test/resources/fixtures/yarn/build.gradle +++ b/src/test/resources/fixtures/yarn/build.gradle @@ -16,7 +16,6 @@ task test(type: YarnTask) { dependsOn yarn yarnCommand = changeInputs ? ["run", "test"] : ["run"] args = changeInputs ? [] : ["test"] - inputs.dir("node_modules") inputs.file("package.json") inputs.dir("src") inputs.dir("test") From eb67ba00cfdacf7803dda2eaed2737c9c3fa236a Mon Sep 17 00:00:00 2001 From: ritvick Date: Wed, 25 Sep 2024 12:24:11 -0400 Subject: [PATCH 6/9] Support for AIX OS on ppc64 --- src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt | 4 ++++ .../com/github/gradle/node/util/PlatformHelperTest.groovy | 1 + 2 files changed, 5 insertions(+) diff --git a/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt b/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt index b17f64b4..ad641def 100644 --- a/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt +++ b/src/main/kotlin/com/github/gradle/node/util/PlatformHelper.kt @@ -8,6 +8,7 @@ internal enum class OsType(val osName: String) { LINUX("linux"), FREEBSD("linux"), // https://github.com/node-gradle/gradle-node-plugin/issues/178 SUN("sunos"), + AIX("aix"), } internal fun parsePlatform(type: OsType, arch: String, uname: () -> String): Platform { @@ -24,6 +25,7 @@ internal fun parseOsType(type: String): OsType { name.contains("linux") -> OsType.LINUX name.contains("freebsd") -> OsType.FREEBSD name.contains("sunos") -> OsType.SUN + name.contains("aix") -> OsType.AIX else -> error("Unsupported OS: $name") } } @@ -39,6 +41,7 @@ fun parseOsName(name: String): String { name.contains("linux") -> "linux" name.contains("freebsd") -> "linux" name.contains("sunos") -> "sunos" + name.contains("aix") -> "aix" else -> error("Unsupported OS: $name") } } @@ -52,6 +55,7 @@ fun parseOsArch(arch: String, uname: Callable): String { arch == "arm" || arch.startsWith("aarch") -> uname.call() .mapIf({ it == "armv8l" || it == "aarch64" }) { "arm64" } .mapIf({ it == "x86_64" }) {"x64"} + arch == "ppc64" -> "ppc64" arch == "ppc64le" -> "ppc64le" arch == "s390x" -> "s390x" arch.contains("64") -> "x64" diff --git a/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy b/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy index 37aa3d6b..ecf9d6f8 100644 --- a/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy +++ b/src/test/groovy/com/github/gradle/node/util/PlatformHelperTest.groovy @@ -28,6 +28,7 @@ class PlatformHelperTest extends Specification { 'Linux' | 's390x' || 'linux' | 's390x' | false 'SunOS' | 'x86' || 'sunos' | 'x86' | false 'SunOS' | 'x86_64' || 'sunos' | 'x64' | false + 'AIX' | 'ppc64' || 'aix' | 'ppc64' | false } @Unroll From a4a882c59c3a560d74a9f52c26403a6a6ca20d7a Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 27 Sep 2024 14:11:27 +0200 Subject: [PATCH 7/9] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46c4ccd1..48cec9fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Version 7.0.3 *(unreleased)* * Add support for ARM64 Windows [#315](https://github.com/node-gradle/gradle-node-plugin/issues/315) +* Add support for AIX [#320](https://github.com/node-gradle/gradle-node-plugin/issues/320) ## Version 7.0.2 *(2024-02-02)* * Prevent misconfigured `workDir` from removing all unrelated files [#297](https://github.com/node-gradle/gradle-node-plugin/issues/297) From e7090ee302a76f24799705058351286aa05ea228 Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 27 Sep 2024 14:15:19 +0200 Subject: [PATCH 8/9] Add license to POM #319 --- CHANGELOG.md | 3 ++- build.gradle.kts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48cec9fd..f0866202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## Version 7.x *(unreleased)* -## Version 7.0.3 *(unreleased)* +## Version 7.1.0 *(unreleased)* * Add support for ARM64 Windows [#315](https://github.com/node-gradle/gradle-node-plugin/issues/315) * Add support for AIX [#320](https://github.com/node-gradle/gradle-node-plugin/issues/320) +* Add license to publications POM [#319](https://github.com/node-gradle/gradle-node-plugin/issues/319) ## Version 7.0.2 *(2024-02-02)* * Prevent misconfigured `workDir` from removing all unrelated files [#297](https://github.com/node-gradle/gradle-node-plugin/issues/297) diff --git a/build.gradle.kts b/build.gradle.kts index 807c779e..55ed4cbf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -182,3 +182,12 @@ pluginBundle { tasks.wrapper { distributionType = Wrapper.DistributionType.ALL } + +publishing.publications.withType().configureEach { + pom.licenses { + license { + name.set("Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } +} From a319f0e05c8d29d9ffb7042b98db0c41999a7846 Mon Sep 17 00:00:00 2001 From: Alex Nordlund Date: Fri, 27 Sep 2024 14:53:14 +0200 Subject: [PATCH 9/9] 7.1.0 --- CHANGELOG.md | 2 +- README.md | 5 +++-- docs/installation.md | 4 ++-- docs/usage.md | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0866202..21a9ea4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Version 7.x *(unreleased)* -## Version 7.1.0 *(unreleased)* +## Version 7.1.0 *(2024-09-27)* * Add support for ARM64 Windows [#315](https://github.com/node-gradle/gradle-node-plugin/issues/315) * Add support for AIX [#320](https://github.com/node-gradle/gradle-node-plugin/issues/320) * Add license to publications POM [#319](https://github.com/node-gradle/gradle-node-plugin/issues/319) diff --git a/README.md b/README.md index 329fd9d9..7854fef7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Build Status](https://github.com/node-gradle/gradle-node-plugin/workflows/Build/badge.svg?branch=master) [![License](https://img.shields.io/github/license/node-gradle/gradle-node-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) -![Version](https://img.shields.io/badge/Version-7.0.2-orange.svg) +![Version](https://img.shields.io/badge/Version-7.1.0-orange.svg) This plugin enables you to use a lot of [Node.js](https://nodejs.org)-based technologies as part of your build without having Node.js installed locally on your system. It integrates the following Node.js-based system @@ -39,7 +39,8 @@ issue to [GitHub Issues](https://github.com/node-gradle/gradle-node-plugin/issue Here's the documentation for older releases of the plugin: -* [7.0.2](https://github.com/node-gradle/gradle-node-plugin/blob/7.0.2/README.md) (current) +* [7.1.0](https://github.com/node-gradle/gradle-node-plugin/blob/7.1.0/README.md) (current) +* [7.0.2](https://github.com/node-gradle/gradle-node-plugin/blob/7.0.2/README.md) * [6.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/6.0.0/README.md) * [5.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/5.0.0/README.md) * [4.0.0](https://github.com/node-gradle/gradle-node-plugin/blob/4.0.0/README.md) diff --git a/docs/installation.md b/docs/installation.md index daae414e..aad6a6e9 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -5,7 +5,7 @@ in your `build.gradle` file: ```gradle plugins { - id "com.github.node-gradle.node" version "7.0.2" + id "com.github.node-gradle.node" version "7.1.0" } ``` @@ -18,7 +18,7 @@ buildscript { } dependencies { - classpath "com.github.node-gradle:gradle-node-plugin:7.0.2" + classpath "com.github.node-gradle:gradle-node-plugin:7.1.0" } } diff --git a/docs/usage.md b/docs/usage.md index 42ee1066..90619f1c 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -18,7 +18,7 @@ file (see [Installing](installation.md) for details): ```gradle plugins { - id "com.github.node-gradle.node" version "7.0.2" + id "com.github.node-gradle.node" version "7.1.0" } ```