-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Support -j to use goma in felt build #13259
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,14 @@ 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>` | ||
|
|
||
| ## Using goma | ||
| Goma is a great way to speed up your builds. In order to use goma, you first need to install it. Here are the instructions for [linux](https://g3doc.corp.google.com/devtools/goma/g3doc/how-to-use-goma/how-to-install-goma-linux.md) and [mac](https://g3doc.corp.google.com/devtools/goma/g3doc/how-to-use-goma/how-to-install-goma-mac.md). | ||
|
|
||
| Once goma is installed, you can take advantage of it in your builds: | ||
| ``` | ||
| felt build [-w] -j 100 | ||
| ``` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for derailing this again, but now that we've figured out that Speeding up your buildsYou can speed up your builds by using more CPU cores. Pass 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for writing this up 😃 |
||
|
|
||
| ## Running web engine tests | ||
| To run all tests: | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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( | ||
| 'goma', | ||
| abbr: 'j', | ||
| help: 'Enable parallelization through goma', | ||
|
||
| ); | ||
| } | ||
|
|
||
|
|
@@ -31,12 +36,20 @@ class BuildCommand extends Command<bool> { | |
|
|
||
| bool get isWatchMode => argResults['watch']; | ||
|
|
||
| int get gomaWorkers { | ||
| final String gomaWorkersArg = argResults['goma']; | ||
| if (gomaWorkersArg != null) { | ||
| return int.parse(gomaWorkersArg); | ||
|
||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @override | ||
| FutureOr<bool> run() async { | ||
| final FilePath libPath = FilePath.fromWebUi('lib'); | ||
| final Pipeline buildPipeline = Pipeline(steps: <PipelineStep>[ | ||
| gn, | ||
| ninja, | ||
| () => ninja(gomaWorkers), | ||
| ]); | ||
| await buildPipeline.start(); | ||
|
|
||
|
|
@@ -67,11 +80,17 @@ Future<void> gn() { | |
| } | ||
|
|
||
| // TODO(mdebbar): Make the ninja step interruptable in the pipeline. | ||
| Future<void> ninja() { | ||
| print('Running ninja...'); | ||
| Future<void> ninja(int gomaWorkers) { | ||
| if (gomaWorkers == null) { | ||
| print('Running ninja (with no goma workers)...'); | ||
| } else { | ||
| print('Running ninja (with $gomaWorkers goma workers)...'); | ||
| } | ||
|
|
||
| return runProcess('ninja', <String>[ | ||
| '-C', | ||
| environment.hostDebugUnoptDir.path, | ||
| if (gomaWorkers != null) ...['-j', '$gomaWorkers'], | ||
| ]); | ||
| } | ||
|
|
||
|
|
@@ -106,8 +125,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; | ||
| } | ||
|
|
||
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.
Let's not put internal links in our public docs. Instead, we could have a very short sentence sending googlers to goma, something like:
For googlers: accelerate your builds with goma
If you are a Google employee you can use an internal instance of goma to speed up your builds.
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.
Done.