@nx/gradle 22.6.1 → 22.6.3
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/batch-runner/build/libs/gradle-batch-runner-all.jar +0 -0
- package/batch-runner/build/libs/gradle-batch-runner.jar +0 -0
- package/batch-runner/build/nx/gradle-batch-runner.json +1 -1
- package/package.json +3 -3
- package/project-graph/build/nx/gradle-project-graph.json +1 -1
- package/src/plugin/utils/get-project-graph-lines.d.ts +1 -0
- package/src/plugin/utils/get-project-graph-lines.d.ts.map +1 -1
- package/src/plugin/utils/get-project-graph-lines.js +32 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { GradlePluginOptions } from './gradle-plugin-options';
|
|
2
|
+
export declare function getGraphTimeoutMs(): number;
|
|
2
3
|
export declare function getNxProjectGraphLines(gradlewFile: string, gradleConfigHash: string, gradlePluginOptions: GradlePluginOptions): Promise<string[]>;
|
|
3
4
|
//# sourceMappingURL=get-project-graph-lines.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-graph-lines.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-lines.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-project-graph-lines.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-lines.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,wBAAgB,iBAAiB,IAAI,MAAM,CAS1C;AAED,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,mBAAmB,GACvC,OAAO,CAAC,MAAM,EAAE,CAAC,CAoGnB"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGraphTimeoutMs = getGraphTimeoutMs;
|
|
3
4
|
exports.getNxProjectGraphLines = getNxProjectGraphLines;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const exec_gradle_1 = require("../../utils/exec-gradle");
|
|
7
|
+
const DEFAULT_GRAPH_TIMEOUT_SECONDS = 60;
|
|
8
|
+
function getGraphTimeoutMs() {
|
|
9
|
+
const envTimeout = process.env.NX_GRADLE_PROJECT_GRAPH_TIMEOUT;
|
|
10
|
+
if (envTimeout) {
|
|
11
|
+
const parsed = Number(envTimeout);
|
|
12
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
13
|
+
return parsed * 1000;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return DEFAULT_GRAPH_TIMEOUT_SECONDS * 1000;
|
|
17
|
+
}
|
|
6
18
|
async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePluginOptions) {
|
|
7
19
|
let nxProjectGraphBuffer;
|
|
8
20
|
const gradlePluginOptionsArgs = Object.entries(gradlePluginOptions ?? {})?.map(([key, value]) => `-P${key}=${value}`) ?? [];
|
|
21
|
+
const timeoutMs = getGraphTimeoutMs();
|
|
22
|
+
const timeoutSeconds = timeoutMs / 1000;
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
9
25
|
try {
|
|
10
26
|
nxProjectGraphBuffer = await (0, exec_gradle_1.execGradleAsync)(gradlewFile, [
|
|
11
27
|
'nxProjectGraph',
|
|
@@ -18,10 +34,21 @@ async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePlugi
|
|
|
18
34
|
...gradlePluginOptionsArgs,
|
|
19
35
|
`-PworkspaceRoot=${devkit_1.workspaceRoot}`,
|
|
20
36
|
process.env.NX_GRADLE_VERBOSE_LOGGING ? '--info' : '',
|
|
21
|
-
]);
|
|
37
|
+
], { signal: controller.signal });
|
|
22
38
|
}
|
|
23
39
|
catch (e) {
|
|
24
|
-
if (
|
|
40
|
+
if (controller.signal.aborted) {
|
|
41
|
+
throw new devkit_1.AggregateCreateNodesError([
|
|
42
|
+
[
|
|
43
|
+
gradlewFile,
|
|
44
|
+
new Error(`Gradle project graph generation timed out after ${timeoutSeconds} ${timeoutSeconds === 1 ? 'second' : 'seconds'}.\n` +
|
|
45
|
+
` 1. Run "gradlew --stop" to stop the Gradle daemon, then run "gradlew clean" to clear the build cache.\n` +
|
|
46
|
+
` 2. If the issue persists, set the environment variable NX_GRADLE_PROJECT_GRAPH_TIMEOUT to a higher value (in seconds) to increase the timeout.\n` +
|
|
47
|
+
` 3. If the issue still persists, set NX_GRADLE_DISABLE=true to disable the Gradle plugin entirely.`),
|
|
48
|
+
],
|
|
49
|
+
], []);
|
|
50
|
+
}
|
|
51
|
+
else if (e.toString()?.includes('ERROR: JAVA_HOME')) {
|
|
25
52
|
throw new devkit_1.AggregateCreateNodesError([
|
|
26
53
|
[
|
|
27
54
|
gradlewFile,
|
|
@@ -46,6 +73,9 @@ async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePlugi
|
|
|
46
73
|
], []);
|
|
47
74
|
}
|
|
48
75
|
}
|
|
76
|
+
finally {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
}
|
|
49
79
|
const projectGraphLines = nxProjectGraphBuffer
|
|
50
80
|
.toString()
|
|
51
81
|
.split(exec_gradle_1.newLineSeparator)
|