[felt] Eliminate ninja-jobs argument (flutter/engine#21135)

Migrate to autoninja which works out the ideal level of parallelism.
This commit is contained in:
Chris Bracken
2020-09-14 11:12:16 -07:00
committed by GitHub
parent e533ed4a92
commit 59e39baf33
2 changed files with 4 additions and 26 deletions

View File

@@ -31,14 +31,6 @@ If you don't want to add `felt` to your path, you can still invoke it using a re
## Speeding up your builds and tests
You can speed up `ninja` and `dart2js` by adding parallelism and taking advantage of more cores.
To speed up ninja pass `-j` to specify the desired level of parallelism, like so:
```
felt build [-w] -j 100
```
If you are a Google employee, you can use an internal instance of Goma to parallelize your builds. Because Goma compiles code on remote servers, this option is effective even on low-powered laptops.
By default, when compiling Dart code to JavaScript, we use 8 `dart2js` workers.

View File

@@ -21,11 +21,6 @@ class BuildCommand extends Command<bool> with ArgUtils {
abbr: 'w',
help: 'Run the build in watch mode so it rebuilds whenever a change'
'is made.',
)
..addOption(
'ninja-jobs',
abbr: 'j',
help: 'Number of parallel jobs to use in the ninja build.',
);
}
@@ -37,15 +32,12 @@ class BuildCommand extends Command<bool> with ArgUtils {
bool get isWatchMode => boolArg('watch');
int getNinjaJobCount() => intArg('ninja-jobs');
@override
FutureOr<bool> run() async {
final int ninjaJobCount = getNinjaJobCount();
final FilePath libPath = FilePath.fromWebUi('lib');
final Pipeline buildPipeline = Pipeline(steps: <PipelineStep>[
gn,
() => ninja(ninjaJobCount),
() => ninja(),
]);
await buildPipeline.start();
@@ -78,17 +70,11 @@ Future<void> gn() {
}
// TODO(mdebbar): Make the ninja step interruptable in the pipeline.
Future<void> ninja(int ninjaJobs) {
if (ninjaJobs == null) {
print('Running ninja (with default ninja parallelization)...');
} else {
print('Running ninja (with $ninjaJobs parallel jobs)...');
}
return runProcess('ninja', <String>[
Future<void> ninja() {
print('Running autoninja...');
return runProcess('autoninja', <String>[
'-C',
environment.hostDebugUnoptDir.path,
if (ninjaJobs != null) ...['-j', '$ninjaJobs'],
]);
}