Skip to content
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

Use Cargo to install rust deps into //third_party/rust_crates #366

Closed
ry opened this issue Jul 13, 2018 · 6 comments
Closed

Use Cargo to install rust deps into //third_party/rust_crates #366

ry opened this issue Jul 13, 2018 · 6 comments

Comments

@ry
Copy link
Member

ry commented Jul 13, 2018

Currently we are using gclient to mange rust deps:
https://github.com/ry/deno/blob/ad4f335847daffcc5556008aebebaf2d1eecac67/gclient_config.py#L42-L65
These get installed by tools/build_third_party.py
https://github.com/ry/deno/blob/ad4f335847daffcc5556008aebebaf2d1eecac67/tools/build_third_party.py#L30
This task would instead call cargo install to put that source code into //third_party/rust_crates.

I still want to define the build and linking manually in //build_extra/rust/BUILD.gn:
https://github.com/ry/deno/blob/master/build_extra/rust/BUILD.gn#L24-L57
This task is only about how to fetch the source code. Deno does not aim to build like a normal rust package at this point. "cargo build" in the root project directory will fail - that's ok.

Part of this task will be creating a Cargo.toml file for the project. There are only two third party deps so far: "url" and "libc".

@robbym
Copy link
Contributor

robbym commented Jul 13, 2018

I was under the assumption that cargo install was strictly for downloading and installing binary packages instead of libraries (mentioned here rust-lang/cargo#2552). Although I get the idea of what you want.

@robbym
Copy link
Contributor

robbym commented Jul 13, 2018

cargo fetch seems to be the one. Will investigate.
Have also been referenced https://github.com/alexcrichton/cargo-vendor

Edit: cargo fetch and the info on it seems to be outdated.

@robbym
Copy link
Contributor

robbym commented Jul 13, 2018

This functionality doesn't seem to exist in one place, one tool more specifically.
There is an open issue that addresses it though.
rust-lang/cargo#1861

@robbym
Copy link
Contributor

robbym commented Jul 14, 2018

The third-party cargo subcommand cargo clone does the right thing: https://github.com/JanLikar/cargo-clone, but its command line arguments only.

@f-a-a
Copy link

f-a-a commented Jul 17, 2018

Following from the discussions in #370:

  • Manually parsing Cargo.toml and maintaining the program within deno is a no-go (introducing unnecessary complexity)
  • Most sensible approach is to introduce a cargo subcommand to achieve:
cargo download-deps --download_path=third_party/rust_crates/ --config=./Cargo.toml

and call it in ./tools/build_third_party.py. (@robbym created a POC)

@ry
Copy link
Member Author

ry commented Jul 19, 2018

Fixed in d93bd4b

@ry ry closed this as completed Jul 19, 2018
piscisaureus pushed a commit to piscisaureus/deno that referenced this issue Oct 7, 2019
hardfist pushed a commit to hardfist/deno that referenced this issue Aug 7, 2024
This commit adds "ext:core/mod.js" built-in ES module that reexports
"core", "internals" and "primordials" properties of the 
"globalThis.__bootstrap" namespace. This is very convenient for
embedders that author runtime code using ES modules instead of
scripts, because it allows to import these props directly instead of
capturing "globalThis.__bootstrap" namespace.

To achieve that a new "ModuleMap::lazy_load_es_module_from_code"
method was added that accepts a specifier and source code; instantiates
and evaluates the provided code as ES module.

This will be very useful for
denoland/deno_core#263
and denoland#21422.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants