@nx/gradle 19.5.0-canary.20240712-0b0db78 → 19.5.0-canary.20240713-6f50d9f
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/generators/ci-workflow/files/circleci/.circleci/config.yml.template +1 -1
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml.template +1 -1
- package/src/generators/ci-workflow/generator.d.ts +6 -1
- package/src/generators/ci-workflow/generator.js +16 -4
- package/src/plugin/nodes.js +24 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/gradle",
|
3
|
-
"version": "19.5.0-canary.
|
3
|
+
"version": "19.5.0-canary.20240713-6f50d9f",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
6
6
|
"repository": {
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"migrations": "./migrations.json"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@nx/devkit": "19.5.0-canary.
|
37
|
+
"@nx/devkit": "19.5.0-canary.20240713-6f50d9f"
|
38
38
|
},
|
39
39
|
"publishConfig": {
|
40
40
|
"access": "public"
|
@@ -25,7 +25,7 @@ jobs:
|
|
25
25
|
main-branch-name: '<%= mainBranch %>'
|
26
26
|
|
27
27
|
<% for (const command of commands) { %>
|
28
|
-
|
28
|
+
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comment) { %><%= command.comment %><% } else {%>- run: <%= command %><% } %><% } %>
|
29
29
|
|
30
30
|
workflows:
|
31
31
|
version: 2
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml.template
CHANGED
@@ -39,4 +39,4 @@ jobs:
|
|
39
39
|
- uses: nrwl/nx-set-shas@v4
|
40
40
|
|
41
41
|
<% for (const command of commands) { %>
|
42
|
-
|
42
|
+
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comment) { %><%= command.comment %><% } else {%>- run: <%= command %><% } %><% } %>
|
@@ -1,9 +1,14 @@
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
2
|
+
export type Command = {
|
3
|
+
command: string;
|
4
|
+
} | {
|
5
|
+
comment: string;
|
6
|
+
} | string;
|
2
7
|
export interface Schema {
|
3
8
|
name: string;
|
4
9
|
ci: 'github' | 'circleci';
|
5
10
|
packageManager?: null;
|
6
|
-
commands?:
|
11
|
+
commands?: Command[];
|
7
12
|
}
|
8
13
|
export declare function ciWorkflowGenerator(tree: Tree, schema: Schema): Promise<void>;
|
9
14
|
export default ciWorkflowGenerator;
|
@@ -5,13 +5,25 @@ const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
6
6
|
const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
|
7
7
|
const default_base_1 = require("nx/src/utils/default-base");
|
8
|
-
function getCiCommands(ci
|
8
|
+
function getCiCommands(ci) {
|
9
9
|
switch (ci) {
|
10
10
|
case 'circleci': {
|
11
|
-
return [
|
11
|
+
return [
|
12
|
+
{
|
13
|
+
comment: `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
|
14
|
+
},
|
15
|
+
{
|
16
|
+
command: `./nx affected --base=$NX_BASE --head=$NX_HEAD -t test build`,
|
17
|
+
},
|
18
|
+
];
|
12
19
|
}
|
13
20
|
default: {
|
14
|
-
return [
|
21
|
+
return [
|
22
|
+
{
|
23
|
+
comment: `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
|
24
|
+
},
|
25
|
+
{ command: `./nx affected -t test build` },
|
26
|
+
];
|
15
27
|
}
|
16
28
|
}
|
17
29
|
}
|
@@ -32,7 +44,7 @@ function getTemplateData(tree, options) {
|
|
32
44
|
}
|
33
45
|
catch { }
|
34
46
|
const mainBranch = (0, default_base_1.deduceDefaultBase)();
|
35
|
-
const commands = options.commands ?? getCiCommands(options.ci
|
47
|
+
const commands = options.commands ?? getCiCommands(options.ci);
|
36
48
|
const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readNxJson)(tree));
|
37
49
|
return {
|
38
50
|
workflowName,
|
package/src/plugin/nodes.js
CHANGED
@@ -133,6 +133,14 @@ async function createGradleTargets(tasks, options, context, outputDirs, gradlePr
|
|
133
133
|
dependsOn: dependsOnMap[task.name],
|
134
134
|
metadata: {
|
135
135
|
technologies: ['gradle'],
|
136
|
+
help: {
|
137
|
+
command: `${(0, exec_gradle_1.getGradleExecFile)()} help --task ${taskCommandToRun}`,
|
138
|
+
example: {
|
139
|
+
options: {
|
140
|
+
args: ['--rerun'],
|
141
|
+
},
|
142
|
+
},
|
143
|
+
},
|
136
144
|
},
|
137
145
|
...(outputs && outputs.length ? { outputs } : {}),
|
138
146
|
};
|
@@ -175,6 +183,14 @@ function getTestCiTargets(testFiles, gradleProject, testTargetName, ciTargetName
|
|
175
183
|
metadata: {
|
176
184
|
technologies: ['gradle'],
|
177
185
|
description: `Runs Gradle test ${testFile} in CI`,
|
186
|
+
help: {
|
187
|
+
command: `${(0, exec_gradle_1.getGradleExecFile)()} help --task ${taskCommandToRun}`,
|
188
|
+
example: {
|
189
|
+
options: {
|
190
|
+
args: ['--rerun'],
|
191
|
+
},
|
192
|
+
},
|
193
|
+
},
|
178
194
|
},
|
179
195
|
...(outputs && outputs.length > 0 ? { outputs } : {}),
|
180
196
|
};
|
@@ -195,6 +211,14 @@ function getTestCiTargets(testFiles, gradleProject, testTargetName, ciTargetName
|
|
195
211
|
technologies: ['gradle'],
|
196
212
|
description: 'Runs Gradle Tests in CI',
|
197
213
|
nonAtomizedTarget: testTargetName,
|
214
|
+
help: {
|
215
|
+
command: `${(0, exec_gradle_1.getGradleExecFile)()} help --task ${taskCommandToRun}`,
|
216
|
+
example: {
|
217
|
+
options: {
|
218
|
+
args: ['--rerun'],
|
219
|
+
},
|
220
|
+
},
|
221
|
+
},
|
198
222
|
},
|
199
223
|
};
|
200
224
|
targetGroups[targetGroupName].push(ciTargetName);
|