@nx/gradle 18.2.0-canary.20240327-82dc703 → 18.2.0
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/README.md +2 -0
- package/package.json +3 -3
- package/src/plugin/nodes.d.ts +2 -0
- package/src/plugin/nodes.js +24 -10
package/README.md
CHANGED
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/gradle",
|
3
|
-
"version": "18.2.0
|
3
|
+
"version": "18.2.0",
|
4
4
|
"private": false,
|
5
|
-
"description": "The Nx Plugin for
|
5
|
+
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
8
8
|
"url": "https://github.com/nrwl/nx.git",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"migrations": "./migrations.json"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@nx/devkit": "18.2.0
|
36
|
+
"@nx/devkit": "18.2.0"
|
37
37
|
},
|
38
38
|
"publishConfig": {
|
39
39
|
"access": "public"
|
package/src/plugin/nodes.d.ts
CHANGED
@@ -8,9 +8,11 @@ export interface GradlePluginOptions {
|
|
8
8
|
export declare const calculatedTargets: Record<string, {
|
9
9
|
name: string;
|
10
10
|
targets: Record<string, TargetConfiguration>;
|
11
|
+
targetGroups: Record<string, string[]>;
|
11
12
|
}>;
|
12
13
|
export declare function writeTargetsToCache(targets: Record<string, {
|
13
14
|
name: string;
|
14
15
|
targets: Record<string, TargetConfiguration>;
|
16
|
+
targetGroups: Record<string, string[]>;
|
15
17
|
}>): void;
|
16
18
|
export declare const createNodes: CreateNodes<GradlePluginOptions>;
|
package/src/plugin/nodes.js
CHANGED
@@ -8,7 +8,7 @@ const node_path_1 = require("node:path");
|
|
8
8
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
9
9
|
const exec_gradle_1 = require("../utils/exec-gradle");
|
10
10
|
const get_gradle_report_1 = require("../utils/get-gradle-report");
|
11
|
-
const
|
11
|
+
const cacheableTaskType = new Set(['Build', 'Verification']);
|
12
12
|
const dependsOnMap = {
|
13
13
|
build: ['^build', 'classes'],
|
14
14
|
test: ['classes'],
|
@@ -33,7 +33,12 @@ exports.createNodes = [
|
|
33
33
|
exports.calculatedTargets[hash] = targetsCache[hash];
|
34
34
|
return {
|
35
35
|
projects: {
|
36
|
-
[projectRoot]:
|
36
|
+
[projectRoot]: {
|
37
|
+
...targetsCache[hash],
|
38
|
+
metadata: {
|
39
|
+
technologies: ['gradle'],
|
40
|
+
},
|
41
|
+
},
|
37
42
|
},
|
38
43
|
};
|
39
44
|
}
|
@@ -53,18 +58,22 @@ exports.createNodes = [
|
|
53
58
|
});
|
54
59
|
}
|
55
60
|
const outputDirs = gradleFileToOutputDirsMap.get(gradleFilePath);
|
56
|
-
const targets = createGradleTargets(tasks, projectRoot, options, context, outputDirs);
|
61
|
+
const { targets, targetGroups } = createGradleTargets(tasks, projectRoot, options, context, outputDirs);
|
57
62
|
exports.calculatedTargets[hash] = {
|
58
63
|
name: projectName,
|
59
64
|
targets,
|
65
|
+
targetGroups,
|
66
|
+
};
|
67
|
+
const project = {
|
68
|
+
name: projectName,
|
69
|
+
targets,
|
70
|
+
metadata: {
|
71
|
+
technologies: ['gradle'],
|
72
|
+
},
|
60
73
|
};
|
61
74
|
return {
|
62
75
|
projects: {
|
63
|
-
[projectRoot]:
|
64
|
-
root: projectRoot,
|
65
|
-
name: projectName,
|
66
|
-
targets,
|
67
|
-
},
|
76
|
+
[projectRoot]: project,
|
68
77
|
},
|
69
78
|
};
|
70
79
|
}
|
@@ -77,6 +86,7 @@ exports.createNodes = [
|
|
77
86
|
function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
|
78
87
|
const inputsMap = createInputsMap(context);
|
79
88
|
const targets = {};
|
89
|
+
const targetGroups = {};
|
80
90
|
for (const task of tasks) {
|
81
91
|
const targetName = options?.[`${task.name}TargetName`] ?? task.name;
|
82
92
|
const outputs = outputDirs.get(task.name);
|
@@ -85,13 +95,17 @@ function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
|
|
85
95
|
options: {
|
86
96
|
cwd: projectRoot,
|
87
97
|
},
|
88
|
-
cache:
|
98
|
+
cache: cacheableTaskType.has(task.type),
|
89
99
|
inputs: inputsMap[task.name],
|
90
100
|
outputs: outputs ? [outputs] : undefined,
|
91
101
|
dependsOn: dependsOnMap[task.name],
|
92
102
|
};
|
103
|
+
if (!targetGroups[task.type]) {
|
104
|
+
targetGroups[task.type] = [];
|
105
|
+
}
|
106
|
+
targetGroups[task.type].push(task.name);
|
93
107
|
}
|
94
|
-
return targets;
|
108
|
+
return { targetGroups, targets };
|
95
109
|
}
|
96
110
|
function createInputsMap(context) {
|
97
111
|
const namedInputs = context.nxJsonConfiguration.namedInputs;
|