mirror of
https://github.com/denoland/deno.git
synced 2025-03-07 03:42:40 -05:00
Support cargo check (#1128)
- Based on code from @qti3e and @piscisaureus in #724 and #1125 respectively. - TODO The DENO_BUILD_PATH env var must be supplied and must be an absolute path, this restriction should be removed in future work.
This commit is contained in:
parent
21dac66465
commit
198e396ead
10 changed files with 83 additions and 20 deletions
|
@ -13,6 +13,7 @@ environment:
|
||||||
DENO_THIRD_PARTY_PATH: $(APPVEYOR_BUILD_FOLDER)\third_party
|
DENO_THIRD_PARTY_PATH: $(APPVEYOR_BUILD_FOLDER)\third_party
|
||||||
MTIME_CACHE_DB: $(APPVEYOR_BUILD_FOLDER)\mtime_cache.xml
|
MTIME_CACHE_DB: $(APPVEYOR_BUILD_FOLDER)\mtime_cache.xml
|
||||||
CARGO_HOME: $(USERPROFILE)\.cargo
|
CARGO_HOME: $(USERPROFILE)\.cargo
|
||||||
|
CARGO_TARGET_DIR: $(APPVEYOR_BUILD_FOLDER)\out\target
|
||||||
RUSTUP_HOME: $(USERPROFILE)\.rustup
|
RUSTUP_HOME: $(USERPROFILE)\.rustup
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
RELEASE_ARTIFACT: deno_win_x64.zip
|
RELEASE_ARTIFACT: deno_win_x64.zip
|
||||||
|
@ -335,6 +336,8 @@ before_build:
|
||||||
build_script:
|
build_script:
|
||||||
- python tools\build.py
|
- python tools\build.py
|
||||||
- ps: Set-FilesNeeded -Auto -Reason "Build finished"
|
- ps: Set-FilesNeeded -Auto -Reason "Build finished"
|
||||||
|
- cargo check --release
|
||||||
|
- ps: Set-FilesNeeded -Auto -Reason "Cargo check finished"
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- python tools\lint.py
|
- python tools\lint.py
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
# build
|
# build
|
||||||
/out/
|
/out/
|
||||||
|
/target/
|
||||||
*.pyc
|
*.pyc
|
||||||
gclient_config.py_entries
|
gclient_config.py_entries
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
|
|
@ -14,6 +14,7 @@ env:
|
||||||
- HOMEBREW_PATH=$HOME/homebrew/
|
- HOMEBREW_PATH=$HOME/homebrew/
|
||||||
- DENO_BUILD_ARGS="use_custom_libcxx=false use_sysroot=false"
|
- DENO_BUILD_ARGS="use_custom_libcxx=false use_sysroot=false"
|
||||||
- DENO_BUILD_PATH=$HOME/out/Default
|
- DENO_BUILD_PATH=$HOME/out/Default
|
||||||
|
- CARGO_TARGET_DIR=$DENO_BUILD_PATH
|
||||||
- DENO_BUILD_MODE=release
|
- DENO_BUILD_MODE=release
|
||||||
- PATH=$TRAVIS_BUILD_DIR/third_party/llvm-build/Release+Asserts/bin:$CARGO_HOME/bin:$PATH
|
- PATH=$TRAVIS_BUILD_DIR/third_party/llvm-build/Release+Asserts/bin:$CARGO_HOME/bin:$PATH
|
||||||
- CCACHE_CPP2=yes
|
- CCACHE_CPP2=yes
|
||||||
|
@ -88,8 +89,9 @@ before_script:
|
||||||
script:
|
script:
|
||||||
- ./tools/lint.py
|
- ./tools/lint.py
|
||||||
- ./tools/test_format.py
|
- ./tools/test_format.py
|
||||||
- bash -c "sleep 2100; pkill ninja" &
|
- bash -c "sleep 2100; pkill ninja; pkill cargo" &
|
||||||
- ./tools/build.py -j2
|
- ./tools/build.py -j2
|
||||||
|
- RUSTC_WRAPPER=sccache cargo check -j2 --release
|
||||||
- ./tools/test.py $DENO_BUILD_PATH
|
- ./tools/test.py $DENO_BUILD_PATH
|
||||||
after_script:
|
after_script:
|
||||||
- ccache --show-stats
|
- ccache --show-stats
|
||||||
|
|
15
BUILD.gn
15
BUILD.gn
|
@ -124,9 +124,7 @@ rust_executable("deno") {
|
||||||
source_root = "src/main.rs"
|
source_root = "src/main.rs"
|
||||||
extern = main_extern
|
extern = main_extern
|
||||||
deps = [
|
deps = [
|
||||||
":libdeno",
|
":deno_deps",
|
||||||
":msg_rs",
|
|
||||||
":snapshot",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +207,6 @@ v8_executable("test_cc") {
|
||||||
# Because snapshots are slow, it's important that snapshot_creator's
|
# Because snapshots are slow, it's important that snapshot_creator's
|
||||||
# dependencies are minimal.
|
# dependencies are minimal.
|
||||||
static_library("libdeno") {
|
static_library("libdeno") {
|
||||||
complete_static_lib = true
|
|
||||||
sources = [
|
sources = [
|
||||||
"libdeno/api.cc",
|
"libdeno/api.cc",
|
||||||
"libdeno/binding.cc",
|
"libdeno/binding.cc",
|
||||||
|
@ -224,6 +221,16 @@ static_library("libdeno") {
|
||||||
configs += [ ":deno_config" ]
|
configs += [ ":deno_config" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static_library("deno_deps") {
|
||||||
|
complete_static_lib = true
|
||||||
|
public_deps = [
|
||||||
|
":libdeno",
|
||||||
|
":msg_rs",
|
||||||
|
":snapshot",
|
||||||
|
]
|
||||||
|
configs += [ ":deno_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
executable("snapshot_creator") {
|
executable("snapshot_creator") {
|
||||||
sources = [
|
sources = [
|
||||||
"libdeno/snapshot_creator.cc",
|
"libdeno/snapshot_creator.cc",
|
||||||
|
|
|
@ -13,15 +13,21 @@ atty = "0.2.11"
|
||||||
dirs = "1.0.4"
|
dirs = "1.0.4"
|
||||||
flatbuffers = { path = "third_party/flatbuffers/rust/flatbuffers/" }
|
flatbuffers = { path = "third_party/flatbuffers/rust/flatbuffers/" }
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
|
getopts = "0.2.18"
|
||||||
hyper = "0.12.12"
|
hyper = "0.12.12"
|
||||||
# The current version of hyper-rustls, 0.14.0, depends on tokio-core, which is
|
# The current version of hyper-rustls, 0.14.0, depends on tokio-core, which is
|
||||||
# deprecated.
|
# deprecated.
|
||||||
hyper-rustls = { git = "https://github.com/ctz/hyper-rustls.git" }
|
hyper-rustls = { git = "https://github.com/ctz/hyper-rustls.git" }
|
||||||
|
lazy_static = "1.1.0"
|
||||||
libc = "0.2.43"
|
libc = "0.2.43"
|
||||||
log = "0.4.5"
|
log = "0.4.5"
|
||||||
rand = "0.4.3"
|
rand = "0.4.3"
|
||||||
|
remove_dir_all = "0.5.1"
|
||||||
ring = "0.13.2"
|
ring = "0.13.2"
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
tokio = "0.1.11"
|
tokio = "0.1.11"
|
||||||
|
tokio-executor = "0.1.5"
|
||||||
|
tokio-fs = "0.1.3"
|
||||||
|
tokio-io = "0.1.8"
|
||||||
|
tokio-threadpool = "0.1.6"
|
||||||
url = "1.7.1"
|
url = "1.7.1"
|
||||||
getopts = "0.2.18"
|
|
||||||
|
|
39
build.rs
Normal file
39
build.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
// Run "cargo build -vv" if you want to see gn output.
|
||||||
|
// TODO For the time being you must set an env var DENO_BUILD_PATH
|
||||||
|
// which might be `pwd`/out/debug or `pwd`/out/release.
|
||||||
|
// TODO Currently DENO_BUILD_PATH must be absolute.
|
||||||
|
// TODO Combine DENO_BUILD_PATH and OUT_DIR.
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mode = env::var("PROFILE").unwrap();
|
||||||
|
let deno_build_path = env::var("DENO_BUILD_PATH").unwrap();
|
||||||
|
|
||||||
|
let status = Command::new("python")
|
||||||
|
.env("DENO_BUILD_PATH", &deno_build_path)
|
||||||
|
.env("DENO_BUILD_MODE", &mode)
|
||||||
|
.arg("./tools/setup.py")
|
||||||
|
.status()
|
||||||
|
.expect("setup.py failed");
|
||||||
|
assert!(status.success());
|
||||||
|
|
||||||
|
// These configurations must be outputted after tools/setup.py is run.
|
||||||
|
println!("cargo:rustc-link-search=native={}/obj", deno_build_path);
|
||||||
|
println!("cargo:rustc-link-lib=static=deno_deps");
|
||||||
|
// TODO Remove this and only use OUT_DIR at some point.
|
||||||
|
println!("cargo:rustc-env=DENO_BUILD_PATH={}", deno_build_path);
|
||||||
|
|
||||||
|
let status = Command::new("python")
|
||||||
|
.env("DENO_BUILD_PATH", &deno_build_path)
|
||||||
|
.env("DENO_BUILD_MODE", &mode)
|
||||||
|
.arg("./tools/build.py")
|
||||||
|
.arg("deno_deps")
|
||||||
|
.arg("-v")
|
||||||
|
.status()
|
||||||
|
.expect("build.py failed");
|
||||||
|
assert!(status.success());
|
||||||
|
}
|
|
@ -5,6 +5,9 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ["OUT_DIR"] = os.path.abspath(".")
|
# TODO This is for src/msg.rs to know where to find msg_generated.rs
|
||||||
assert os.path.isdir(os.environ["OUT_DIR"])
|
# In the future we should use OUT_DIR here.
|
||||||
|
os.environ["DENO_BUILD_PATH"] = os.path.abspath(".")
|
||||||
|
assert os.path.isdir(os.environ["DENO_BUILD_PATH"])
|
||||||
|
|
||||||
sys.exit(subprocess.call(sys.argv[1:], env=os.environ))
|
sys.exit(subprocess.call(sys.argv[1:], env=os.environ))
|
||||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -23,21 +23,21 @@ extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
|
|
||||||
mod deno_dir;
|
pub mod deno_dir;
|
||||||
mod errors;
|
pub mod errors;
|
||||||
mod flags;
|
pub mod flags;
|
||||||
mod fs;
|
mod fs;
|
||||||
mod http_util;
|
mod http_util;
|
||||||
mod isolate;
|
pub mod isolate;
|
||||||
mod libdeno;
|
pub mod libdeno;
|
||||||
mod msg;
|
pub mod msg;
|
||||||
pub mod ops;
|
pub mod ops;
|
||||||
mod permissions;
|
pub mod permissions;
|
||||||
mod resources;
|
pub mod resources;
|
||||||
mod snapshot;
|
pub mod snapshot;
|
||||||
mod tokio_util;
|
mod tokio_util;
|
||||||
mod tokio_write;
|
mod tokio_write;
|
||||||
mod version;
|
pub mod version;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
mod eager_unix;
|
mod eager_unix;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
use flatbuffers;
|
use flatbuffers;
|
||||||
include!(concat!(env!("OUT_DIR"), "/gen/msg_generated.rs"));
|
// TODO Replace DENO_BUILD_PATH with OUT_DIR. gn/ninja should generate into
|
||||||
|
// the same output directory as cargo uses.
|
||||||
|
include!(concat!(env!("DENO_BUILD_PATH"), "/gen/msg_generated.rs"));
|
||||||
|
|
|
@ -45,5 +45,5 @@ qrun(["node", prettier, "--write", "--loglevel=error"] + ["rollup.config.js"] +
|
||||||
print "rustfmt"
|
print "rustfmt"
|
||||||
qrun([
|
qrun([
|
||||||
"third_party/rustfmt/" + platform() +
|
"third_party/rustfmt/" + platform() +
|
||||||
"/rustfmt", "--config-path", rustfmt_config
|
"/rustfmt", "--config-path", rustfmt_config, "build.rs"
|
||||||
] + find_exts(["src"], [".rs"]))
|
] + find_exts(["src"], [".rs"]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue