-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tools/build_third_party.py #328
Conversation
tools/build_third_party.py
Outdated
# -------------------- | ||
# This script updates the third party dependencies of deno. | ||
# | ||
# - Get Depot Tools and make sure it's in your path. |
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.
It might be nice to print an error when depot tools aren't available/found
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.
ditto for the yarn dep
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.
Thanks for the comment! I agree. I'll try it.
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.
Actually I prefer not adding extra code for those checks. run()
will fail with a stack trace that can diagnose that issue. This script is not user facing.
.gitignore
Outdated
@@ -2,7 +2,7 @@ | |||
/out/ | |||
|
|||
# npm deps | |||
node_modules | |||
/third_party/node_modules |
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.
please don't change this line - we might have multiple node_modules
in near future
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.
Thanks for the comment! I updated the line.
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.
Great - thank you!
I have a few comments...
.travis.yml
Outdated
@@ -28,7 +28,7 @@ install: | |||
- curl -sSf https://sh.rustup.rs | sh -s -- -y | |||
- export PATH=$HOME/.cargo/bin:$PATH | |||
- rustc --version | |||
- (cd js; yarn) | |||
- (cd third_party; yarn) | |||
- (cd third_party; gclient sync -j2 --no-history) |
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.
You should be able to replace these lines with ./tools/build_third_party.py
?
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.
If dropping -j2
doesn't cause a problem, then that should work. I'll try that on this PR.
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.
Yes - that should be fine. (I think gclient is -j1
by default and I was just testing to see if -j2
made things faster - it doesn't - but it got left in)
third_party/yarn.lock
Outdated
@@ -54,12 +54,12 @@ | |||
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69" |
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.
Can you do this PR without upgrading the deps?
tools/build_third_party.py
Outdated
# coding=utf-8 | ||
# | ||
# build_third_party.py | ||
# -------------------- |
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.
Lines 2-5 are unnecessary
|
||
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
third_party_path = os.path.join(root_path, "third_party") | ||
script_name = "build_third_party.py" |
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 sync_third_party.py
is a better name. What do you think?
build_third_party.py
is better.
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 agree. This script doesn't build things, but basically updates the deps.
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.
@kt3k actually I changed my mind- it is only syncing now, but it will be doing more "build" type things later - like creating symlinks (see comment)
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.
OK.
it will be doing more "build" type things later - like creating symlinks
That's why you called this build_*
first.
tools/build_third_party.py
Outdated
|
||
def main(): | ||
os.chdir(third_party_path) | ||
print "cwd=" + third_party_path |
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.
Remove debug print
tools/build_third_party.py
Outdated
print "cwd=" + third_party_path | ||
run(["gclient", "sync", "--no-history"]) | ||
run(["yarn"]) | ||
print "✨ Done (" + script_name + ")" |
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.
Remove emoji
tools/build_third_party.py
Outdated
print "✨ Done (" + script_name + ")" | ||
|
||
def run(args): | ||
print "+" + " ".join(args) |
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.
Remove "+" +
I am waiting for your stabilized build scripts so that I can put them in #323. The essence is three files: Since #323 doesn't touch .travis.yml, updating it would have no effect on CI. It might help you explore different build scripts for various Linux platforms that can be emulated in Docker. Travis CI is just one of the cases. We might want automated build on Azure/AWS/GCP etc. down the road. It is easy to write specific development/test/deployment work flows in docker compose. No need to be limited to the specific platform the library authors are working on. |
@ontouchstart Let's land this bit first. I will review #323 soon - sorry for the delay - but switching to docker is a lower priority and needs to be thought thru carefully. |
Eventually this script should also create Ideally we would be able to (PS we have a windows compatible symlink function in python here .. maybe we should start a python library of common utilities and that routine can be used here.) |
tools/sync_third_party.py
Outdated
|
||
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
third_party_path = os.path.join(root_path, "third_party") | ||
script_name = "sync_third_party.py" |
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.
Rename file back to build_third_party.py
Use __file__
here
tools/sync_third_party.py
Outdated
print "Done (" + script_name + ")" | ||
|
||
def run(args): | ||
print " ".join(args) |
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.
Run yapf across this file. I think there's inconstant quotation marks.
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.
LGTM after renaming to build_third_party.py
again.
README.md
Outdated
|
||
(cd js; yarn install) | ||
Generate ninja configuration files. |
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.
s/configuration//
tools/sync_third_party.py
Outdated
# - You need yarn installed as well. | ||
# https://yarnpkg.com/lang/en/docs/install/ | ||
# Use gclient_config.py to modify the git deps. | ||
# Use js/package.json to modify the npm deps. |
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.
Consider using absolute paths when talking about the configuration files:
Use //gclient_config.py to modify the git deps.
Use //js/package.json to modify the npm deps.
…noland#328) Needed to solve denoland#20528 where we need to skip pumping V8 message loop for some time. Also adds "JsRuntime::with_event_loop" helper to run a future concurrently with the event loop.
This PR tries to solve #312. I added tools/build_third_party.py, which runs gclient and yarn for updating gclient deps and npm deps.
I moved the place of
node_modules
from js/ to third_party/ (and made the symlinkjs/node_modules
to point it) to enable separating third_party to a different repository and store all deps in it.