Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,908 changes: 701 additions & 1,207 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ members = [
"compiler/gen_wasm",
"compiler/build",
"compiler/arena_pool",
"compiler/test_dev",
"compiler/test_gen",
"compiler/test_wasm",
"vendor/ena",
Expand Down
11 changes: 5 additions & 6 deletions ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify"}
roc_load = { path = "../compiler/load" }
arraystring = "0.3.0"
bumpalo = { version = "3.6.1", features = ["collections"] }
libc = "0.2"
page_size = "0.4"
snafu = { version = "0.6", features = ["backtraces"] }
bumpalo = { version = "3.8.0", features = ["collections"] }
libc = "0.2.106"
page_size = "0.4.2"
snafu = { version = "0.6.10", features = ["backtraces"] }
ven_graph = { path = "../vendor/pathfinding" }

[dev-dependencies]
pretty_assertions = "0.6"
indoc = "1.0"
indoc = "1.0.3"
33 changes: 17 additions & 16 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ bench = false
[features]
default = ["target-aarch64", "target-x86_64", "target-wasm32", "llvm", "editor"]

wasm32-cli-run = ["target-wasm32"]
wasm32-cli-run = ["target-wasm32", "run-wasm32"]
i386-cli-run = ["target-x86"]

# This is a separate feature because when we generate docs on Netlify,
# it doesn't have LLVM installed. (Also, it doesn't need to do code gen.)
llvm = ["inkwell", "roc_gen_llvm", "roc_build/llvm"]
editor = ["roc_editor"]

run-wasm32 = ["wasmer", "wasmer-wasi"]

# Compiling for a different platform than the host can cause linker errors.
target-arm = ["roc_build/target-arm"]
Expand Down Expand Up @@ -63,30 +64,30 @@ roc_fmt = { path = "../compiler/fmt" }
roc_reporting = { path = "../compiler/reporting" }
roc_editor = { path = "../editor", optional = true }
roc_linker = { path = "../linker" }
clap = "= 3.0.0-beta.1"
const_format = "0.2"
clap = { version = "= 3.0.0-beta.5", default-features = false, features = ["std", "color", "suggestions"] }
const_format = "0.2.22"
rustyline = { git = "https://github.com/rtfeldman/rustyline", tag = "prompt-fix" }
rustyline-derive = { git = "https://github.com/rtfeldman/rustyline", tag = "prompt-fix" }
im = "14" # im and im-rc should always have the same version!
im-rc = "14" # im and im-rc should always have the same version!
bumpalo = { version = "3.2", features = ["collections"] }
libloading = "0.6"
im = "15.0.0"
im-rc = "15.0.0"
bumpalo = { version = "3.8.0", features = ["collections"] }
libloading = "0.7.1"
mimalloc = { version = "0.1.26", default-features = false }

inkwell = { path = "../vendor/inkwell", optional = true }
target-lexicon = "0.12.2"
tempfile = "3.1.0"
tempfile = "3.2.0"

wasmer = "2.0.0"
wasmer-wasi = "2.0.0"
wasmer = { version = "2.0.0", optional = true, default-features = false, features = ["default-cranelift", "default-universal"] }
wasmer-wasi = { version = "2.0.0", optional = true }

[dev-dependencies]
pretty_assertions = "0.5.1"
indoc = "0.3.3"
quickcheck = "0.8"
quickcheck_macros = "0.8"
serial_test = "0.5"
tempfile = "3.1.0"
wasmer = { version = "2.0.0", default-features = false, features = ["default-cranelift", "default-universal"] }
wasmer-wasi = "2.0.0"
pretty_assertions = "1.0.0"
indoc = "1.0.3"
serial_test = "0.5.1"
tempfile = "3.2.0"
criterion = { git = "https://github.com/Anton-4/criterion.rs"}
cli_utils = { path = "cli_utils" }

Expand Down
10 changes: 5 additions & 5 deletions cli/cli_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ roc_cli = { path = "../../cli" }
roc_collections = { path = "../../compiler/collections" }
roc_load = { path = "../../compiler/load" }
roc_module = { path = "../../compiler/module" }
bumpalo = { version = "3.6.1", features = ["collections"] }
bumpalo = { version = "3.8.0", features = ["collections"] }
criterion = { git = "https://github.com/Anton-4/criterion.rs"}
serde = { version = "1.0", features = ["derive"] }
serde-xml-rs = "0.4"
strip-ansi-escapes = "0.1"
tempfile = "3.1.0"
serde = { version = "1.0.130", features = ["derive"] }
serde-xml-rs = "0.5.1"
strip-ansi-escapes = "0.1.1"
tempfile = "3.2.0"
rlimit = "0.6.2"
56 changes: 31 additions & 25 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ pub fn build_app<'a>() -> App<'a> {
.subcommand(App::new(CMD_BUILD)
.about("Build a binary from the given .roc file, but don't run it")
.arg(
Arg::with_name(ROC_FILE)
Arg::new(ROC_FILE)
.about("The .roc file to build")
.required(true),
)
.arg(
Arg::with_name(FLAG_OPTIMIZE)
Arg::new(FLAG_OPTIMIZE)
.long(FLAG_OPTIMIZE)
.about("Optimize your compiled Roc program to run faster. (Optimization takes time to complete.)")
.required(false),
)
.arg(
Arg::with_name(FLAG_DEV)
Arg::new(FLAG_DEV)
.long(FLAG_DEV)
.about("Make compilation as fast as possible. (Runtime performance may suffer)")
.required(false),
)
.arg(
Arg::with_name(FLAG_BACKEND)
Arg::new(FLAG_BACKEND)
.long(FLAG_BACKEND)
.about("Choose a different backend")
// .requires(BACKEND)
Expand All @@ -70,31 +70,31 @@ pub fn build_app<'a>() -> App<'a> {
.required(false),
)
.arg(
Arg::with_name(FLAG_LIB)
Arg::new(FLAG_LIB)
.long(FLAG_LIB)
.about("Build a C library instead of an executable.")
.required(false),
)
.arg(
Arg::with_name(FLAG_DEBUG)
Arg::new(FLAG_DEBUG)
.long(FLAG_DEBUG)
.about("Store LLVM debug information in the generated program")
.required(false),
)
.arg(
Arg::with_name(FLAG_TIME)
Arg::new(FLAG_TIME)
.long(FLAG_TIME)
.about("Prints detailed compilation time information.")
.required(false),
)
.arg(
Arg::with_name(FLAG_LINK)
Arg::new(FLAG_LINK)
.long(FLAG_LINK)
.about("Uses the roc linker instead of the system linker.")
.required(false),
)
.arg(
Arg::with_name(FLAG_PRECOMPILED)
Arg::new(FLAG_PRECOMPILED)
.long(FLAG_PRECOMPILED)
.about("Assumes the host has been precompiled and skips recompiling the host.")
.required(false),
Expand All @@ -106,69 +106,69 @@ pub fn build_app<'a>() -> App<'a> {
.subcommand(App::new(CMD_CHECK)
.about("Build a binary from the given .roc file, but don't run it")
.arg(
Arg::with_name(FLAG_TIME)
Arg::new(FLAG_TIME)
.long(FLAG_TIME)
.about("Prints detailed compilation time information.")
.required(false),
)
.arg(
Arg::with_name(ROC_FILE)
Arg::new(ROC_FILE)
.about("The .roc file of an app to run")
.required(true),
)
)
.subcommand(
App::new(CMD_DOCS)
.about("Generate documentation for Roc modules (Work In Progress)")
.arg(Arg::with_name(DIRECTORY_OR_FILES)
.arg(Arg::new(DIRECTORY_OR_FILES)
.index(1)
.multiple(true)
.multiple_values(true)
.required(false)
.about("The directory or files to build documentation for")

)
)
.setting(AppSettings::TrailingVarArg)
.arg(
Arg::with_name(FLAG_OPTIMIZE)
Arg::new(FLAG_OPTIMIZE)
.long(FLAG_OPTIMIZE)
.about("Optimize the compiled program to run faster. (Optimization takes time to complete.)")
.requires(ROC_FILE)
.required(false),
)
.arg(
Arg::with_name(FLAG_DEV)
Arg::new(FLAG_DEV)
.long(FLAG_DEV)
.about("Make compilation as fast as possible. (Runtime performance may suffer)")
.required(false),
)
.arg(
Arg::with_name(FLAG_DEBUG)
Arg::new(FLAG_DEBUG)
.long(FLAG_DEBUG)
.about("Store LLVM debug information in the generated program")
.requires(ROC_FILE)
.required(false),
)
.arg(
Arg::with_name(FLAG_TIME)
Arg::new(FLAG_TIME)
.long(FLAG_TIME)
.about("Prints detailed compilation time information.")
.required(false),
)
.arg(
Arg::with_name(FLAG_LINK)
Arg::new(FLAG_LINK)
.long(FLAG_LINK)
.about("Uses the roc linker instead of the system linker.")
.required(false),
)
.arg(
Arg::with_name(FLAG_PRECOMPILED)
Arg::new(FLAG_PRECOMPILED)
.long(FLAG_PRECOMPILED)
.about("Assumes the host has been precompiled and skips recompiling the host.")
.required(false),
)
.arg(
Arg::with_name(FLAG_BACKEND)
Arg::new(FLAG_BACKEND)
.long(FLAG_BACKEND)
.about("Choose a different backend")
// .requires(BACKEND)
Expand All @@ -177,23 +177,23 @@ pub fn build_app<'a>() -> App<'a> {
.required(false),
)
.arg(
Arg::with_name(ROC_FILE)
Arg::new(ROC_FILE)
.about("The .roc file of an app to build and run")
.required(false),
)
.arg(
Arg::with_name(ARGS_FOR_APP)
Arg::new(ARGS_FOR_APP)
.about("Arguments to pass into the app being run")
.requires(ROC_FILE)
.multiple(true),
.multiple_values(true),
);

if cfg!(feature = "editor") {
app.subcommand(
App::new(CMD_EDIT).about("Launch the Roc editor").arg(
Arg::with_name(DIRECTORY_OR_FILES)
Arg::new(DIRECTORY_OR_FILES)
.index(1)
.multiple(true)
.multiple_values(true)
.required(false)
.about("(optional) The directory or files to open on launch."),
),
Expand Down Expand Up @@ -411,6 +411,7 @@ fn roc_run(cmd: &mut Command) -> io::Result<i32> {
}
}

#[cfg(feature = "run-wasm32")]
fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
use wasmer::{Instance, Module, Store};

Expand Down Expand Up @@ -441,6 +442,11 @@ fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
}
}

#[cfg(not(feature = "run-wasm32"))]
fn run_with_wasmer(_wasm_path: &std::path::Path, _args: &[String]) {
println!("Running wasm files not support");
}

enum Backend {
Host,
X86_32,
Expand Down
10 changes: 4 additions & 6 deletions code_markup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ description = "Our own markup language for Roc code. Used by the editor and (soo
roc_ast = { path = "../ast" }
roc_module = { path = "../compiler/module" }
roc_utils = { path = "../utils" }
serde = { version = "1.0.123", features = ["derive"] }
palette = "0.5"
snafu = { version = "0.6", features = ["backtraces"] }
bumpalo = { version = "3.2", features = ["collections"] }
serde = { version = "1.0.130", features = ["derive"] }
palette = "0.6.0"
snafu = { version = "0.6.10", features = ["backtraces"] }
bumpalo = { version = "3.8.0", features = ["collections"] }
itertools = "0.10.1"

[dev-dependencies]
4 changes: 2 additions & 2 deletions code_markup/src/colors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use palette::{Hsv, LinSrgb};
use palette::{FromColor, Hsv, Srgb};

pub type RgbaTup = (f32, f32, f32, f32);
pub const WHITE: RgbaTup = (1.0, 1.0, 1.0, 1.0);
Expand All @@ -12,7 +12,7 @@ pub fn from_hsb(hue: usize, saturation: usize, brightness: usize) -> RgbaTup {
}

pub fn from_hsba(hue: usize, saturation: usize, brightness: usize, alpha: f32) -> RgbaTup {
let rgb = LinSrgb::from(Hsv::new(
let rgb = Srgb::from_color(Hsv::new(
hue as f32,
(saturation as f32) / 100.0,
(brightness as f32) / 100.0,
Expand Down
3 changes: 0 additions & 3 deletions compiler/arena_pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ license = "UPL-1.0"
repository = "https://github.com/rtfeldman/roc"
edition = "2018"
description = "A CLI for Roc"

[dev-dependencies]
pretty_assertions = "0.5.1"
20 changes: 8 additions & 12 deletions compiler/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,19 @@ roc_mono = { path = "../mono" }
roc_load = { path = "../load" }
roc_gen_llvm = { path = "../gen_llvm", optional = true }
roc_gen_wasm = { path = "../gen_wasm", optional = true }
roc_gen_dev = { path = "../gen_dev", default-features = false, optional = true }
roc_gen_dev = { path = "../gen_dev", default-features = false }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../../roc_std" }
im = "14" # im and im-rc should always have the same version!
im-rc = "14" # im and im-rc should always have the same version!
bumpalo = { version = "3.6.1", features = ["collections"] }
libloading = "0.6"
tempfile = "3.1.0"
serde_json = "1.0"
im = "15.0.0"
im-rc = "15.0.0"
bumpalo = { version = "3.8.0", features = ["collections"] }
libloading = "0.7.1"
tempfile = "3.2.0"
inkwell = { path = "../../vendor/inkwell", optional = true }
target-lexicon = "0.12.2"

[dev-dependencies]
pretty_assertions = "0.5.1"
indoc = "0.3.3"
quickcheck = "0.8"
quickcheck_macros = "0.8"
[target.'cfg(target_os = "macos")'.dependencies]
serde_json = "1.0.69"

[features]
default = ["llvm", "target-aarch64", "target-x86_64", "target-wasm32"]
Expand Down
2 changes: 1 addition & 1 deletion compiler/build/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ pub fn module_to_dylib(
// Load the dylib
let path = dylib_path.as_path().to_str().unwrap();

Library::new(path)
unsafe { Library::new(path) }
}

fn validate_output(file_name: &str, cmd_name: &str, output: Output) {
Expand Down
4 changes: 3 additions & 1 deletion compiler/build/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use roc_mono::ir::OptLevel;
use std::path::{Path, PathBuf};
use std::time::Duration;

use roc_collections::all::{MutMap, MutSet};
use roc_collections::all::MutMap;
#[cfg(feature = "target-wasm32")]
use roc_collections::all::MutSet;

#[derive(Debug, Clone, Copy, Default)]
pub struct CodeGenTiming {
Expand Down
5 changes: 0 additions & 5 deletions compiler/builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
[dev-dependencies]
pretty_assertions = "0.5.1"
indoc = "0.3.3"
quickcheck = "0.8"
quickcheck_macros = "0.8"
Loading