@nx/dotnet 22.7.1 → 22.7.3

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.
@@ -27,7 +27,7 @@ export interface DotNetAnalyzerOptions {
27
27
  * Results are cached based on the content hash of all project files.
28
28
  * This should be called by createNodes to populate the cache.
29
29
  */
30
- export declare function analyzeProjects(projectFiles: string[], options?: DotNetAnalyzerOptions): Promise<AnalysisResult>;
30
+ export declare function analyzeProjects(files: string[], options?: DotNetAnalyzerOptions): Promise<AnalysisResult>;
31
31
  /**
32
32
  * Read the cached analysis results without running the analyzer.
33
33
  * This should be called by createDependencies, which always runs after createNodes.
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer-client.d.ts","sourceRoot":"","sources":["../../src/analyzer/analyzer-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMzE,MAAM,WAAW,qBAAqB;IAEpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAElD,gBAAgB,EAAE,MAAM,CACtB,MAAM,EACN;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAC7C,CAAC;CACH;AACD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;CACd;AACD,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AA2BzE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAgJD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,YAAY,E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AAC,CAyDzB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CASzD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,mBAAmB,CAE/B;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,qBAAqB,CAEjC"}
@@ -46,21 +46,22 @@ function getAnalyzerPath() {
46
46
  return path;
47
47
  }
48
48
  }
49
- throw new Error(`msbuild-analyzer not found at any expected location. Please build it first with: nx run dotnet:build-analyzer`);
49
+ throw new Error(`msbuild-analyzer not found at any expected location. Please build it first with: nx run dotnet:copy-assets`);
50
50
  }
51
51
  /**
52
- * Calculate a hash of all project files and Directory.Build.* files to determine if we need to re-analyze
52
+ * Hash every file that affects MSBuild evaluation project files plus the Directory.*
53
+ * matches surfaced by the createNodesV2 glob. The analyzer partitions the same list on
54
+ * its side, so we don't classify it here.
53
55
  */
54
- async function calculateProjectFilesHash(projectFiles) {
55
- const hash = await (0, workspace_context_1.hashWithWorkspaceContext)(devkit_1.workspaceRoot, projectFiles.concat('Directory.Build.*', '**/Directory.Build.*'));
56
- return hash;
56
+ async function calculateProjectFilesHash(files) {
57
+ return await (0, workspace_context_1.hashWithWorkspaceContext)(devkit_1.workspaceRoot, files);
57
58
  }
58
59
  /**
59
60
  * Run the msbuild-analyzer and return the results.
60
61
  * Uses stdin for large file lists to avoid ARG_MAX issues.
61
62
  */
62
- function runAnalyzer(projectFiles, options) {
63
- if (projectFiles.length === 0) {
63
+ function runAnalyzer(files, options) {
64
+ if (files.length === 0) {
64
65
  return { nodesByFile: {}, referencesByRoot: {} };
65
66
  }
66
67
  const analyzerPath = getAnalyzerPath();
@@ -98,8 +99,9 @@ function runAnalyzer(projectFiles, options) {
98
99
  if (options) {
99
100
  args.push(JSON.stringify(options));
100
101
  }
101
- // Use stdin mode for large file lists to avoid ARG_MAX issues
102
- const input = projectFiles.join('\n');
102
+ // Use stdin mode for large file lists to avoid ARG_MAX issues. The analyzer
103
+ // partitions paths by filename, so we just stream everything in one block.
104
+ const input = files.join('\n');
103
105
  const result = (0, node_child_process_1.spawnSync)('dotnet', args, {
104
106
  input,
105
107
  encoding: 'utf-8',
@@ -134,8 +136,8 @@ function runAnalyzer(projectFiles, options) {
134
136
  * Results are cached based on the content hash of all project files.
135
137
  * This should be called by createNodes to populate the cache.
136
138
  */
137
- async function analyzeProjects(projectFiles, options) {
138
- const filesHash = await calculateProjectFilesHash(projectFiles);
139
+ async function analyzeProjects(files, options) {
140
+ const filesHash = await calculateProjectFilesHash(files);
139
141
  // Return cached results if the hash matches
140
142
  if (cache &&
141
143
  cache.hash === filesHash &&
@@ -158,7 +160,7 @@ async function analyzeProjects(projectFiles, options) {
158
160
  }
159
161
  // Run the analyzer
160
162
  try {
161
- const result = runAnalyzer(projectFiles, options);
163
+ const result = runAnalyzer(files, options);
162
164
  // Update local cache
163
165
  cache = {
164
166
  hash: filesHash,
Binary file
@@ -6,7 +6,7 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v8.0": {
9
- "MsbuildAnalyzer/1.0.0": {
9
+ "MsbuildAnalyzer/22.7.3": {
10
10
  "dependencies": {
11
11
  "Microsoft.Build": "17.0.0",
12
12
  "Microsoft.Build.Framework": "17.0.0",
@@ -222,7 +222,7 @@
222
222
  }
223
223
  },
224
224
  "libraries": {
225
- "MsbuildAnalyzer/1.0.0": {
225
+ "MsbuildAnalyzer/22.7.3": {
226
226
  "type": "project",
227
227
  "serviceable": false,
228
228
  "sha512": ""
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"create-nodes.d.ts","sourceRoot":"","sources":["../../src/plugins/create-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGb,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAOpB,MAAM,MAAM,2BAA2B,GAAG,OA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AC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC9C;;;OAGG;IACH,IAAI,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC5C;;;OAGG;IACH,GAAG,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;CAC3C;AAqFD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,mBAAmB,CA6E5D,CAAC"}
@@ -4,7 +4,15 @@ exports.createNodesV2 = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const analyzer_client_1 = require("../analyzer/analyzer-client");
6
6
  const project_configuration_utils_1 = require("nx/src/project-graph/utils/project-configuration-utils");
7
- const dotnetProjectGlob = '**/*.{csproj,fsproj,vbproj}';
7
+ // MSBuild auto-imports Directory.Build.props/.targets from each ancestor of a project file,
8
+ // reads Directory.Build.rsp from ancestors during CLI builds, applies Directory.Solution.*
9
+ // when building a .sln, and reads Directory.Packages.props from the nearest ancestor when
10
+ // Central Package Management is in use. Matching them here causes createNodesV2 to re-run
11
+ // (and the analyzer's cache to invalidate) when any of them change, and gives us the file
12
+ // list to hand to the analyzer so it can declare per-project ancestor inputs.
13
+ // The analyzer partitions matched paths into project vs directory files by filename, so we
14
+ // don't have to repeat that classification on this side.
15
+ const dotnetProjectGlob = '**/{*.{csproj,fsproj,vbproj},Directory.Build.{props,targets,rsp},Directory.Solution.{props,targets},Directory.Packages.props}';
8
16
  /**
9
17
  * Merge user-specified target configurations with the generated targets from the analyzer
10
18
  */
@@ -91,9 +99,12 @@ exports.createNodesV2 = [
91
99
  return configFilePaths.map((configFile) => {
92
100
  const node = nodesByFile[configFile];
93
101
  if (!node) {
102
+ // Directory.Build.* / Directory.Solution.* files contribute no projects of
103
+ // their own; returning an empty config is the conventional "skip" response.
94
104
  return [configFile, {}];
95
105
  }
96
- // Merge user-specified target configurations with generated targets
106
+ // Merge user-specified target configurations with generated targets. The analyzer
107
+ // has already written the Directory.* inputs onto each cacheable target's Inputs.
97
108
  const mergedNode = mergeUserTargetConfigurations(node, normalizedOptions);
98
109
  return [
99
110
  configFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/dotnet",
3
- "version": "22.7.1",
3
+ "version": "22.7.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for .NET containing graph support for working with .NET projects in an Nx workspace.",
6
6
  "keywords": [
@@ -50,16 +50,16 @@
50
50
  "!dist/tsconfig.lib.tsbuildinfo"
51
51
  ],
52
52
  "dependencies": {
53
- "@nx/devkit": "22.7.1",
53
+ "@nx/devkit": "22.7.3",
54
54
  "tslib": "^2.3.0",
55
55
  "ignore": "^7.0.5"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/jest": "30.0.0",
59
59
  "@types/node": "^20.19.10",
60
- "jest": "^30.0.2",
60
+ "jest": "30.3.0",
61
61
  "memfs": "^4.9.2",
62
- "nx": "22.7.1",
62
+ "nx": "22.7.3",
63
63
  "ts-jest": "^29.4.0",
64
64
  "typescript": "~5.9.2"
65
65
  },