Use Cargo to install rust deps into //third_party/rust_crates (#383)

This commit is contained in:
robbym 2018-07-18 17:00:53 -07:00 committed by Ryan Dahl
parent 3dde880c32
commit d93bd4b127
7 changed files with 114 additions and 45 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ node_modules
# third party deps
/third_party/
# RLS generated files
/target/

80
Cargo.lock generated Normal file
View File

@ -0,0 +1,80 @@
[[package]]
name = "cfg-if"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "deno"
version = "0.0.0"
dependencies = [
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "matches"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-bidi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-normalization"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "url"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1"
"checksum log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "61bd98ae7f7b754bc53dca7d44b604f733c6bba044ea6f41bc8d89272d8161d2"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6"

11
Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
# Dummy package info required by `cargo fetch`
# Called from tools/build_third_party.py
# Should not be called with `cargo build`
[package]
name = "deno"
version = "0.0.0"
[dependencies]
url = "1.7.1"
libc = "0.2.42"
log = "0.4.3"

View File

@ -17,12 +17,14 @@ rust_staticlib("stdlib") {
crates = "//third_party/rust_crates"
rust_component("libc") {
source_root = "$crates/libc/src/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/libc-0.2.42/src/lib.rs"
cfg = [ "feature=\"use_std\"" ]
}
rust_component("url") {
source_root = "$crates/url/src/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/url-1.7.1/src/lib.rs"
extern = [
":matches",
":idna",
@ -31,15 +33,17 @@ rust_component("url") {
}
rust_component("percent_encoding") {
source_root = "$crates/url/percent_encoding/lib.rs"
source_root = "$crates/registry/src/github.com-1ecc6299db9ec823/percent-encoding-1.0.1/lib.rs"
}
rust_component("matches") {
source_root = "$crates/rust-std-candidates/matches/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/matches-0.1.6/lib.rs"
}
rust_component("idna") {
source_root = "$crates/url/idna/src/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/idna-0.1.5/src/lib.rs"
extern = [
":matches",
":unicode_bidi",
@ -48,19 +52,21 @@ rust_component("idna") {
}
rust_component("unicode_bidi") {
source_root = "$crates/unicode-bidi/src/lib.rs"
source_root = "$crates/registry/src/github.com-1ecc6299db9ec823/unicode-bidi-0.3.4/src/lib.rs"
extern = [ ":matches" ]
}
rust_component("unicode_normalization") {
source_root = "$crates/unicode-normalization/src/lib.rs"
source_root = "$crates/registry/src/github.com-1ecc6299db9ec823/unicode-normalization-0.1.7/src/lib.rs"
}
rust_component("log") {
source_root = "$crates/log/src/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/log-0.4.3/src/lib.rs"
extern = [ ":cfg_if" ]
}
rust_component("cfg_if") {
source_root = "$crates/cfg_if/src/lib.rs"
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.4/src/lib.rs"
}

View File

@ -34,39 +34,4 @@ solutions = [{
'https://github.com/rw/flatbuffers.git@2018-02--rust',
'name':
'flatbuffers'
}, {
'url':
'https://github.com/rust-lang/libc.git@8a85d662b90c14d458bc4ae9521a05564e20d7ae',
'name':
'rust_crates/libc'
}, {
'url':
'https://github.com/servo/rust-url.git@fbe5e50316105482dcd53d2dabb148c445a5f4cd',
'name':
'rust_crates/url'
}, {
# Needed for url.
'url':
'https://github.com/SimonSapin/rust-std-candidates.git@88a017b79ea146d6fde389c96982fc7518ba98bf',
'name':
'rust_crates/rust-std-candidates'
}, {
# Needed for url.
'url':
'https://github.com/servo/unicode-bidi.git@32c81729db0ac90289ebeca9e0d4886f264e724d',
'name':
'rust_crates/unicode-bidi'
}, {
# Needed for url.
'url':
'https://github.com/behnam/rust-unicode-normalization.git@3898e77b110246cb7243bf29b896c58d8975304a',
'name':
'rust_crates/unicode-normalization'
}, {
'url': 'https://github.com/rust-lang-nursery/log.git@0.4.2',
'name': 'rust_crates/log'
}, {
# Needed for log.
'url': 'https://github.com/alexcrichton/cfg-if.git@0.1.4',
'name': 'rust_crates/cfg_if'
}]

View File

@ -29,3 +29,5 @@ remove_and_symlink(join("v8", "third_party", "llvm-build"), "llvm-build")
remove_and_symlink(join("v8", "third_party", "markupsafe"), "markupsafe")
run(["gclient", "sync", "--shallow", "--no-history"])
run(["yarn"])
run(["cargo", "fetch", "--manifest-path=../Cargo.toml"],
envs={'CARGO_HOME': third_party_path + '/rust_crates'})

View File

@ -4,10 +4,12 @@ import os
import subprocess
def run(args, quiet=False):
def run(args, quiet=False, envs={}):
if not quiet:
print " ".join(args)
env = os.environ.copy()
for key in envs.keys():
env[key] = envs[key]
if os.name == "nt":
# Run through shell to make .bat/.cmd files work.
args = ["cmd", "/c"] + args