Skip to content

Commit

Permalink
Move //libdeno to //core/libdeno (denoland#2015)
Browse files Browse the repository at this point in the history
Fixes some sed errors introduced in c43cfe.

Unfortunately moving libdeno required splitting build.rs into two parts,
one for cli and one for core.

I've also removed the arm64 build - it's complicating things at this
re-org and we're not even testing it. I need to swing back to it and get
tools/test.py running for it.
  • Loading branch information
ry committed Mar 30, 2019
1 parent ad3cbc5 commit c9614d8
Show file tree
Hide file tree
Showing 74 changed files with 603 additions and 601 deletions.
6 changes: 3 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ after_test:
}
# Verify that javascript and typescript files which are bundled by rollup are
# listed explicitly in BUILD.gn. This is not an air-tight check.
# listed explicitly in cli\BUILD.gn. This is not an air-tight check.
# TODO: make rollup or another bundler write a depfile.
- ps: |-
$ignore = "test_util.ts", "unit_tests.ts", "*_test.ts"
Get-ChildItem "js" -File -Force -Name |
where { $name = $_; -not ($ignore | where { $name -like $_ }) } |
where { -not (Select-String -Pattern $_ -Path BUILD.gn `
where { -not (Select-String -Pattern $_ -Path cli\BUILD.gn `
-SimpleMatch -CaseSensitive) } |
foreach { throw "$_ should be listed in BUILD.gn but isn't." }
foreach { throw "$_ should be listed in cli\BUILD.gn but isn't." }
# Verify that generated ninja files do not use absolute path names.
# If they do, it makes ccache/sccache much less effective.
Expand Down
24 changes: 0 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,6 @@ jobs:
branch: master
repo: denoland/deno
skip-cleanup: true

- name: "cargo release linux arm64"
os: linux
dist: xenial
script:
- ./tools/lint.py
- ./tools/test_format.py
- rustup target add aarch64-unknown-linux-gnu
- sudo apt update
- |-
sudo apt -yq --no-install-suggests --no-install-recommends install \
g++-5-aarch64-linux-gnu gcc-5-aarch64-linux-gnu g++-5-multilib \
libc6-arm64-cross
- build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
- export DENO_BUILD_ARGS="target_cpu=\"arm64\" v8_target_cpu=\"arm64\""
- export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="/usr/bin/aarch64-linux-gnu-gcc-5"
- export CC_aarch64_unknown_linux_gnu="/usr/bin/aarch64-linux-gnu-gcc-5"
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --locked
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --tests --locked
- sudo apt -yq install qemu qemu-user binfmt-support qemu-user-binfmt
- sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
- export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
#- $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/deno tests/002_hello.ts
# - DENO_BUILD_MODE=release ./tools/test.py $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release TODO(afinch7): Get the tests working

- name: "cargo release linux x86_64"
os: linux
Expand Down
277 changes: 3 additions & 274 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,184 +1,13 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import("//build/toolchain/cc_wrapper.gni")
import("//build_extra/flatbuffers/flatbuffer.gni")
import("//build_extra/flatbuffers/rust/rust_flatbuffer.gni")
import("//build_extra/rust/rust.gni")
import("//third_party/v8/gni/v8.gni")
import("//third_party/v8/snapshot_toolchain.gni")
import("libdeno/deno.gni")

group("default") {
testonly = true
deps = [
":deno",
":hyper_hello",
":test_rs",
"cli:deno",
"cli:test_rs",
"core:default",
"libdeno:test_cc",
]
}

main_extern = [
"core:deno_core",

"$rust_build:ansi_term",
"$rust_build:atty",
"$rust_build:dirs",
"$rust_build:flatbuffers",
"$rust_build:futures",
"$rust_build:getopts",
"$rust_build:http",
"$rust_build:hyper",
"$rust_build:hyper_rustls",
"$rust_build:lazy_static",
"$rust_build:libc",
"$rust_build:log",
"$rust_build:rand",
"$rust_build:regex",
"$rust_build:remove_dir_all",
"$rust_build:ring",
"$rust_build:rustyline",
"$rust_build:serde_json",
"$rust_build:source_map_mappings",
"$rust_build:tempfile",
"$rust_build:tokio",
"$rust_build:tokio_executor",
"$rust_build:tokio_fs",
"$rust_build:tokio_io",
"$rust_build:tokio_process",
"$rust_build:tokio_threadpool",
"$rust_build:url",
]
if (is_win) {
main_extern += [ "$rust_build:winapi" ]
}

ts_sources = [
"js/assets.ts",
"js/blob.ts",
"js/buffer.ts",
"js/build.ts",
"js/chmod.ts",
"js/console_table.ts",
"js/compiler.ts",
"js/console.ts",
"js/copy_file.ts",
"js/core.ts",
"js/custom_event.ts",
"js/deno.ts",
"js/dir.ts",
"js/dispatch.ts",
"js/dom_types.ts",
"js/errors.ts",
"js/event.ts",
"js/event_target.ts",
"js/fetch.ts",
"js/format_error.ts",
"js/dom_file.ts",
"js/file_info.ts",
"js/files.ts",
"js/flatbuffers.ts",
"js/form_data.ts",
"js/globals.ts",
"js/headers.ts",
"js/io.ts",
"js/lib.web_assembly.d.ts",
"js/location.ts",
"js/main.ts",
"js/make_temp_dir.ts",
"js/metrics.ts",
"js/mkdir.ts",
"js/mock_builtin.js",
"js/net.ts",
"js/os.ts",
"js/permissions.ts",
"js/plugins.d.ts",
"js/process.ts",
"js/read_dir.ts",
"js/read_file.ts",
"js/read_link.ts",
"js/remove.ts",
"js/rename.ts",
"js/repl.ts",
"js/resources.ts",
"js/stat.ts",
"js/symlink.ts",
"js/text_encoding.ts",
"js/timers.ts",
"js/truncate.ts",
"js/types.ts",
"js/url.ts",
"js/url_search_params.ts",
"js/util.ts",
"js/window.ts",
"js/workers.ts",
"js/write_file.ts",
"js/performance.ts",
"js/version.ts",
"tsconfig.json",

# Listing package.json and yarn.lock as sources ensures the bundle is rebuilt
# when npm packages are added/removed or their contents changes.
"package.json",
"third_party/yarn.lock",
]

# When Cargo is driving the build, GN/Ninja are used to produce these non-Rust
# targets. Cargo handles all Rust source files and the final linking step.
group("deno_deps") {
deps = [
":msg_rs",
":snapshot_compiler",
":snapshot_deno",
"libdeno:libdeno_static_lib",
]
}

# Optimized dependencies for cross compiled builds.
# This can be removed once we get snapshots into cross compiled builds.
group("deno_deps_cross") {
testonly = true
deps = [
":compiler_bundle",
":main_bundle",
":msg_rs",
"libdeno:libdeno_static_lib",
"libdeno:test_cc",
]
}

# Reads the cargo info from Cargo.toml
deno_cargo_info = exec_script("build_extra/rust/get_cargo_info.py",
[ rebase_path("Cargo.toml", root_build_dir) ],
"json")

rust_executable("deno") {
source_root = "cli/main.rs"
extern = main_extern
deps = [
":deno_deps",
]

# Extract version from Cargo.toml
# TODO integrate this into rust.gni by allowing the rust_executable template
# to specify a cargo.toml from which it will extract a version.
crate_version = deno_cargo_info.version
inputs = [
"Cargo.toml",
]
}

rust_test("test_rs") {
source_root = "cli/main.rs"
extern = main_extern
deps = [
":deno_deps",
]

# Extract version from Cargo.toml
crate_version = deno_cargo_info.version
inputs = [
"Cargo.toml",
"core/libdeno:test_cc",
]
}

Expand All @@ -189,103 +18,3 @@ rust_executable("hyper_hello") {
"$rust_build:ring",
]
}

# Generates the core TypeScript type library for deno that will be
# included in the runtime bundle
run_node("deno_runtime_declaration") {
out_dir = target_gen_dir
sources = ts_sources
outputs = [
"$out_dir/lib/lib.deno_runtime.d.ts",
]
deps = [
":msg_ts",
]
inputs = ts_sources + [
"tools/ts_library_builder/tsconfig.json",
"tools/ts_library_builder/main.ts",
"tools/ts_library_builder/build_library.ts",
"tools/ts_library_builder/ast_util.ts",
]
args = [
rebase_path("node_modules/ts-node/dist/bin.js", root_build_dir),
"--project",
rebase_path("tools/ts_library_builder/tsconfig.json"),
"--skip-ignore",
rebase_path("tools/ts_library_builder/main.ts", root_build_dir),
"--basePath",
rebase_path(".", root_build_dir),
"--inline",
rebase_path("js/lib.web_assembly.d.ts", root_build_dir),
"--buildPath",
rebase_path(root_build_dir, root_build_dir),
"--outFile",
rebase_path(outputs[0], root_build_dir),
"--silent",
]
if (is_debug) {
args += [ "--debug" ]
}
}

bundle("main_bundle") {
out_dir = "$target_gen_dir/bundle/"
out_name = "main"
deps = [
":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

bundle("compiler_bundle") {
out_dir = "$target_gen_dir/bundle/"
out_name = "compiler"
deps = [
":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

ts_flatbuffer("msg_ts") {
sources = [
"cli/msg.fbs",
]
}

rust_flatbuffer("msg_rs") {
sources = [
"cli/msg.fbs",
]
}

# Generates $target_gen_dir/snapshot_deno.bin
snapshot("snapshot_deno") {
source_root = "$target_gen_dir/bundle/main.js"
deps = [
":main_bundle",
]
}

# Generates $target_gen_dir/snapshot_compiler.bin
snapshot("snapshot_compiler") {
source_root = "$target_gen_dir/bundle/compiler.js"
deps = [
":compiler_bundle",
]
}

action("write_gn_args") {
script = "//tools/write_gn_args.py"
outputs = [
"$target_gen_dir/gn_args.txt",
]
args = [ rebase_path(outputs[0], root_build_dir) ]
}
53 changes: 1 addition & 52 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,56 +1,5 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# Dummy package info required by `cargo fetch`.
# Use tools/sync_third_party.py to install deps after editing this file.
# Deno does not build with cargo. Deno uses a build system called gn.
# See build_extra/rust/BUILD.gn for the manually built configuration of rust
# crates.

[workspace]
members = [
"./",
"cli",
"core",
]

[[bin]]
name = "deno"
path = "cli/main.rs"

[package]
name = "deno"
version = "0.3.5"
edition = "2018"

[dependencies]
deno_core = { path = "./core" }

ansi_term = "0.11.0"
atty = "0.2.11"
dirs = "1.0.5"
flatbuffers = "0.5.0"
futures = "0.1.25"
getopts = "0.2.18"
http = "0.1.16"
hyper = "0.12.25"
hyper-rustls = "0.16.1"
integer-atomics = "1.0.2"
lazy_static = "1.3.0"
libc = "0.2.51"
log = "0.4.6"
rand = "0.6.5"
regex = "1.1.2"
remove_dir_all = "0.5.1"
ring = "0.14.6"
rustyline = "3.0.0"
serde_json = "1.0.39"
source-map-mappings = "0.5.0"
tempfile = "3.0.7"
tokio = "0.1.18"
tokio-executor = "0.1.7"
tokio-fs = "0.1.6"
tokio-io = "0.1.12"
tokio-process = "0.2.3"
tokio-threadpool = "0.1.13"
url = "1.7.2"

[target.'cfg(windows)'.dependencies]
winapi = "0.3.6"
Loading

0 comments on commit c9614d8

Please sign in to comment.