@nx/gradle 18.2.0-canary.20240326-fb90767 → 18.2.0-canary.20240328-7d2a420
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 +2 -2
- package/src/plugin/nodes.d.ts +2 -0
- package/src/plugin/nodes.js +23 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/gradle",
|
3
|
-
"version": "18.2.0-canary.
|
3
|
+
"version": "18.2.0-canary.20240328-7d2a420",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Plugin for gradle",
|
6
6
|
"repository": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"migrations": "./migrations.json"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@nx/devkit": "18.2.0-canary.
|
36
|
+
"@nx/devkit": "18.2.0-canary.20240328-7d2a420"
|
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,6 @@ 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 nonCacheableGradleTaskTypes = new Set(['Application']);
|
12
11
|
const dependsOnMap = {
|
13
12
|
build: ['^build', 'classes'],
|
14
13
|
test: ['classes'],
|
@@ -33,7 +32,12 @@ exports.createNodes = [
|
|
33
32
|
exports.calculatedTargets[hash] = targetsCache[hash];
|
34
33
|
return {
|
35
34
|
projects: {
|
36
|
-
[projectRoot]:
|
35
|
+
[projectRoot]: {
|
36
|
+
...targetsCache[hash],
|
37
|
+
metadata: {
|
38
|
+
technologies: ['gradle'],
|
39
|
+
},
|
40
|
+
},
|
37
41
|
},
|
38
42
|
};
|
39
43
|
}
|
@@ -53,18 +57,22 @@ exports.createNodes = [
|
|
53
57
|
});
|
54
58
|
}
|
55
59
|
const outputDirs = gradleFileToOutputDirsMap.get(gradleFilePath);
|
56
|
-
const targets = createGradleTargets(tasks, projectRoot, options, context, outputDirs);
|
60
|
+
const { targets, targetGroups } = createGradleTargets(tasks, projectRoot, options, context, outputDirs);
|
57
61
|
exports.calculatedTargets[hash] = {
|
58
62
|
name: projectName,
|
59
63
|
targets,
|
64
|
+
targetGroups,
|
65
|
+
};
|
66
|
+
const project = {
|
67
|
+
name: projectName,
|
68
|
+
targets,
|
69
|
+
metadata: {
|
70
|
+
technologies: ['gradle'],
|
71
|
+
},
|
60
72
|
};
|
61
73
|
return {
|
62
74
|
projects: {
|
63
|
-
[projectRoot]:
|
64
|
-
root: projectRoot,
|
65
|
-
name: projectName,
|
66
|
-
targets,
|
67
|
-
},
|
75
|
+
[projectRoot]: project,
|
68
76
|
},
|
69
77
|
};
|
70
78
|
}
|
@@ -77,6 +85,7 @@ exports.createNodes = [
|
|
77
85
|
function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
|
78
86
|
const inputsMap = createInputsMap(context);
|
79
87
|
const targets = {};
|
88
|
+
const targetGroups = {};
|
80
89
|
for (const task of tasks) {
|
81
90
|
const targetName = options?.[`${task.name}TargetName`] ?? task.name;
|
82
91
|
const outputs = outputDirs.get(task.name);
|
@@ -85,13 +94,17 @@ function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
|
|
85
94
|
options: {
|
86
95
|
cwd: projectRoot,
|
87
96
|
},
|
88
|
-
cache:
|
97
|
+
cache: !!outputs,
|
89
98
|
inputs: inputsMap[task.name],
|
90
99
|
outputs: outputs ? [outputs] : undefined,
|
91
100
|
dependsOn: dependsOnMap[task.name],
|
92
101
|
};
|
102
|
+
if (!targetGroups[task.type]) {
|
103
|
+
targetGroups[task.type] = [];
|
104
|
+
}
|
105
|
+
targetGroups[task.type].push(task.name);
|
93
106
|
}
|
94
|
-
return targets;
|
107
|
+
return { targetGroups, targets };
|
95
108
|
}
|
96
109
|
function createInputsMap(context) {
|
97
110
|
const namedInputs = context.nxJsonConfiguration.namedInputs;
|