Skip to content

Commit a5d34fd

Browse files
authored
chore(repo): add .NET format check + codeowners and unify native target handling (#33323)
## Current Behavior Maven and .NET use a bespoke script to handle skipping an optional native target in case a system is not setup on a dev's machine. .NET isn't in codeowners ## Expected Behavior This pull request introduces improvements to the build and formatting workflows for the `.NET` and Maven plugins, streamlining the execution of native targets and updating code ownership assignments. The changes focus on refactoring build scripts to use a unified runner, adding new formatting capabilities for .NET projects, and updating the CODEOWNERS file for clearer team responsibilities. **Build and Format Workflow Improvements** * Refactored the `.NET` analyzer build command in `packages/dotnet/project.json` to use the new `run-native-target.js` script, replacing the previous direct script invocation. [[1]](diffhunk://#diff-036c1a7f2e7d98f5a3207441f2ff1cb25b5b5a03343672ce473f4ff0189a5946L25-R25) [[2]](diffhunk://#diff-42d990ddcbf8d3585553503097ee8b8d1fff8cb6e25e0cd545a87e11d64c03a8L1-L7) * Added new `format-native` and `_format-native` targets to `packages/dotnet/project.json`, enabling verification and fixing of code formatting for the .NET analyzer using `dotnet format`. **Unified Native Target Runner** * Introduced the `scripts/run-native-target.js` script to standardize running native build and install targets, controlled by environment variables for skipping builds. **Maven Plugin Build Refactor** * Updated the Maven plugin's install workflow in `packages/maven/maven-plugin/project.json` to use the new native target runner, and removed the obsolete `scripts/build-maven-analyzer.js` script. [[1]](diffhunk://#diff-2763fe8a7c2989643f53370a14a08c06616e85c29340fd5bcfa1a67d0deaee7aL11-R11) [[2]](diffhunk://#diff-972edab06956ad35145cbc20b8e250e7067fbb288b1f99c92661c24f64d3e69dL1-L7) **Ownership Updates** * Updated the `CODEOWNERS` file to assign `.NET`-related directories to `@FrozenPandaz` and `@AgentEnder`, clarifying team responsibilities. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent 4507b5a commit a5d34fd

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
133133
/e2e/workspace-create/** @nrwl/nx-core-reviewers
134134
/e2e/release/** @nrwl/nx-core-reviewers
135135

136+
# .NET
137+
/packages/dotnet/** @FrozenPandaz @AgentEnder
138+
/e2e/dotnet/** @FrozenPandaz @AgentEnder
139+
136140
# Misc
137141
/e2e/lerna-smoke-tests/** @vsavkin @JamesHenry
138142
/e2e/utils/** @meeroslav @nrwl/nx-testing-tools-reviewers @vsavkin

packages/dotnet/project.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"cache": true
2323
},
2424
"build-analyzer": {
25-
"command": "node ./scripts/build-msbuild-analyzer.js",
25+
"command": "node ./scripts/run-native-target.js _build-analyzer dotnet",
2626
"cache": true,
2727
"outputs": ["{workspaceRoot}/dist/msbuild-analyzer"],
2828
"inputs": ["{projectRoot}/analyzer/**", { "env": "SKIP_ANALYZER_BUILD" }]
@@ -40,6 +40,20 @@
4040
"parallel": false
4141
}
4242
},
43+
"format-native": {
44+
"command": "node ./scripts/run-native-target.js _format-native dotnet"
45+
},
46+
"_format-native": {
47+
"command": "dotnet format {projectRoot}/analyzer/MsbuildAnalyzer.csproj",
48+
"options": {
49+
"args": ["--verify-no-changes"]
50+
},
51+
"configurations": {
52+
"fix": {
53+
"args": []
54+
}
55+
}
56+
},
4357
"legacy-post-build": {
4458
"executor": "@nx/workspace-plugin:legacy-post-build",
4559
"dependsOn": ["build-base", "build-analyzer"],

packages/maven/maven-plugin/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"command": "for i in {1..5}; do ./mvnw install && break || sleep 10; done"
99
},
1010
"_install": {
11-
"command": "node scripts/build-maven-analyzer.js"
11+
"command": "node scripts/run-native-target.js install nx-maven-plugin"
1212
}
1313
}
1414
}

scripts/build-maven-analyzer.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/build-msbuild-analyzer.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/run-native-target.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @ts-check
2+
3+
const { execSync } = require('node:child_process');
4+
5+
if (
6+
process.env.SKIP_ANALYZER_BUILD !== 'true' &&
7+
process.env.SKIP_NATIVE_TARGET !== 'true'
8+
) {
9+
const [target, project] = process.argv.slice(2);
10+
execSync(`nx run ${project}:${target}`, { stdio: 'inherit' });
11+
}

0 commit comments

Comments
 (0)