@nx/gradle 21.3.0-canary.20250703-84ce831 → 21.3.0-canary.20250704-e92cbee

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-canary.20250703-84ce831",
3
+ "version": "21.3.0-canary.20250704-e92cbee",
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-canary.20250703-84ce831"
38
+ "@nx/devkit": "21.3.0-canary.20250704-e92cbee"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -20,14 +20,17 @@ function writeTargetsToCache(cachePath, results) {
20
20
  exports.createNodesV2 = [
21
21
  split_config_files_1.gradleConfigAndTestGlob,
22
22
  async (files, options, context) => {
23
- const { buildFiles, gradlewFiles } = (0, split_config_files_1.splitConfigFiles)(files);
23
+ const { buildFiles: buildFilesFromSplitConfigFiles, gradlewFiles } = (0, split_config_files_1.splitConfigFiles)(files);
24
24
  const optionsHash = (0, file_hasher_1.hashObject)(options);
25
25
  const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `gradle-${optionsHash}.hash`);
26
26
  const projectsCache = readProjectsCache(cachePath);
27
27
  await (0, get_project_graph_from_gradle_plugin_1.populateProjectGraph)(context.workspaceRoot, gradlewFiles.map((f) => (0, node_path_1.join)(context.workspaceRoot, f)), options);
28
- const { nodes, externalNodes } = (0, get_project_graph_from_gradle_plugin_1.getCurrentProjectGraphReport)();
28
+ const report = (0, get_project_graph_from_gradle_plugin_1.getCurrentProjectGraphReport)();
29
+ const { nodes, externalNodes, buildFiles = [] } = report;
30
+ // Combine buildFilesFromSplitConfigFiles and buildFiles, making each value distinct
31
+ const allBuildFiles = Array.from(new Set([...buildFilesFromSplitConfigFiles, ...buildFiles]));
29
32
  try {
30
- return (0, devkit_1.createNodesFromFiles)((0, exports.makeCreateNodesForGradleConfigFile)(nodes, projectsCache, externalNodes), buildFiles, options, context);
33
+ return (0, devkit_1.createNodesFromFiles)((0, exports.makeCreateNodesForGradleConfigFile)(nodes, projectsCache, externalNodes), allBuildFiles, options, context);
31
34
  }
32
35
  finally {
33
36
  writeTargetsToCache(cachePath, projectsCache);
@@ -1,4 +1,5 @@
1
1
  {
2
+ "buildFiles": ["nested/nested/proj/build.gradle"],
2
3
  "nodes": {
3
4
  "nested/nested/proj": {
4
5
  "targets": {
@@ -1,4 +1,5 @@
1
1
  {
2
+ "buildFiles": ["proj/build.gradle"],
2
3
  "nodes": {
3
4
  "proj": {
4
5
  "targets": {
@@ -6,12 +6,14 @@ export interface ProjectGraphReport {
6
6
  };
7
7
  dependencies: Array<StaticDependency>;
8
8
  externalNodes?: Record<string, ProjectGraphExternalNode>;
9
+ buildFiles?: string[];
9
10
  }
10
11
  export interface ProjectGraphReportCache extends ProjectGraphReport {
11
12
  hash: string;
12
13
  }
13
14
  export declare function writeProjectGraphReportToCache(cachePath: string, results: ProjectGraphReport): void;
14
15
  export declare function getCurrentProjectGraphReport(): ProjectGraphReport;
16
+ export declare function getCurrentBuildFiles(): string[];
15
17
  /**
16
18
  * This function populates the gradle report cache.
17
19
  * For each gradlew file, it runs the `nxProjectGraph` task and processes the output.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeProjectGraphReportToCache = writeProjectGraphReportToCache;
4
4
  exports.getCurrentProjectGraphReport = getCurrentProjectGraphReport;
5
+ exports.getCurrentBuildFiles = getCurrentBuildFiles;
5
6
  exports.populateProjectGraph = populateProjectGraph;
6
7
  exports.processNxProjectGraph = processNxProjectGraph;
7
8
  const node_fs_1 = require("node:fs");
@@ -42,6 +43,10 @@ function getCurrentProjectGraphReport() {
42
43
  }
43
44
  return projectGraphReportCache;
44
45
  }
46
+ function getCurrentBuildFiles() {
47
+ const report = getCurrentProjectGraphReport();
48
+ return report.buildFiles || [];
49
+ }
45
50
  /**
46
51
  * This function populates the gradle report cache.
47
52
  * For each gradlew file, it runs the `nxProjectGraph` task and processes the output.
@@ -84,6 +89,7 @@ function processNxProjectGraph(projectGraphLines) {
84
89
  dependencies: [],
85
90
  externalNodes: {},
86
91
  };
92
+ const allBuildFiles = new Set();
87
93
  while (index < projectGraphLines.length) {
88
94
  const line = projectGraphLines[index].trim();
89
95
  if (line.startsWith('> Task ') && line.endsWith(':nxProjectGraph')) {
@@ -106,8 +112,13 @@ function processNxProjectGraph(projectGraphLines) {
106
112
  ...projectGraphReportJson.externalNodes,
107
113
  };
108
114
  }
115
+ if (projectGraphReportJson.buildFiles) {
116
+ projectGraphReportJson.buildFiles.forEach((buildFile) => allBuildFiles.add(buildFile));
117
+ }
109
118
  }
110
119
  index++;
111
120
  }
121
+ // Convert Set to array for the final result
122
+ projectGraphReportForAllProjects.buildFiles = Array.from(allBuildFiles);
112
123
  return projectGraphReportForAllProjects;
113
124
  }