-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add nx plugin #50984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add nx plugin #50984
Conversation
This commit sets up Nx Cloud for your Nx workspace, enabling distributed caching and the Nx Cloud GitHub integration for fast CI and improved developer experience. You can access your Nx Cloud workspace by going to https://staging.nx.app/orgs/67cf576f7df53b293055263b/workspaces/68d433e5997fbc40b28ff0d7 **Note:** This commit attempts to maintain formatting of the nx.json file, however you may need to correct formatting by running an nx format command and committing the changes.
feat(nx-cloud): set up nx workspace
This PR is targeting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an Nx plugin to provide build orchestration and project graph functionality for .NET SDK projects. The main purpose is to integrate Nx tooling to manage the complex build dependencies within the .NET SDK repository.
Key changes include:
- Custom Nx plugin implementation for detecting and building .NET projects
- TypeScript configuration for the plugin build system
- GitHub workflow for comparing Nx vs traditional build performance
- Project configuration files to enable Nx workspace functionality
Reviewed Changes
Copilot reviewed 200 out of 202 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tools/nx-plugin/src/index.ts | Core plugin implementation with project detection and target generation for .NET projects |
tsconfig.base.json | Base TypeScript configuration with path mapping for the nx-plugin |
tools/nx-plugin/tsconfig*.json | TypeScript configuration files for the plugin build |
tools/nx-plugin/project.json | Nx project configuration for the plugin with build targets |
tools/nx-plugin/package.json | Package definition for the plugin library |
nx.json | Nx workspace configuration enabling the custom plugin |
package.json | Root package.json with Nx dependencies |
.github/workflows/nx-comparison.yml | GitHub Actions workflow to compare build performance |
research/redist-build-analysis.md | Documentation explaining build dependency issues |
.prettierrc/.prettierignore | Code formatting configuration |
src/Layout/redist/*/project.json | Project configuration files for redist components |
.claude/settings.local.json | Local settings for development tools |
const filename = | ||
basename(configFilePath, '.csproj') || | ||
basename(configFilePath, '.fsproj') || | ||
basename(configFilePath, '.vbproj'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logical OR operator will return the first truthy value, but basename(configFilePath, '.csproj')
will always return a string (potentially the full filename if extension doesn't match). This means the .fsproj
and .vbproj
cases will never be reached. Use parse(configFilePath).name
instead to get the filename without extension.
Copilot uses AI. Check for mistakes.
const nameWithoutExtension = | ||
basename(projectFileName, '.csproj') || | ||
basename(projectFileName, '.fsproj') || | ||
basename(projectFileName, '.vbproj'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as in inferProjectName
- the logical OR operator will not work as expected since basename()
always returns a string. The second and third calls will never execute. Use parse(projectFileName).name
to get the filename without extension.
const nameWithoutExtension = | |
basename(projectFileName, '.csproj') || | |
basename(projectFileName, '.fsproj') || | |
basename(projectFileName, '.vbproj'); | |
const nameWithoutExtension = parse(projectFileName).name; |
Copilot uses AI. Check for mistakes.
echo "Without Nx DTE Job Duration: $(( ${{ needs.withoutNx.outputs.end_time }} - ${{ needs.withoutNx.outputs.start_time }} )) seconds" | ||
echo "With Nx DTE Job Duration: $(( ${{ needs.main.outputs.end_time }} - ${{ needs.main.outputs.start_time }} )) seconds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job outputs are not being set in the workflow. The withoutNx
and main
jobs record start_time and end_time but don't expose them as job outputs. Add outputs:
sections to both jobs with the timing values.
Copilot uses AI. Check for mistakes.
const output = execSync(`dotnet list "${projectFile}" reference`, { | ||
cwd: this.workspaceRoot, | ||
encoding: 'utf8', | ||
windowsHide: true, | ||
}); | ||
|
||
return output | ||
.split('\n') | ||
.slice(2) // Skip header lines | ||
.map((line) => line.trim()) | ||
.filter((line) => line.length > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The execSync
call doesn't handle potential errors from the dotnet command. If the project file doesn't exist or dotnet fails, this will throw an uncaught exception. Wrap in try-catch and return empty array on failure, or provide a more descriptive error message.
const output = execSync(`dotnet list "${projectFile}" reference`, { | |
cwd: this.workspaceRoot, | |
encoding: 'utf8', | |
windowsHide: true, | |
}); | |
return output | |
.split('\n') | |
.slice(2) // Skip header lines | |
.map((line) => line.trim()) | |
.filter((line) => line.length > 0); | |
try { | |
const output = execSync(`dotnet list "${projectFile}" reference`, { | |
cwd: this.workspaceRoot, | |
encoding: 'utf8', | |
windowsHide: true, | |
}); | |
return output | |
.split('\n') | |
.slice(2) // Skip header lines | |
.map((line) => line.trim()) | |
.filter((line) => line.length > 0); | |
} catch (error) { | |
logger.warn( | |
`Failed to get project references for ${projectFile}: ${error instanceof Error ? error.message : error}` | |
); | |
return []; | |
} |
Copilot uses AI. Check for mistakes.
}, | ||
dependsOn: [`^${options.restoreTargetName}`], | ||
cache: true, | ||
inputs: ['{projectRoot}/' + fileName], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String concatenation should use template literals or join()
for better readability and consistency with the rest of the codebase. Change to inputs: [\
{projectRoot}/${fileName}`]`.
inputs: ['{projectRoot}/' + fileName], | |
inputs: [`{projectRoot}/${fileName}`], |
Copilot uses AI. Check for mistakes.
This was an accident - ignore me |
@AgentEnder please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement ( “Agreement” ) is agreed to by the party signing below ( “You” ), 1. Definitions. “Code” means the computer software code, whether in human-readable or machine-executable form, “Project” means any of the projects owned or managed by .NET Foundation and offered under a license “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any “Submission” means the Code and any other copyrightable material Submitted by You, including any 2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any 3. Originality of Work. You represent that each of Your Submissions is entirely Your 4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else 5. Licenses. a. Copyright License. You grant .NET Foundation, and those who receive the Submission directly b. Patent License. You grant .NET Foundation, and those who receive the Submission directly or c. Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement. 6. Representations and Warranties. You represent that You are legally entitled to grant the above 7. Notice to .NET Foundation. You agree to notify .NET Foundation in writing of any facts or 8. Information about Submissions. You agree that contributions to Projects and information about 9. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and 10. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and .NET Foundation dedicates this Contribution License Agreement to the public domain according to the Creative Commons CC0 1. |
No description provided.