mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Support -j to use goma in felt build (flutter/engine#13259)
This commit is contained in:
parent
95911a8b6c
commit
da68e322c6
@ -23,6 +23,13 @@ felt build --watch
|
||||
|
||||
If you don't want to add `felt` to your path, you can still invoke it using a relative path like `./web_ui/dev/felt <command>`
|
||||
|
||||
## Speeding up your builds
|
||||
You can speed up your builds by using more CPU cores. 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.
|
||||
|
||||
## Running web engine tests
|
||||
To run all tests:
|
||||
```
|
||||
|
||||
@ -20,6 +20,11 @@ class BuildCommand extends Command<bool> {
|
||||
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.',
|
||||
);
|
||||
}
|
||||
|
||||
@ -31,12 +36,21 @@ class BuildCommand extends Command<bool> {
|
||||
|
||||
bool get isWatchMode => argResults['watch'];
|
||||
|
||||
int getNinjaJobCount() {
|
||||
final String ninjaJobsArg = argResults['ninja-jobs'];
|
||||
if (ninjaJobsArg != null) {
|
||||
return int.tryParse(ninjaJobsArg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<bool> run() async {
|
||||
final int ninjaJobCount = getNinjaJobCount();
|
||||
final FilePath libPath = FilePath.fromWebUi('lib');
|
||||
final Pipeline buildPipeline = Pipeline(steps: <PipelineStep>[
|
||||
gn,
|
||||
ninja,
|
||||
() => ninja(ninjaJobCount),
|
||||
]);
|
||||
await buildPipeline.start();
|
||||
|
||||
@ -67,11 +81,17 @@ Future<void> gn() {
|
||||
}
|
||||
|
||||
// TODO(mdebbar): Make the ninja step interruptable in the pipeline.
|
||||
Future<void> ninja() {
|
||||
print('Running ninja...');
|
||||
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>[
|
||||
'-C',
|
||||
environment.hostDebugUnoptDir.path,
|
||||
if (ninjaJobs != null) ...['-j', '$ninjaJobs'],
|
||||
]);
|
||||
}
|
||||
|
||||
@ -106,8 +126,10 @@ class Pipeline {
|
||||
await _currentStepFuture;
|
||||
}
|
||||
status = PipelineStatus.done;
|
||||
} catch (_) {
|
||||
} catch (error, stackTrace) {
|
||||
status = PipelineStatus.error;
|
||||
print('Error in the pipeline: $error');
|
||||
print(stackTrace);
|
||||
} finally {
|
||||
_currentStepFuture = null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user