@nx/gradle 19.5.0-canary.20240711-2c4c2ae → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/gradle",
3
- "version": "19.5.0-canary.20240711-2c4c2ae",
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.20240711-2c4c2ae"
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
- - run: <%= command %><% } %>
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
@@ -39,4 +39,4 @@ jobs:
39
39
  - uses: nrwl/nx-set-shas@v4
40
40
 
41
41
  <% for (const command of commands) { %>
42
- - run: <%= command %><% } %>
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?: string[];
11
+ commands?: Command[];
7
12
  }
8
13
  export declare function ciWorkflowGenerator(tree: Tree, schema: Schema): Promise<void>;
9
14
  export default ciWorkflowGenerator;
@@ -1,17 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ciWorkflowGenerator = void 0;
3
+ exports.ciWorkflowGenerator = ciWorkflowGenerator;
4
4
  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, mainBranch) {
8
+ function getCiCommands(ci) {
9
9
  switch (ci) {
10
10
  case 'circleci': {
11
- return [`./nx affected --base=$NX_BASE --head=$NX_HEAD -t test build`];
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 [`./nx affected -t test build`];
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
  }
@@ -21,7 +33,6 @@ async function ciWorkflowGenerator(tree, schema) {
21
33
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', ci), '', options);
22
34
  await (0, devkit_1.formatFiles)(tree);
23
35
  }
24
- exports.ciWorkflowGenerator = ciWorkflowGenerator;
25
36
  function getTemplateData(tree, options) {
26
37
  const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
27
38
  const packageManager = (0, devkit_1.detectPackageManager)();
@@ -33,7 +44,7 @@ function getTemplateData(tree, options) {
33
44
  }
34
45
  catch { }
35
46
  const mainBranch = (0, default_base_1.deduceDefaultBase)();
36
- const commands = options.commands ?? getCiCommands(options.ci, mainBranch);
47
+ const commands = options.commands ?? getCiCommands(options.ci);
37
48
  const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readNxJson)(tree));
38
49
  return {
39
50
  workflowName,
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateNxJsonConfiguration = exports.addBuildGradleFileNextToSettingsGradle = exports.initGenerator = void 0;
3
+ exports.initGenerator = initGenerator;
4
+ exports.addBuildGradleFileNextToSettingsGradle = addBuildGradleFileNextToSettingsGradle;
5
+ exports.updateNxJsonConfiguration = updateNxJsonConfiguration;
4
6
  const devkit_1 = require("@nx/devkit");
5
7
  const child_process_1 = require("child_process");
6
8
  const versions_1 = require("../../utils/versions");
@@ -27,7 +29,6 @@ Running 'gradle init':`);
27
29
  }
28
30
  return (0, devkit_1.runTasksInSerial)(...tasks);
29
31
  }
30
- exports.initGenerator = initGenerator;
31
32
  function addPlugin(tree) {
32
33
  const nxJson = (0, devkit_1.readNxJson)(tree);
33
34
  if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) {
@@ -54,7 +55,6 @@ async function addBuildGradleFileNextToSettingsGradle(tree) {
54
55
  addProjectReportToBuildGradle(settingsGradleFile, tree);
55
56
  });
56
57
  }
57
- exports.addBuildGradleFileNextToSettingsGradle = addBuildGradleFileNextToSettingsGradle;
58
58
  /**
59
59
  * - creates a build.gradle file next to the settings.gradle file if it does not exist.
60
60
  * - adds the project-report plugin to the build.gradle file if it does not exist.
@@ -134,5 +134,4 @@ function updateNxJsonConfiguration(tree) {
134
134
  nxJson.namedInputs.production = Array.from(new Set([...productionFileSet, 'default', '!{projectRoot}/src/test/**/*']));
135
135
  (0, devkit_1.updateNxJson)(tree, nxJson);
136
136
  }
137
- exports.updateNxJsonConfiguration = updateNxJsonConfiguration;
138
137
  exports.default = initGenerator;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const init_1 = require("../../generators/init/init");
4
5
  /**
5
6
  * This migration adds task `projectReportAll` to build.gradle files
@@ -7,4 +8,3 @@ const init_1 = require("../../generators/init/init");
7
8
  async function update(tree) {
8
9
  await (0, init_1.addBuildGradleFileNextToSettingsGradle)(tree);
9
10
  }
10
- exports.default = update;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const has_gradle_plugin_1 = require("../../utils/has-gradle-plugin");
5
6
  // This function changes !{projectRoot}/test/**/* in nx.json for production to !{projectRoot}/src/test/**/*
@@ -18,4 +19,3 @@ function update(tree) {
18
19
  (0, devkit_1.updateNxJson)(tree, nxJson);
19
20
  }
20
21
  }
21
- exports.default = update;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processGradleDependencies = exports.createDependencies = void 0;
3
+ exports.createDependencies = void 0;
4
+ exports.processGradleDependencies = processGradleDependencies;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const node_fs_1 = require("node:fs");
6
7
  const node_path_1 = require("node:path");
@@ -79,4 +80,3 @@ function processGradleDependencies(depsFile, gradleProjectToProjectName, sourceP
79
80
  }
80
81
  }
81
82
  }
82
- exports.processGradleDependencies = processGradleDependencies;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNodes = exports.makeCreateNodesForGradleConfigFile = exports.createNodesV2 = exports.writeTargetsToCache = void 0;
3
+ exports.createNodes = exports.makeCreateNodesForGradleConfigFile = exports.createNodesV2 = void 0;
4
+ exports.writeTargetsToCache = writeTargetsToCache;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
7
  const node_fs_1 = require("node:fs");
@@ -29,7 +30,6 @@ function readTargetsCache(cachePath) {
29
30
  function writeTargetsToCache(cachePath, results) {
30
31
  (0, devkit_1.writeJsonFile)(cachePath, results);
31
32
  }
32
- exports.writeTargetsToCache = writeTargetsToCache;
33
33
  exports.createNodesV2 = [
34
34
  get_gradle_report_1.gradleConfigAndTestGlob,
35
35
  async (files, options, context) => {
@@ -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);
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { ExecFileOptions } from 'node:child_process';
4
2
  export declare function getGradleBinaryPath(): string;
5
3
  export declare function getGradleExecFile(): string;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execGradleAsync = exports.getGradleExecFile = exports.getGradleBinaryPath = void 0;
3
+ exports.getGradleBinaryPath = getGradleBinaryPath;
4
+ exports.getGradleExecFile = getGradleExecFile;
5
+ exports.execGradleAsync = execGradleAsync;
4
6
  const devkit_1 = require("@nx/devkit");
5
7
  const node_child_process_1 = require("node:child_process");
6
8
  const node_fs_1 = require("node:fs");
@@ -15,11 +17,9 @@ function getGradleBinaryPath() {
15
17
  }
16
18
  return gradleBinaryPath;
17
19
  }
18
- exports.getGradleBinaryPath = getGradleBinaryPath;
19
20
  function getGradleExecFile() {
20
21
  return process.platform.startsWith('win') ? '.\\gradlew.bat' : './gradlew';
21
22
  }
22
- exports.getGradleExecFile = getGradleExecFile;
23
23
  function execGradleAsync(args, execOptions = {}) {
24
24
  const gradleBinaryPath = getGradleBinaryPath();
25
25
  return new Promise((res, rej) => {
@@ -43,4 +43,3 @@ function execGradleAsync(args, execOptions = {}) {
43
43
  });
44
44
  });
45
45
  }
46
- exports.execGradleAsync = execGradleAsync;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processProjectReports = exports.populateGradleReport = exports.getCurrentGradleReport = exports.gradleConfigAndTestGlob = exports.gradleConfigGlob = exports.GRADLE_TEST_FILES = exports.GRADLE_BUILD_FILES = exports.newLineSeparator = exports.fileSeparator = void 0;
3
+ exports.gradleConfigAndTestGlob = exports.gradleConfigGlob = exports.GRADLE_TEST_FILES = exports.GRADLE_BUILD_FILES = exports.newLineSeparator = exports.fileSeparator = void 0;
4
+ exports.getCurrentGradleReport = getCurrentGradleReport;
5
+ exports.populateGradleReport = populateGradleReport;
6
+ exports.processProjectReports = processProjectReports;
4
7
  const node_fs_1 = require("node:fs");
5
8
  const node_path_1 = require("node:path");
6
9
  const devkit_1 = require("@nx/devkit");
@@ -28,7 +31,6 @@ function getCurrentGradleReport() {
28
31
  }
29
32
  return gradleReportCache;
30
33
  }
31
- exports.getCurrentGradleReport = getCurrentGradleReport;
32
34
  async function populateGradleReport(workspaceRoot) {
33
35
  const gradleConfigHash = await (0, workspace_context_1.hashWithWorkspaceContext)(workspaceRoot, [
34
36
  exports.gradleConfigGlob,
@@ -67,7 +69,6 @@ async function populateGradleReport(workspaceRoot) {
67
69
  performance.measure('gradleProjectReport', gradleProjectReportStart.name, gradleProjectReportEnd.name);
68
70
  gradleReportCache = processProjectReports(projectReportLines);
69
71
  }
70
- exports.populateGradleReport = populateGradleReport;
71
72
  function processProjectReports(projectReportLines) {
72
73
  /**
73
74
  * Map of Gradle File path to Gradle Project Name
@@ -181,4 +182,3 @@ function processProjectReports(projectReportLines) {
181
182
  gradleProjectToProjectName,
182
183
  };
183
184
  }
184
- exports.processProjectReports = processProjectReports;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasGradlePlugin = void 0;
3
+ exports.hasGradlePlugin = hasGradlePlugin;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function hasGradlePlugin(tree) {
6
6
  const nxJson = (0, devkit_1.readNxJson)(tree);
7
7
  return !!nxJson.plugins?.some((p) => typeof p === 'string' ? p === '@nx/gradle' : p.plugin === '@nx/gradle');
8
8
  }
9
- exports.hasGradlePlugin = hasGradlePlugin;