Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/web_ui/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>`

## For googlers: accelerate your builds with goma
If you are a Google employee you can use an internal instance of [goma](https://goto.google.com/goma) to speed up your builds.

Once goma is installed and ready, you can take advantage of it in your builds:
```
felt build [-w] -j 100
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 -j is available to everyone, how about we make this useful for everyone? Strawman:

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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:
```
Expand Down
30 changes: 26 additions & 4 deletions lib/web_ui/dev/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
);
}

Expand All @@ -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();

Expand Down Expand Up @@ -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'],
]);
}

Expand Down Expand Up @@ -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;
}
Expand Down