@nx/gradle 22.7.0-beta.1 → 22.7.0-beta.10
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/migrations.json +18 -0
- package/package.json +9 -8
- package/src/executors/gradle/get-exclude-task.d.ts +6 -6
- package/src/executors/gradle/get-exclude-task.d.ts.map +1 -1
- package/src/executors/gradle/get-exclude-task.js +41 -36
- package/src/executors/gradle/gradle-batch.impl.d.ts.map +1 -1
- package/src/executors/gradle/gradle-batch.impl.js +24 -20
- package/src/executors/gradle/gradle.impl.js +3 -2
- package/src/migrations/22-7-0/change-plugin-version-0-1-16.d.ts +3 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-16.d.ts.map +1 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-16.js +23 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-17.d.ts +3 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-17.d.ts.map +1 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-17.js +23 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-18.d.ts +3 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-18.d.ts.map +1 -0
- package/src/migrations/22-7-0/change-plugin-version-0-1-18.js +23 -0
- package/src/plugin/utils/get-project-graph-from-gradle-plugin.d.ts.map +1 -1
- package/src/plugin/utils/get-project-graph-from-gradle-plugin.js +19 -8
- package/src/plugin/utils/get-project-graph-lines.d.ts +6 -0
- package/src/plugin/utils/get-project-graph-lines.d.ts.map +1 -1
- package/src/plugin/utils/get-project-graph-lines.js +53 -2
- package/src/utils/exec-gradle.d.ts.map +1 -1
- package/src/utils/exec-gradle.js +17 -3
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/batch-runner/build/nx/gradle-batch-runner.json +0 -1
- package/batch-runner/project.json +0 -4
- package/project-graph/build/nx/gradle-project-graph.json +0 -1
- package/project-graph/project.json +0 -28
- package/project-graph/publish-maven.d.ts +0 -2
- package/project-graph/publish-maven.d.ts.map +0 -1
- package/project-graph/publish-maven.js +0 -103
- package/src/plugin/utils/__mocks__/gradle_composite.json +0 -39
- package/src/plugin/utils/__mocks__/gradle_nx_list.json +0 -590
- package/src/plugin/utils/__mocks__/gradle_tutorial.json +0 -345
|
Binary file
|
|
Binary file
|
package/migrations.json
CHANGED
|
@@ -101,6 +101,24 @@
|
|
|
101
101
|
"cli": "nx",
|
|
102
102
|
"description": "Change dev.nx.gradle.project-graph to version 0.1.15 in build file",
|
|
103
103
|
"factory": "./src/migrations/22-6-0/change-plugin-version-0-1-15"
|
|
104
|
+
},
|
|
105
|
+
"change-plugin-version-0-1-16": {
|
|
106
|
+
"version": "22.7.0-beta.2",
|
|
107
|
+
"cli": "nx",
|
|
108
|
+
"description": "Change dev.nx.gradle.project-graph to version 0.1.16 in build file",
|
|
109
|
+
"factory": "./src/migrations/22-7-0/change-plugin-version-0-1-16"
|
|
110
|
+
},
|
|
111
|
+
"change-plugin-version-0-1-17": {
|
|
112
|
+
"version": "22.7.0-beta.4",
|
|
113
|
+
"cli": "nx",
|
|
114
|
+
"description": "Change dev.nx.gradle.project-graph to version 0.1.17 in build file",
|
|
115
|
+
"factory": "./src/migrations/22-7-0/change-plugin-version-0-1-17"
|
|
116
|
+
},
|
|
117
|
+
"change-plugin-version-0-1-18": {
|
|
118
|
+
"version": "22.7.0-beta.9",
|
|
119
|
+
"cli": "nx",
|
|
120
|
+
"description": "Change dev.nx.gradle.project-graph to version 0.1.18 in build file",
|
|
121
|
+
"factory": "./src/migrations/22-7-0/change-plugin-version-0-1-18"
|
|
104
122
|
}
|
|
105
123
|
},
|
|
106
124
|
"packageJsonUpdates": {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/gradle",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"Backend"
|
|
17
17
|
],
|
|
18
18
|
"main": "./index.js",
|
|
19
|
-
"
|
|
19
|
+
"type": "commonjs",
|
|
20
|
+
"types": "./index.d.ts",
|
|
20
21
|
"author": "Victor Savkin",
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"bugs": {
|
|
@@ -39,16 +40,16 @@
|
|
|
39
40
|
"migrations": "./migrations.json"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@nx/devkit": "22.7.0-beta.
|
|
43
|
-
"toml-eslint-parser": "^0.10.0"
|
|
43
|
+
"@nx/devkit": "22.7.0-beta.10",
|
|
44
|
+
"toml-eslint-parser": "^0.10.0",
|
|
45
|
+
"tree-kill": "^1.2.2",
|
|
46
|
+
"tslib": "^2.3.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"nx": "22.7.0-beta.
|
|
49
|
+
"nx": "22.7.0-beta.10"
|
|
47
50
|
},
|
|
48
51
|
"publishConfig": {
|
|
49
52
|
"access": "public"
|
|
50
53
|
},
|
|
51
|
-
"executors": "./executors.json"
|
|
52
|
-
"types": "./index.d.ts",
|
|
53
|
-
"type": "commonjs"
|
|
54
|
+
"executors": "./executors.json"
|
|
54
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProjectGraphProjectNode } from 'nx/
|
|
1
|
+
import { ProjectGraphProjectNode, Target } from '@nx/devkit';
|
|
2
2
|
/**
|
|
3
3
|
* Returns Gradle CLI arguments to exclude dependent tasks
|
|
4
4
|
* that are not part of the current execution set.
|
|
@@ -6,13 +6,13 @@ import { ProjectGraphProjectNode } from 'nx/src/config/project-graph';
|
|
|
6
6
|
* For example, if a project defines `dependsOn: ['lint']` for the `test` target,
|
|
7
7
|
* and only `test` is running, this will return: ['lint']
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param tasks - Set of Target to process
|
|
10
10
|
* @param nodes - Project graph nodes
|
|
11
|
-
* @param
|
|
11
|
+
* @param runningTasks - Set of Target that are currently running (won't be excluded)
|
|
12
12
|
* @param includeDependsOnTasks - Set of Gradle task names that should be included (not excluded)
|
|
13
13
|
* (typically provider-based dependencies that Gradle must resolve)
|
|
14
14
|
*/
|
|
15
|
-
export declare function getExcludeTasks(
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function getAllDependsOn(nodes: Record<string, ProjectGraphProjectNode>, projectName: string, targetName: string): Set<
|
|
15
|
+
export declare function getExcludeTasks(tasks: Set<Target>, nodes: Record<string, ProjectGraphProjectNode>, runningTasks?: Set<Target>, includeDependsOnTasks?: Set<string>): Set<string>;
|
|
16
|
+
export declare function getGradleTaskName(pt: Target, nodes: Record<string, ProjectGraphProjectNode>): string | null;
|
|
17
|
+
export declare function getAllDependsOn(nodes: Record<string, ProjectGraphProjectNode>, projectName: string, targetName: string): Set<Target>;
|
|
18
18
|
//# sourceMappingURL=get-exclude-task.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-exclude-task.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/get-exclude-task.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get-exclude-task.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/get-exclude-task.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,MAAM,EAEP,MAAM,YAAY,CAAC;AA+BpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,YAAY,GAAE,GAAG,CAAC,MAAM,CAAa,EACrC,qBAAqB,GAAE,GAAG,CAAC,MAAM,CAAa,GAC7C,GAAG,CAAC,MAAM,CAAC,CAsBb;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAC7C,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,CAAC,CAgCb"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getExcludeTasks = getExcludeTasks;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getGradleTaskName = getGradleTaskName;
|
|
5
5
|
exports.getAllDependsOn = getAllDependsOn;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
/**
|
|
7
|
-
* Resolves a dependsOn entry to
|
|
8
|
-
* Handles both string format ("
|
|
8
|
+
* Resolves a dependsOn entry to a Target.
|
|
9
|
+
* Handles both string format ("target") and object format
|
|
9
10
|
* ({ target: "name", projects?: ["proj1"] }).
|
|
10
11
|
* For same-project object deps (no projects field), uses the owning project name.
|
|
11
12
|
*/
|
|
12
|
-
function
|
|
13
|
+
function resolveDepToTarget(dep, owningProject) {
|
|
13
14
|
if (typeof dep === 'string') {
|
|
14
|
-
return dep;
|
|
15
|
+
return { project: owningProject, target: dep };
|
|
15
16
|
}
|
|
16
17
|
const target = dep?.target;
|
|
17
18
|
if (!target) {
|
|
@@ -21,13 +22,12 @@ function resolveDepToTaskId(dep, owningProject) {
|
|
|
21
22
|
const projectList = Array.isArray(dep.projects)
|
|
22
23
|
? dep.projects
|
|
23
24
|
: [dep.projects];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return {
|
|
26
|
+
project: projectList[0] !== 'self' ? projectList[0] : owningProject,
|
|
27
|
+
target,
|
|
28
|
+
};
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
return `${owningProject}:${target}`;
|
|
30
|
+
return { project: owningProject, target };
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Returns Gradle CLI arguments to exclude dependent tasks
|
|
@@ -36,21 +36,21 @@ function resolveDepToTaskId(dep, owningProject) {
|
|
|
36
36
|
* For example, if a project defines `dependsOn: ['lint']` for the `test` target,
|
|
37
37
|
* and only `test` is running, this will return: ['lint']
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
39
|
+
* @param tasks - Set of Target to process
|
|
40
40
|
* @param nodes - Project graph nodes
|
|
41
|
-
* @param
|
|
41
|
+
* @param runningTasks - Set of Target that are currently running (won't be excluded)
|
|
42
42
|
* @param includeDependsOnTasks - Set of Gradle task names that should be included (not excluded)
|
|
43
43
|
* (typically provider-based dependencies that Gradle must resolve)
|
|
44
44
|
*/
|
|
45
|
-
function getExcludeTasks(
|
|
45
|
+
function getExcludeTasks(tasks, nodes, runningTasks = new Set(), includeDependsOnTasks = new Set()) {
|
|
46
46
|
const excludes = new Set();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const taskDeps = nodes[project]?.data?.targets?.[target]?.dependsOn ?? [];
|
|
47
|
+
const runningKeys = new Set(Array.from(runningTasks).map(devkit_1.targetToTargetString));
|
|
48
|
+
for (const task of tasks) {
|
|
49
|
+
const taskDeps = nodes[task.project]?.data?.targets?.[task.target]?.dependsOn ?? [];
|
|
50
50
|
for (const dep of taskDeps) {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
const gradleTaskName =
|
|
51
|
+
const depPt = resolveDepToTarget(dep, task.project);
|
|
52
|
+
if (depPt && !runningKeys.has((0, devkit_1.targetToTargetString)(depPt))) {
|
|
53
|
+
const gradleTaskName = getGradleTaskName(depPt, nodes);
|
|
54
54
|
if (gradleTaskName && !includeDependsOnTasks.has(gradleTaskName)) {
|
|
55
55
|
excludes.add(gradleTaskName);
|
|
56
56
|
}
|
|
@@ -59,29 +59,34 @@ function getExcludeTasks(taskIds, nodes, runningTaskIds = new Set(), includeDepe
|
|
|
59
59
|
}
|
|
60
60
|
return excludes;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
const gradleTaskName = nodes[projectName]?.data?.targets?.[targetName]?.options?.taskName;
|
|
65
|
-
return gradleTaskName;
|
|
62
|
+
function getGradleTaskName(pt, nodes) {
|
|
63
|
+
return nodes[pt.project]?.data?.targets?.[pt.target]?.options?.taskName;
|
|
66
64
|
}
|
|
67
65
|
function getAllDependsOn(nodes, projectName, targetName) {
|
|
68
66
|
const allDependsOn = new Set();
|
|
69
|
-
const
|
|
67
|
+
const result = new Set();
|
|
68
|
+
const startKey = (0, devkit_1.targetToTargetString)({
|
|
69
|
+
project: projectName,
|
|
70
|
+
target: targetName,
|
|
71
|
+
});
|
|
72
|
+
const stack = [{ project: projectName, target: targetName }];
|
|
70
73
|
while (stack.length > 0) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const current = stack.pop();
|
|
75
|
+
const key = (0, devkit_1.targetToTargetString)(current);
|
|
76
|
+
if (!allDependsOn.has(key)) {
|
|
77
|
+
allDependsOn.add(key);
|
|
78
|
+
if (key !== startKey) {
|
|
79
|
+
result.add(current);
|
|
80
|
+
}
|
|
81
|
+
const directDependencies = nodes[current.project]?.data?.targets?.[current.target]?.dependsOn ??
|
|
82
|
+
[];
|
|
77
83
|
for (const dep of directDependencies) {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
stack.push(
|
|
84
|
+
const depPt = resolveDepToTarget(dep, current.project);
|
|
85
|
+
if (depPt && !allDependsOn.has((0, devkit_1.targetToTargetString)(depPt))) {
|
|
86
|
+
stack.push(depPt);
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
|
|
86
|
-
return allDependsOn;
|
|
91
|
+
return result;
|
|
87
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle-batch.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/gradle-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,uBAAuB,
|
|
1
|
+
{"version":3,"file":"gradle-batch.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/gradle-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,uBAAuB,EAEvB,SAAS,EAEV,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,kBAAkB,EACnB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAchD,eAAO,MAAM,eAAe,QAG3B,CAAC;AAEF,wBAA8B,WAAW,CACvC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC5C,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,YAAY,CAAC,CAkEvB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;;;;EAuE/C"}
|
|
@@ -56,49 +56,53 @@ async function gradleBatch(taskGraph, inputs, overrides, context) {
|
|
|
56
56
|
* Get the gradlew task ids to run
|
|
57
57
|
*/
|
|
58
58
|
function getGradlewTasksToRun(taskIds, taskGraph, inputs, nodes) {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
59
|
+
const tasksWithExclude = new Set();
|
|
60
|
+
const testTasksWithExclude = new Set();
|
|
61
|
+
const tasksWithoutExclude = new Set();
|
|
62
62
|
const gradlewTasksToRun = {};
|
|
63
63
|
const includeDependsOnTasks = new Set();
|
|
64
64
|
for (const taskId of taskIds) {
|
|
65
65
|
const task = taskGraph.tasks[taskId];
|
|
66
66
|
const input = inputs[task.id];
|
|
67
|
+
const taskTarget = {
|
|
68
|
+
project: task.target.project,
|
|
69
|
+
target: task.target.target,
|
|
70
|
+
};
|
|
67
71
|
gradlewTasksToRun[taskId] = input;
|
|
68
|
-
// Collect tasks that should be included (not excluded) - typically provider-based dependencies
|
|
69
72
|
if (input.includeDependsOnTasks) {
|
|
70
|
-
for (const
|
|
71
|
-
includeDependsOnTasks.add(
|
|
73
|
+
for (const t of input.includeDependsOnTasks) {
|
|
74
|
+
includeDependsOnTasks.add(t);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
if (input.excludeDependsOn) {
|
|
75
78
|
if (input.testClassName) {
|
|
76
|
-
|
|
79
|
+
testTasksWithExclude.add(taskTarget);
|
|
77
80
|
}
|
|
78
81
|
else {
|
|
79
|
-
|
|
82
|
+
tasksWithExclude.add(taskTarget);
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
else {
|
|
83
|
-
|
|
86
|
+
tasksWithoutExclude.add(taskTarget);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const allRunning = new Set(taskIds.map((id) => ({
|
|
90
|
+
project: taskGraph.tasks[id].target.project,
|
|
91
|
+
target: taskGraph.tasks[id].target.target,
|
|
92
|
+
})));
|
|
93
|
+
for (const task of tasksWithoutExclude) {
|
|
94
|
+
const dependencies = (0, get_exclude_task_1.getAllDependsOn)(nodes, task.project, task.target);
|
|
95
|
+
dependencies.forEach((dep) => allRunning.add(dep));
|
|
91
96
|
}
|
|
92
|
-
const excludeTasks = (0, get_exclude_task_1.getExcludeTasks)(
|
|
97
|
+
const excludeTasks = (0, get_exclude_task_1.getExcludeTasks)(tasksWithExclude, nodes, allRunning, includeDependsOnTasks);
|
|
93
98
|
const allTestsDependsOn = new Set();
|
|
94
|
-
for (const
|
|
95
|
-
const
|
|
96
|
-
const taskDependsOn = (0, get_exclude_task_1.getAllDependsOn)(nodes, projectName, targetName);
|
|
99
|
+
for (const task of testTasksWithExclude) {
|
|
100
|
+
const taskDependsOn = (0, get_exclude_task_1.getAllDependsOn)(nodes, task.project, task.target);
|
|
97
101
|
taskDependsOn.forEach((dep) => allTestsDependsOn.add(dep));
|
|
98
102
|
}
|
|
99
103
|
const excludeTestTasks = new Set();
|
|
100
|
-
for (
|
|
101
|
-
const gradleTaskName = (0, get_exclude_task_1.
|
|
104
|
+
for (const task of allTestsDependsOn) {
|
|
105
|
+
const gradleTaskName = (0, get_exclude_task_1.getGradleTaskName)(task, nodes);
|
|
102
106
|
if (gradleTaskName) {
|
|
103
107
|
excludeTestTasks.add(gradleTaskName);
|
|
104
108
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = gradleExecutor;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const exec_gradle_1 = require("../../utils/exec-gradle");
|
|
6
7
|
const node_path_1 = require("node:path");
|
|
7
|
-
const run_commands_impl_1 = require("nx/src/executors/run-commands/run-commands.impl");
|
|
8
|
+
const run_commands_impl_1 = tslib_1.__importDefault(require("nx/src/executors/run-commands/run-commands.impl"));
|
|
8
9
|
const get_exclude_task_1 = require("./get-exclude-task");
|
|
9
10
|
async function gradleExecutor(options, context) {
|
|
10
11
|
let projectRoot = context.projectGraph.nodes[context.projectName]?.data?.root ?? context.root;
|
|
@@ -45,7 +46,7 @@ async function gradleExecutor(options, context) {
|
|
|
45
46
|
});
|
|
46
47
|
if (options.excludeDependsOn) {
|
|
47
48
|
const includeDependsOnTasks = new Set(options.includeDependsOnTasks ?? []);
|
|
48
|
-
(0, get_exclude_task_1.getExcludeTasks)(new Set([
|
|
49
|
+
(0, get_exclude_task_1.getExcludeTasks)(new Set([{ project: context.projectName, target: context.targetName }]), context.projectGraph.nodes, new Set(), includeDependsOnTasks).forEach((task) => {
|
|
49
50
|
if (task) {
|
|
50
51
|
args.push('--exclude-task', task);
|
|
51
52
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-plugin-version-0-1-16.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/migrations/22-7-0/change-plugin-version-0-1-16.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAO9C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAgB9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const gradle_project_graph_plugin_utils_1 = require("../../generators/init/gradle-project-graph-plugin-utils");
|
|
7
|
+
const version_catalog_ast_utils_1 = require("../../utils/version-catalog-ast-utils");
|
|
8
|
+
/* Change the plugin version to 0.1.16
|
|
9
|
+
*/
|
|
10
|
+
async function update(tree) {
|
|
11
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
12
|
+
if (!nxJson) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const gradlePluginVersionToUpdate = '0.1.16';
|
|
19
|
+
// Update version in version catalogs using AST-based approach to preserve formatting
|
|
20
|
+
await (0, version_catalog_ast_utils_1.updateNxPluginVersionInCatalogsAst)(tree, gradlePluginVersionToUpdate);
|
|
21
|
+
// Then update in build.gradle(.kts) files
|
|
22
|
+
await (0, gradle_project_graph_plugin_utils_1.addNxProjectGraphPlugin)(tree, gradlePluginVersionToUpdate);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-plugin-version-0-1-17.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/migrations/22-7-0/change-plugin-version-0-1-17.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAO9C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAgB9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const gradle_project_graph_plugin_utils_1 = require("../../generators/init/gradle-project-graph-plugin-utils");
|
|
7
|
+
const version_catalog_ast_utils_1 = require("../../utils/version-catalog-ast-utils");
|
|
8
|
+
/* Change the plugin version to 0.1.17
|
|
9
|
+
*/
|
|
10
|
+
async function update(tree) {
|
|
11
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
12
|
+
if (!nxJson) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const gradlePluginVersionToUpdate = '0.1.17';
|
|
19
|
+
// Update version in version catalogs using AST-based approach to preserve formatting
|
|
20
|
+
await (0, version_catalog_ast_utils_1.updateNxPluginVersionInCatalogsAst)(tree, gradlePluginVersionToUpdate);
|
|
21
|
+
// Then update in build.gradle(.kts) files
|
|
22
|
+
await (0, gradle_project_graph_plugin_utils_1.addNxProjectGraphPlugin)(tree, gradlePluginVersionToUpdate);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-plugin-version-0-1-18.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/migrations/22-7-0/change-plugin-version-0-1-18.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAO9C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAgB9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const gradle_project_graph_plugin_utils_1 = require("../../generators/init/gradle-project-graph-plugin-utils");
|
|
7
|
+
const version_catalog_ast_utils_1 = require("../../utils/version-catalog-ast-utils");
|
|
8
|
+
/* Change the plugin version to 0.1.18
|
|
9
|
+
*/
|
|
10
|
+
async function update(tree) {
|
|
11
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
12
|
+
if (!nxJson) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const gradlePluginVersionToUpdate = '0.1.18';
|
|
19
|
+
// Update version in version catalogs using AST-based approach to preserve formatting
|
|
20
|
+
await (0, version_catalog_ast_utils_1.updateNxPluginVersionInCatalogsAst)(tree, gradlePluginVersionToUpdate);
|
|
21
|
+
// Then update in build.gradle(.kts) files
|
|
22
|
+
await (0, gradle_project_graph_plugin_utils_1.addNxProjectGraphPlugin)(tree, gradlePluginVersionToUpdate);
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-graph-from-gradle-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-from-gradle-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,oBAAoB,EACpB,wBAAwB,EAExB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,mBAAmB,EAAoB,MAAM,yBAAyB,CAAC;AAIhF,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE;QACL,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;KAClD,CAAC;IACF,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,IAAI,EAAE,MAAM,CAAC;CACd;AAiBD,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,QAgBb;
|
|
1
|
+
{"version":3,"file":"get-project-graph-from-gradle-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-from-gradle-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,oBAAoB,EACpB,wBAAwB,EAExB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,mBAAmB,EAAoB,MAAM,yBAAyB,CAAC;AAIhF,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE;QACL,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;KAClD,CAAC;IACF,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,IAAI,EAAE,MAAM,CAAC;CACd;AAiBD,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,QAgBb;AAOD,wBAAgB,4BAA4B,IAAI,kBAAkB,CAejE;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAG/C;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyEf;AAED,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,MAAM,EAAE,GAC1B,kBAAkB,CAkDpB"}
|
|
@@ -75,14 +75,25 @@ async function populateProjectGraph(workspaceRoot, gradlewFiles, options) {
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
const gradleProjectGraphReportStart = performance.mark('gradleProjectGraphReport:start');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
let projectGraphLines;
|
|
79
|
+
try {
|
|
80
|
+
projectGraphLines = await gradlewFiles.reduce(async (projectGraphLines, gradlewFile) => {
|
|
81
|
+
const getNxProjectGraphLinesStart = performance.mark(`${gradlewFile}GetNxProjectGraphLines:start`);
|
|
82
|
+
const allLines = await projectGraphLines;
|
|
83
|
+
const currentLines = await (0, get_project_graph_lines_1.getNxProjectGraphLines)(gradlewFile, gradleConfigHash, normalizedOptions);
|
|
84
|
+
const getNxProjectGraphLinesEnd = performance.mark(`${gradlewFile}GetNxProjectGraphLines:end`);
|
|
85
|
+
performance.measure(`${gradlewFile}GetNxProjectGraphLines`, getNxProjectGraphLinesStart.name, getNxProjectGraphLinesEnd.name);
|
|
86
|
+
return [...allLines, ...currentLines];
|
|
87
|
+
}, Promise.resolve([]));
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
if (e instanceof Error &&
|
|
91
|
+
e.message === 'Gradle project graph generation was cancelled') {
|
|
92
|
+
// Cancelled by a newer populateProjectGraph call — silently return
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
throw e;
|
|
96
|
+
}
|
|
86
97
|
const gradleProjectGraphReportEnd = performance.mark('gradleProjectGraphReport:end');
|
|
87
98
|
performance.measure('gradleProjectGraphReport', gradleProjectGraphReportStart.name, gradleProjectGraphReportEnd.name);
|
|
88
99
|
projectGraphReportCache = processNxProjectGraph(projectGraphLines);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { GradlePluginOptions } from './gradle-plugin-options';
|
|
2
|
+
/**
|
|
3
|
+
* Cancel any in-flight Gradle project graph process.
|
|
4
|
+
* Safe to call even if nothing is running.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cancelPendingProjectGraphRequest(): void;
|
|
7
|
+
export declare function getGraphTimeoutMs(): number;
|
|
2
8
|
export declare function getNxProjectGraphLines(gradlewFile: string, gradleConfigHash: string, gradlePluginOptions: GradlePluginOptions): Promise<string[]>;
|
|
3
9
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"get-project-graph-lines.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-lines.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAM9D;;;GAGG;AACH,wBAAgB,gCAAgC,IAAI,IAAI,CAKvD;AAED,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,CA6GnB"}
|
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancelPendingProjectGraphRequest = cancelPendingProjectGraphRequest;
|
|
4
|
+
exports.getGraphTimeoutMs = getGraphTimeoutMs;
|
|
3
5
|
exports.getNxProjectGraphLines = getNxProjectGraphLines;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
5
8
|
const exec_gradle_1 = require("../../utils/exec-gradle");
|
|
9
|
+
const DEFAULT_GRAPH_TIMEOUT_SECONDS = (0, devkit_internals_1.isCI)() ? 600 : 120;
|
|
10
|
+
let currentAbortController;
|
|
11
|
+
/**
|
|
12
|
+
* Cancel any in-flight Gradle project graph process.
|
|
13
|
+
* Safe to call even if nothing is running.
|
|
14
|
+
*/
|
|
15
|
+
function cancelPendingProjectGraphRequest() {
|
|
16
|
+
if (currentAbortController) {
|
|
17
|
+
currentAbortController.abort('cancelled');
|
|
18
|
+
currentAbortController = undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function getGraphTimeoutMs() {
|
|
22
|
+
const envTimeout = process.env.NX_GRADLE_PROJECT_GRAPH_TIMEOUT;
|
|
23
|
+
if (envTimeout) {
|
|
24
|
+
const parsed = Number(envTimeout);
|
|
25
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
26
|
+
return parsed * 1000;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return DEFAULT_GRAPH_TIMEOUT_SECONDS * 1000;
|
|
30
|
+
}
|
|
6
31
|
async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePluginOptions) {
|
|
7
32
|
let nxProjectGraphBuffer;
|
|
8
33
|
const gradlePluginOptionsArgs = Object.entries(gradlePluginOptions ?? {})?.map(([key, value]) => `-P${key}=${value}`) ?? [];
|
|
34
|
+
const timeoutMs = getGraphTimeoutMs();
|
|
35
|
+
const timeoutSeconds = timeoutMs / 1000;
|
|
36
|
+
// Cancel any in-flight Gradle process from a previous call, then create a fresh controller.
|
|
37
|
+
cancelPendingProjectGraphRequest();
|
|
38
|
+
const controller = new AbortController();
|
|
39
|
+
currentAbortController = controller;
|
|
40
|
+
const signal = controller.signal;
|
|
41
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
9
42
|
try {
|
|
10
43
|
nxProjectGraphBuffer = await (0, exec_gradle_1.execGradleAsync)(gradlewFile, [
|
|
11
44
|
'nxProjectGraph',
|
|
@@ -18,10 +51,25 @@ async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePlugi
|
|
|
18
51
|
...gradlePluginOptionsArgs,
|
|
19
52
|
`-PworkspaceRoot=${devkit_1.workspaceRoot}`,
|
|
20
53
|
process.env.NX_GRADLE_VERBOSE_LOGGING ? '--info' : '',
|
|
21
|
-
]);
|
|
54
|
+
], { signal });
|
|
22
55
|
}
|
|
23
56
|
catch (e) {
|
|
24
|
-
|
|
57
|
+
// Cancelled by a newer populateProjectGraph call — let the caller handle it
|
|
58
|
+
if (signal.reason === 'cancelled') {
|
|
59
|
+
throw new Error('Gradle project graph generation was cancelled');
|
|
60
|
+
}
|
|
61
|
+
if (signal.aborted) {
|
|
62
|
+
throw new devkit_1.AggregateCreateNodesError([
|
|
63
|
+
[
|
|
64
|
+
gradlewFile,
|
|
65
|
+
new Error(`Gradle project graph generation timed out after ${timeoutSeconds} ${timeoutSeconds === 1 ? 'second' : 'seconds'}.\n` +
|
|
66
|
+
` 1. Run "gradlew --stop" to stop the Gradle daemon, then run "gradlew clean" to clear the build cache.\n` +
|
|
67
|
+
` 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` +
|
|
68
|
+
` 3. If the issue still persists, set NX_GRADLE_DISABLE=true to disable the Gradle plugin entirely.`),
|
|
69
|
+
],
|
|
70
|
+
], []);
|
|
71
|
+
}
|
|
72
|
+
else if (e.toString()?.includes('ERROR: JAVA_HOME')) {
|
|
25
73
|
throw new devkit_1.AggregateCreateNodesError([
|
|
26
74
|
[
|
|
27
75
|
gradlewFile,
|
|
@@ -46,6 +94,9 @@ async function getNxProjectGraphLines(gradlewFile, gradleConfigHash, gradlePlugi
|
|
|
46
94
|
], []);
|
|
47
95
|
}
|
|
48
96
|
}
|
|
97
|
+
finally {
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
}
|
|
49
100
|
const projectGraphLines = nxProjectGraphBuffer
|
|
50
101
|
.toString()
|
|
51
102
|
.split(exec_gradle_1.newLineSeparator)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-gradle.d.ts","sourceRoot":"","sources":["../../../../../packages/gradle/src/utils/exec-gradle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAY,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"exec-gradle.d.ts","sourceRoot":"","sources":["../../../../../packages/gradle/src/utils/exec-gradle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAY,MAAM,oBAAoB,CAAC;AAQ/D,eAAO,MAAM,aAAa,QAEb,CAAC;AAEd,eAAO,MAAM,gBAAgB,QAErB,CAAC;AAET;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,WAAW,GAAE,eAAoB,GAChC,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"}
|