-
Notifications
You must be signed in to change notification settings - Fork 616
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
[rush] support build/rebuild command in rush plugin #5163
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="TikTok Inc" |
}; | ||
this.commands.set(rebuildCommand.name, rebuildCommand); | ||
const buildCommand: Command | undefined = this.commands.get(RushConstants.buildCommandName); | ||
if (buildCommand && !this.commands.has(RushConstants.rebuildCommandName)) { |
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.
If we're auto-filling rebuild
based on the existing build
, then the command should be an exact clone of whatever the current build
command is, but with incremental: false
.
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.
I agree that it should inherit more of the state. For example, if for some reason the rush build
command is customized to have safeForSimultaneousRushProcesses: true
or enableParallelism: false
, those parameters should be inherited by rush rebuild
.
But it should not be an EXACT clone as you say. For example, the original motivation of DEFAULT_BUILD_COMMAND_JSON
and DEFAULT_REBUILD_COMMAND_JSON
was to provide professionally worded summaries and descriptions, without requiring every custom command to copy+paste that text into command-line.json.
📌 But this request is arguably outside the scope of PR #5163. It can be a separate GitHub issue or PR, and certainly needs a separate changelog.
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.
I had missed how few fields are currently within DEFAULT_REBUILD_COMMAND_JSON
and that it was almost entirely the strings. This does make sense as currently written.
Edit: I stand corrected that there is, in fact, currently support for plugins to define |
Can we just make |
Explicitly using extends in Is this a breaking change for all the Rush plugins that contain command-line.json? |
The existing functionality can stay as-is, I'd just recommend we update the loader of command-line.json to be based on |
Currently, the |
I have some reservations about supporting Under the current design, a subset of related phases/commands is completely specified by exactly one self-contained command-line.json file. Sometimes that file comes from a plugin, but even so Rush's design ensures that the plugin's command-line.json file will be committed to Git and easily discoverable. The design change introduced by PR #5163 is merely fixing an oversight where the 📌 In any case, if "The existing functionality can stay as-is", then this debatable proposal can be handled via a separate GitHub issue or PR. We don't need to block @chengbapi's PR behind that discussion. |
}); | ||
|
||
describe('in repo plugin with conflict build command', () => { | ||
it(`throws an error when starting Rush`, async () => { |
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.
Seems like failing cases are being put in RushCommandLineParserFailureCases.test.ts instead
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.
I do have this doubt, but seeing that there are also failing cases in L:257, L:269, and L:281, I thought I could put it in this file.
If this is indeed how it is designed, I can move it over.
Summary
When rush load the default command line configuration, it adds the default build commands and register the action before loading commands from rush plugin.
This leaves no opportunity for the Rush plugin to set the build/rebuild command, even if there is no build/rebuild in the default command line configuration.
Details
Instead of including the default build/rebuild in the default command line configuration, I add a condition to check if a plugin contains a build/rebuild command. If so, the default inclusion behavior will be disabled by setting doNotIncludeDefaultBuildCommands.
To ensure that the build/rebuild commands are properly set, the plugin configuration will also extend the default build/rebuild commands if they exist in the configuration.
To provide a quick overview of the current and expected behavior:"
current behavior:
D: default
expected behavior:
How it was tested
Four automated test cases are added.
rush build
andrush rebuild
should work as expected. The build command summary should indicate that the action is registered by the pluginAffliated