@nx/gradle 21.3.0-beta.3 → 21.3.0-beta.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/gradle",
3
- "version": "21.3.0-beta.3",
3
+ "version": "21.3.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "migrations": "./migrations.json"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "21.3.0-beta.3"
38
+ "@nx/devkit": "21.3.0-beta.4"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -21,13 +21,15 @@ jobs:
21
21
  # Run this command as early as possible, before dependencies are installed
22
22
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
23
23
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
24
- # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
24
+ # - run: ./nx start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
25
25
 
26
26
  - nx/set-shas:
27
27
  main-branch-name: '<%= mainBranch %>'
28
- <% for (const command of commands) { %>
29
- <% if (command.command) { %>- run: <%= command.command %><% } else if (command.comments) { %><% for (const comment of command.comments) { %>
30
- <%= comment %><% } %><% } else {%>- run: <%= command %><% } %><% } %>
28
+ <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
29
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
30
+ - run:
31
+ command: <%= command.command %><% if (command.alwaysRun) { %>
32
+ when: always<% } %><% } %><% } %>
31
33
 
32
34
  workflows:
33
35
  version: 2
@@ -26,7 +26,7 @@ jobs:
26
26
  # Run this command as early as possible, before dependencies are installed
27
27
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
28
28
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
29
- # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
29
+ # - run: ./nx start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
30
30
 
31
31
  - name: Set up JDK 21 for x64
32
32
  uses: actions/setup-java@v4
@@ -39,6 +39,7 @@ jobs:
39
39
  uses: gradle/actions/setup-gradle@v3
40
40
 
41
41
  - uses: nrwl/nx-set-shas@v4
42
- <% for (const command of commands) { %>
43
- <% if (command.command) { %>- run: <%= command.command %><% } else if (command.comments) { %><% for (const comment of command.comments) { %>
44
- <%= comment %><% } %><% } else {%>- run: <%= command %><% } %><% } %>
42
+ <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
43
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
44
+ - run: <%= command.command %><% if (command.alwaysRun) { %>
45
+ if: always()<% } %><% } %><% } %>
@@ -1,9 +1,9 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export type Command = {
3
- command: string;
4
- } | {
5
- comments: string[];
6
- } | string;
3
+ command?: string;
4
+ comments?: string[];
5
+ alwaysRun?: boolean;
6
+ };
7
7
  export interface Schema {
8
8
  name: string;
9
9
  ci: 'github' | 'circleci';
@@ -11,13 +11,12 @@ function getCiCommands(ci) {
11
11
  return [
12
12
  {
13
13
  comments: [
14
- `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
15
- `# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-e2e-tests.`,
14
+ `Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
15
+ `Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-e2e-tests.`,
16
16
  ],
17
- },
18
- {
19
17
  command: `./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check`,
20
18
  },
19
+ getNxCloudFixCiCommand(),
21
20
  ];
22
21
  }
23
22
  default: {
@@ -27,12 +26,22 @@ function getCiCommands(ci) {
27
26
  `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
28
27
  `# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-tests`,
29
28
  ],
29
+ command: `./nx affected -t assemble check`,
30
30
  },
31
- { command: `./nx affected -t assemble check` },
31
+ getNxCloudFixCiCommand(),
32
32
  ];
33
33
  }
34
34
  }
35
35
  }
36
+ function getNxCloudFixCiCommand() {
37
+ return {
38
+ comments: [
39
+ `Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci`,
40
+ ],
41
+ command: `./nx fix-ci`,
42
+ alwaysRun: true,
43
+ };
44
+ }
36
45
  async function ciWorkflowGenerator(tree, schema) {
37
46
  const ci = schema.ci;
38
47
  const options = getTemplateData(tree, schema);
@@ -41,8 +50,6 @@ async function ciWorkflowGenerator(tree, schema) {
41
50
  }
42
51
  function getTemplateData(tree, options) {
43
52
  const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
44
- const packageManager = (0, devkit_1.detectPackageManager)();
45
- const { exec: packageManagerPrefix } = (0, devkit_1.getPackageManagerCommand)(packageManager);
46
53
  let nxCloudHost = 'nx.app';
47
54
  try {
48
55
  const nxCloudUrl = (0, nx_cloud_utils_1.getNxCloudUrl)((0, devkit_1.readNxJson)(tree));
@@ -55,8 +62,6 @@ function getTemplateData(tree, options) {
55
62
  return {
56
63
  workflowName,
57
64
  workflowFileName,
58
- packageManager,
59
- packageManagerPrefix,
60
65
  commands,
61
66
  mainBranch,
62
67
  nxCloudHost,