From 38e30d5e54a2251f26a00da9b4f99caba9be316c Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sun, 4 Aug 2024 16:10:18 -0700 Subject: [PATCH 1/3] Bump blowdryer versions. --- settings.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.gradle b/settings.gradle index 7e84ced..a949517 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,7 +10,7 @@ plugins { // https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md id 'com.diffplug.spotless' version '7.0.0.BETA1' apply false // https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md - id 'com.diffplug.spotless-changelog' version '3.0.2' apply false + id 'com.diffplug.spotless-changelog' version '3.1.2' apply false // https://plugins.gradle.org/plugin/com.gradle.plugin-publish id 'com.gradle.plugin-publish' version '1.2.1' apply false // https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md @@ -29,7 +29,7 @@ plugins { id 'dev.adamko.dokkatoo-html' version '2.3.1' apply false } blowdryerSetup { - github 'diffplug/blowdryer-diffplug', 'tag', '7.3.0' + github 'diffplug/blowdryer-diffplug', 'tag', '8.0.1' //devLocal '../blowdryer-diffplug' setPluginsBlockTo { it.file 'plugin.versions' From 1025ce44be78f730f400a811f4b5bb08611c2425 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sun, 4 Aug 2024 16:10:50 -0700 Subject: [PATCH 2/3] Make it possible to set environment variables for npm run tasks. --- .../java/com/diffplug/webtools/node/NodePlugin.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/diffplug/webtools/node/NodePlugin.java b/src/main/java/com/diffplug/webtools/node/NodePlugin.java index 03be667..258c44b 100644 --- a/src/main/java/com/diffplug/webtools/node/NodePlugin.java +++ b/src/main/java/com/diffplug/webtools/node/NodePlugin.java @@ -22,11 +22,11 @@ import java.nio.file.Files; import java.util.Collections; import java.util.Objects; +import java.util.TreeMap; import org.gradle.api.Action; import org.gradle.api.DefaultTask; import org.gradle.api.Plugin; import org.gradle.api.Project; -import org.gradle.api.Task; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.CacheableTask; @@ -52,7 +52,7 @@ public Extension(Project project) { this.project = Objects.requireNonNull(project); } - public TaskProvider npm_run(String name, Action taskConfig) { + public TaskProvider npm_run(String name, Action taskConfig) { return project.getTasks().register("npm_run_" + name, NpmRunTask.class, task -> { task.taskName = name; try { @@ -76,12 +76,18 @@ public TaskProvider npm_run(String name, Action taskConfig) { @CacheableTask public abstract static class NpmRunTask extends DefaultTask { public String taskName; + private TreeMap environment = new TreeMap<>(); @Input public String getTaskName() { return taskName; } + @Input + public TreeMap getEnvironment() { + return environment; + } + @Internal public abstract Property getSetup(); @@ -95,7 +101,7 @@ public void npmCiRunTask() throws Exception { setup.start(getProjectDir().get().getAsFile()); // run the gulp task ProxyConfig proxyConfig = new ProxyConfig(Collections.emptyList()); - setup.factory().getNpmRunner(proxyConfig, null).execute("run " + taskName, null); + setup.factory().getNpmRunner(proxyConfig, null).execute("run " + taskName, environment); } } From 2c663bd7b4f58ab43ff6b4e15e02078bf8e69183 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sun, 4 Aug 2024 16:16:51 -0700 Subject: [PATCH 3/3] Update changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 583e0b4..50bcc25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Webtools releases ## [Unreleased] +### Added +- Make it possible to set environment variables for npm run tasks. ([#2](https://github.com/diffplug/webtools/pull/2)) ## [1.0.0] - 2024-07-05 ### Fixed