@nx/gradle 21.0.0-canary.20250501-8f50358 → 21.0.0-canary.20250502-110614d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/executors.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "batchImplementation": "./src/executors/gradle/gradle-batch.impl",
5
5
  "implementation": "./src/executors/gradle/gradle.impl",
6
6
  "schema": "./src/executors/gradle/schema.json",
7
- "description": "The Gradlew executor is used to run Gradle tasks."
7
+ "description": "Runs gradle tasks via the Gradle Tooling API or by invoking gradlew."
8
8
  }
9
9
  }
10
10
  }
package/migrations.json CHANGED
@@ -23,6 +23,12 @@
23
23
  "cli": "nx",
24
24
  "description": "Change @nx/gradle plugin to version 1",
25
25
  "factory": "./src/migrations/21-0-0/change-plugin-to-v1"
26
+ },
27
+ "change-ciTargetName-to-ciTestTargetName": {
28
+ "version": "21.0.0-beta.13",
29
+ "cli": "nx",
30
+ "description": "Change @nx/gradle option from ciTargetName to ciTestTargetName",
31
+ "factory": "./src/migrations/21-0-0/change-ciTargetName-to-ciTestTargetName"
26
32
  }
27
33
  },
28
34
  "packageJsonUpdates": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/gradle",
3
- "version": "21.0.0-canary.20250501-8f50358",
3
+ "version": "21.0.0-canary.20250502-110614d",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "migrations": "./migrations.json"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "21.0.0-canary.20250501-8f50358"
38
+ "@nx/devkit": "21.0.0-canary.20250502-110614d"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -7,6 +7,7 @@ const run_commands_impl_1 = require("nx/src/executors/run-commands/run-commands.
7
7
  const exec_gradle_1 = require("../../utils/exec-gradle");
8
8
  const path_1 = require("path");
9
9
  const child_process_1 = require("child_process");
10
+ const pseudo_terminal_1 = require("nx/src/tasks-runner/pseudo-terminal");
10
11
  exports.batchRunnerPath = (0, path_1.join)(__dirname, '../../../batch-runner/build/libs/batch-runner-all.jar');
11
12
  async function gradleBatch(taskGraph, inputs, overrides, context) {
12
13
  try {
@@ -34,13 +35,35 @@ async function gradleBatch(taskGraph, inputs, overrides, context) {
34
35
  return gradlewTasksToRun;
35
36
  }, {});
36
37
  const gradlewBatchStart = performance.mark(`gradlew-batch:start`);
37
- const batchResults = (0, child_process_1.execSync)(`java -jar ${exports.batchRunnerPath} --tasks='${JSON.stringify(gradlewTasksToRun)}' --workspaceRoot=${root} --args='${args
38
+ const usePseudoTerminal = process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
39
+ pseudo_terminal_1.PseudoTerminal.isSupported();
40
+ const command = `java -jar ${exports.batchRunnerPath} --tasks='${JSON.stringify(gradlewTasksToRun)}' --workspaceRoot=${root} --args='${args
38
41
  .join(' ')
39
- .replaceAll("'", '"')}' ${process.env.NX_VERBOSE_LOGGING === 'true' ? '' : '--quiet'}`, {
40
- windowsHide: true,
41
- env: process.env,
42
- maxBuffer: run_commands_impl_1.LARGE_BUFFER,
43
- });
42
+ .replaceAll("'", '"')}' ${process.env.NX_VERBOSE_LOGGING === 'true' ? '' : '--quiet'}`;
43
+ let batchResults;
44
+ if (usePseudoTerminal) {
45
+ const terminal = (0, pseudo_terminal_1.createPseudoTerminal)();
46
+ await terminal.init();
47
+ const cp = terminal.runCommand(command, {
48
+ cwd: devkit_1.workspaceRoot,
49
+ jsEnv: process.env,
50
+ quiet: process.env.NX_VERBOSE_LOGGING !== 'true',
51
+ });
52
+ const results = await cp.getResults();
53
+ batchResults = results.terminalOutput;
54
+ batchResults = batchResults.replace(command, '');
55
+ const startIndex = batchResults.indexOf('{');
56
+ const endIndex = batchResults.lastIndexOf('}');
57
+ batchResults = batchResults.substring(startIndex, endIndex + 1);
58
+ }
59
+ else {
60
+ batchResults = (0, child_process_1.execSync)(command, {
61
+ cwd: devkit_1.workspaceRoot,
62
+ windowsHide: true,
63
+ env: process.env,
64
+ maxBuffer: run_commands_impl_1.LARGE_BUFFER,
65
+ }).toString();
66
+ }
44
67
  const gradlewBatchEnd = performance.mark(`gradlew-batch:end`);
45
68
  performance.measure(`gradlew-batch`, gradlewBatchStart.name, gradlewBatchEnd.name);
46
69
  const gradlewBatchResults = JSON.parse(batchResults.toString());
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): void;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const has_gradle_plugin_1 = require("../../utils/has-gradle-plugin");
6
+ /* This function changes the @nx/gradle plugin option from ciTargetName to ciTestTargetName
7
+ */
8
+ function update(tree) {
9
+ const nxJson = (0, devkit_1.readNxJson)(tree);
10
+ if (!nxJson) {
11
+ return;
12
+ }
13
+ if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) {
14
+ return;
15
+ }
16
+ let gradlePluginIndex = nxJson.plugins.findIndex((p) => typeof p === 'string' ? p === '@nx/gradle' : p.plugin === '@nx/gradle');
17
+ let gradlePlugin = nxJson.plugins[gradlePluginIndex];
18
+ if (typeof gradlePlugin === 'object' &&
19
+ gradlePlugin.plugin === '@nx/gradle') {
20
+ const ciTargetName = gradlePlugin.options?.['ciTargetName'];
21
+ if (ciTargetName) {
22
+ delete gradlePlugin.options?.['ciTargetName'];
23
+ gradlePlugin.options['ciTestTargetName'] =
24
+ ciTargetName;
25
+ }
26
+ }
27
+ (0, devkit_1.updateNxJson)(tree, nxJson);
28
+ }
@@ -6,6 +6,7 @@ const node_path_1 = require("node:path");
6
6
  const get_project_graph_from_gradle_plugin_1 = require("./utils/get-project-graph-from-gradle-plugin");
7
7
  const split_config_files_1 = require("../utils/split-config-files");
8
8
  const workspace_context_1 = require("nx/src/utils/workspace-context");
9
+ const node_fs_1 = require("node:fs");
9
10
  const createDependencies = async (options, context) => {
10
11
  const files = await (0, workspace_context_1.globWithWorkspaceContext)(devkit_1.workspaceRoot, Array.from(split_config_files_1.GRALDEW_FILES));
11
12
  const { gradlewFiles } = (0, split_config_files_1.splitConfigFiles)(files);
@@ -18,7 +19,9 @@ const createDependencies = async (options, context) => {
18
19
  const sourceProjectName = Object.values(context.projects).find((project) => source === project.root)?.name ?? dependencyFromPlugin.source;
19
20
  const target = (0, node_path_1.relative)(devkit_1.workspaceRoot, dependencyFromPlugin.target) || '.';
20
21
  const targetProjectName = Object.values(context.projects).find((project) => target === project.root)?.name ?? dependencyFromPlugin.target;
21
- if (!sourceProjectName || !targetProjectName) {
22
+ if (!sourceProjectName ||
23
+ !targetProjectName ||
24
+ !(0, node_fs_1.existsSync)(dependencyFromPlugin.sourceFile)) {
22
25
  return;
23
26
  }
24
27
  const dependency = {