-
Notifications
You must be signed in to change notification settings - Fork 6k
Change pub_get_offline hook to find engine src relative to script #33869
Conversation
If a gclient checkout checks out engine source to a different directory, the source packages should be found relative to the script location. Bug: dart-lang/sdk#49163
tools/pub_get_offline.py
Outdated
| pub_count = 0 | ||
| for package in ALL_PACKAGES: | ||
| if FetchPackage(pubcmd, package) != 0: | ||
| package_path = os.path.join(engine_src, ".." , package) |
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.
I could modify the package paths to remove the need for .., or I could create the array of package paths based on engine_src, moving it to a global variable ENGINE_SRC, if that is better.
tools/pub_get_offline.py
Outdated
| leading = os.path.join( | ||
| "src", "third_party", "dart", "tools", "sdks", "dart-sdk", "bin" | ||
| ) | ||
| script = os.path.realpath(__file__) |
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.
I think the right thing to do is to follow the pattern that we use in other scripts for setting these paths up as globals like in:
then you can rewrite the paths in ALL_PACKAGES.
# Check that this is right.
SRC_ROOT = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter')
DART_BIN = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'dart')
ALL_PACKAGES = [
os.path.join(FLUTTER_DIR, "ci"),
...
]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, changed to match that pattern.
Ran ci/bin/format.dart.
Tested the script by running from different working directories.
Tested the script detecting missing packages by injecting a missing dependency and testing.
If a gclient checkout checks out engine source to a different directory, the source packages should be found relative to the script location. Bug: dart-lang/sdk#49163
|
Huh. Sorry about the delay. My GitHub workflow is email driven, and I don't know why I missed this one. |
…utter#33869) * Change pub_get_offline hook to find engine src relative to script If a gclient checkout checks out engine source to a different directory, the source packages should be found relative to the script location. Bug: dart-lang/sdk#49163 * Change pub_get_offline hook to find engine src relative to script If a gclient checkout checks out engine source to a different directory, the source packages should be found relative to the script location. Bug: dart-lang/sdk#49163 * Fix merge errors, run ci/bin/format.dart
If a gclient checkout checks out engine source to a different directory than src/,
the source packages should be found relative to the script location.
The instructions for Flutter developers say to check out engine to engine/src,
and this change allows a gclient solution to check out to a different path and
still run the hooks.
Bug: dart-lang/sdk#49163