-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gn] Consolidate exec_script calls to speed up generation
Calling out to python from GN to process gypi files is relatively expensive with a 20-45ms fixed overhead for setup/teardown regardless of what the script does. This makes runtime/vm/BUILD.gn take 1-1.5s (per toolchain) to run as the template for libraries expands out to 25 calls to gypi_to_gn.py, even though the actual time spent processing the gypi files is negligible. This replaces those repeated calls to gypi_to_gn.py with a call to a custom script that process all of the gypi files needed for runtime/vm and places the results into a single scope which can then be read from in the template and replaces a few other scattered calls to gypi_to_gn.py with a smaller number of calls that process multiple gypi files and place the results into a single scope. The end result is processing all of dart's GN files in a fuchsia build takes ~250ms instead of >3 seconds. R=zra@google.com Review URL: https://codereview.chromium.org/2472813002 . Committed: ad86d6e
- Loading branch information
Showing
6 changed files
with
320 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
_gypi_files = [ | ||
"builtin_sources.gypi", | ||
"builtin_impl_sources.gypi", | ||
"vmservice/vmservice_sources.gypi", | ||
"io_sources.gypi", | ||
"io_impl_sources.gypi", | ||
] | ||
|
||
_gypi_contents = exec_script("../../tools/gypi_to_gn.py", | ||
rebase_path(_gypi_files) + [ "--prefix" ], | ||
"scope", | ||
_gypi_files) | ||
|
||
resources_sources_gypi = _gypi_contents.vmservice_sources_sources | ||
|
||
builtin_sources_gypi = _gypi_contents.builtin_sources_sources | ||
builtin_impl_sources_gypi = _gypi_contents.builtin_impl_sources_sources | ||
|
||
io_sources_gypi = _gypi_contents.io_sources_sources | ||
io_impl_sources_gypi = _gypi_contents.io_impl_sources_sources | ||
|
||
_test_gypi_files = [ | ||
"../vm/vm_sources.gypi", | ||
"builtin_impl_sources.gypi", | ||
] | ||
|
||
_test_only_gypi_contents = exec_script("../../tools/gypi_to_gn.py", | ||
rebase_path(_test_gypi_files) + [ | ||
"--keep_only=_test.cc", | ||
"--keep_only=_test.h", | ||
"--prefix", | ||
], | ||
"scope", | ||
_test_gypi_files) | ||
|
||
# The VM sources are already included in libdart, so we just want to add in | ||
# the tests here. | ||
vm_tests_list = _test_only_gypi_contents.vm_sources_sources | ||
builtin_impl_tests_list = _test_only_gypi_contents.builtin_impl_sources_sources |
Oops, something went wrong.