-
Notifications
You must be signed in to change notification settings - Fork 698
Limit number of projects that are built concurrently #1692
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
base: main
Are you sure you want to change the base?
Conversation
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 implements the --maxConcurrentProjects
command-line option to limit the number of projects that can be built concurrently during tsc build mode. The feature includes validation for invalid values (negative numbers, zero, and non-numeric inputs) and prevents it from being used together with the --singleThreaded
option.
Key Changes
- Added
--maxConcurrentProjects
build option with integer validation - Implemented error handling for invalid values (negative, zero, or non-numeric)
- Added conflict validation with existing
--singleThreaded
option - Created comprehensive test coverage for various validation scenarios
Reviewed Changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is negative.js | Tests error reporting for negative values |
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is invalid type.js | Tests error reporting for non-numeric values |
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is 0.js | Tests error reporting for zero values |
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/parse --maxConcurrentProjects.js | Tests successful parsing of valid values |
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/--singleThreaded and --maxConcurrentProjects together is invalid.js | Tests conflict detection between incompatible options |
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-8-projects-in-a-solution.js | Baseline test for 8-project solution without concurrency limit |
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-8-projects-in-a-solution-with-maxConcurrentProjects-3.js | Tests 8-project solution with concurrency limit of 3 |
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-5-projects-in-a-solution.js | Baseline test for 5-project solution without concurrency limit |
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-5-projects-in-a-solution-with-maxConcurrentProjects-2.js | Tests 5-project solution with concurrency limit of 2 |
I'm not sure if that helps or not, but in Lerna/Lerna-Lite when running import { cpus } from 'node:os';
const DEFAULT_CONCURRENCY = cpus().length;
const concurrency = Math.max(1, +concurrency || DEFAULT_CONCURRENCY); |
There's an equivalent in Go, but I think we need to come up with some larger plan on how to limit resource usage; this may not be the right way to do things given there's parallelism inside projects such that we might need to instead be limiting the number of concurrent checks, or some other gate. |
Open to option name suggestions
Name of the flag?
Default value?