@nx/gradle 22.7.7 → 22.7.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/gradle",
3
- "version": "22.7.7",
3
+ "version": "22.7.9",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
6
6
  "repository": {
@@ -40,13 +40,13 @@
40
40
  "migrations": "./migrations.json"
41
41
  },
42
42
  "dependencies": {
43
- "@nx/devkit": "22.7.7",
43
+ "@nx/devkit": "22.7.9",
44
44
  "toml-eslint-parser": "^0.10.0",
45
45
  "tree-kill": "^1.2.2",
46
46
  "tslib": "^2.3.0"
47
47
  },
48
48
  "devDependencies": {
49
- "nx": "22.7.7"
49
+ "nx": "22.7.9"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  import { NxJsonConfiguration } from '@nx/devkit';
2
- import { ExecFileOptions } from 'node:child_process';
2
+ import { SpawnOptions } from 'node:child_process';
3
3
  export declare const fileSeparator: string;
4
4
  export declare const newLineSeparator: string;
5
5
  /**
@@ -14,7 +14,7 @@ export declare function getGradleExecFile(): string;
14
14
  * @param execOptions exec options
15
15
  * @returns promise with the stdout buffer
16
16
  */
17
- export declare function execGradleAsync(gradleBinaryPath: string, args: ReadonlyArray<string>, execOptions?: ExecFileOptions): Promise<Buffer>;
17
+ export declare function execGradleAsync(gradleBinaryPath: string, args: ReadonlyArray<string>, execOptions?: Omit<SpawnOptions, 'shell'>): Promise<Buffer>;
18
18
  export declare function getCustomGradleExecutableDirectoryFromPlugin(nxJson: NxJsonConfiguration): string | undefined;
19
19
  /**
20
20
  * This function recursively finds the nearest gradlew file in the workspace
@@ -1 +1 @@
1
- {"version":3,"file":"exec-gradle.d.ts","sourceRoot":"","sources":["../../../../../packages/gradle/src/utils/exec-gradle.ts"],"names":[],"mappings":"AAA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CAAC,MAAM,CAAC,EAC3B,WAAW,GAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAM,GAC5C,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED,wBAAgB,4CAA4C,CAC1D,MAAM,EAAE,mBAAmB,GAC1B,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,yBAAyB,CAAC,EAAE,MAAM,GACjC,MAAM,CASR;AAED,wBAAgB,iCAAiC,CAC/C,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,MAAM,UAoC3B;AAED,wBAAgB,yCAAyC,CACvD,+BAA+B,EAAE,MAAM,EACvC,aAAa,EAAE,MAAM,UAqCtB"}
@@ -9,11 +9,9 @@ exports.findGradlewUsingFilePathTraversal = findGradlewUsingFilePathTraversal;
9
9
  exports.findGradlewUsingCustomExecutableDirectory = findGradlewUsingCustomExecutableDirectory;
10
10
  const tslib_1 = require("tslib");
11
11
  const devkit_1 = require("@nx/devkit");
12
- const node_child_process_1 = require("node:child_process");
13
12
  const node_fs_1 = require("node:fs");
14
13
  const node_path_1 = require("node:path");
15
- const run_commands_impl_1 = require("nx/src/executors/run-commands/run-commands.impl");
16
- const exit_codes_1 = require("nx/src/utils/exit-codes");
14
+ const internal_1 = require("@nx/devkit/internal");
17
15
  const tree_kill_1 = tslib_1.__importDefault(require("tree-kill"));
18
16
  exports.fileSeparator = process.platform.startsWith('win')
19
17
  ? 'file:///'
@@ -40,16 +38,14 @@ function execGradleAsync(gradleBinaryPath, args, execOptions = {}) {
40
38
  // instead of Node's default which only kills the immediate child.
41
39
  const { signal, ...restOptions } = execOptions;
42
40
  return new Promise((res, rej) => {
43
- const cp = (0, node_child_process_1.execFile)(gradleBinaryPath, args, {
41
+ // Without the filter, empty args reach gradle as literal empty arguments.
42
+ const cp = (0, internal_1.safeSpawn)(gradleBinaryPath, args.filter(Boolean), {
44
43
  cwd: (0, node_path_1.dirname)(gradleBinaryPath),
45
- shell: true,
46
- windowsHide: true,
47
44
  env: process.env,
48
- maxBuffer: run_commands_impl_1.LARGE_BUFFER,
49
45
  ...restOptions,
50
- }, undefined);
46
+ });
51
47
  // Use tree-kill on abort to kill the entire process tree
52
- // (cmd.exe → gradlew.bat → java.exe), not just the shell.
48
+ // (gradlew spawns java), not just the direct child.
53
49
  const onAbort = () => {
54
50
  if (cp.pid) {
55
51
  (0, tree_kill_1.default)(cp.pid);
@@ -63,10 +59,16 @@ function execGradleAsync(gradleBinaryPath, args, execOptions = {}) {
63
59
  cp.stderr?.on('data', (data) => {
64
60
  stdout += data;
65
61
  });
62
+ // Without a shell the child is gradlew itself, so spawn can fail outright —
63
+ // Node then emits `error` and never `exit`.
64
+ cp.on('error', (err) => {
65
+ signal?.removeEventListener('abort', onAbort);
66
+ rej(err);
67
+ });
66
68
  cp.on('exit', (code, s) => {
67
69
  signal?.removeEventListener('abort', onAbort);
68
70
  if (code === null)
69
- code = (0, exit_codes_1.signalToCode)(s);
71
+ code = (0, internal_1.signalToCode)(s);
70
72
  if (code === 0) {
71
73
  res(stdout);
72
74
  }