Merge remote-tracking branch 'origin' into deps

This commit is contained in:
Brendan Hansknecht 2021-11-06 13:10:33 -07:00
commit 4a4a07441e
8 changed files with 41 additions and 15 deletions

View File

@ -82,8 +82,6 @@ There are also alternative installation options at http://releases.llvm.org/down
## Using Nix
:exclamation: **Our Nix setup is not yet working on MacOS, you'll have to install manually for now** :exclamation:
### Install
Using [nix](https://nixos.org/download.html) is a quick way to get an environment bootstrapped with a single command.
@ -124,6 +122,7 @@ If you plan on using `nix-shell` regularly, check out [direnv](https://direnv.ne
### Editor
The editor is a WIP and not ready yet to replace your favorite editor, although if you want to try it out on nix, read on.
`cargo run edit` should work from NixOS, if you use a nix-shell from inside another OS, follow the instructions below.
#### Nvidia GPU

View File

@ -79,11 +79,11 @@ test-rust:
# not pre-compiling the host can cause race conditions
RUN echo "4" | cargo run --release examples/benchmarks/NQueens.roc
RUN --mount=type=cache,target=$SCCACHE_DIR \
cargo test --release && sccache --show-stats
cargo test --release --features with_sound && sccache --show-stats
# run i386 (32-bit linux) cli tests
RUN echo "4" | cargo run --release --features="target-x86" -- --backend=x86_32 examples/benchmarks/NQueens.roc
RUN --mount=type=cache,target=$SCCACHE_DIR \
cargo test --release --test cli_run i386 --features="i386-cli-run" && sccache --show-stats
cargo test --release --features with_sound --test cli_run i386 --features="i386-cli-run" && sccache --show-stats
verify-no-git-changes:
FROM +test-rust
@ -109,7 +109,7 @@ build-nightly-release:
# version.txt is used by the CLI: roc --version
RUN printf "nightly pre-release, built from commit " > version.txt
RUN git log --pretty=format:'%h' -n 1 >> version.txt
RUN cargo build --release
RUN cargo build --features with_sound --release
RUN cd ./target/release && tar -czvf roc_linux_x86_64.tar.gz ./roc
SAVE ARTIFACT ./target/release/roc_linux_x86_64.tar.gz AS LOCAL roc_linux_x86_64.tar.gz

View File

@ -811,7 +811,7 @@ fn link_macos(
"-arch",
&arch,
"-macos_version_min",
"10.15",
&get_macos_version(),
])
.args(input_paths);
@ -852,6 +852,23 @@ fn link_macos(
}
}
fn get_macos_version() -> String {
let cmd_stdout = Command::new("sw_vers")
.arg("-productVersion")
.output()
.expect("Failed to execute command 'sw_vers -productVersion'")
.stdout;
let full_version_string = String::from_utf8(cmd_stdout)
.expect("Failed to convert output of command 'sw_vers -productVersion' into a utf8 string");
full_version_string
.split('.')
.take(2)
.collect::<Vec<&str>>()
.join(".")
}
fn link_wasm32(
_target: &Triple,
output_path: PathBuf,

View File

@ -12,6 +12,10 @@ normal = ["confy"]
#development = []
#build = []
[features]
default = []
with_sound = ["rodio"]
[dependencies]
roc_ast = { path = "../ast" }
roc_collections = { path = "../compiler/collections" }
@ -54,7 +58,7 @@ confy = { git = 'https://github.com/rust-cli/confy', features = [
serde = { version = "1.0.123", features = ["derive"] }
nonempty = "0.7"
fs_extra = "1.2.0"
rodio = "0.14.0"
rodio = { version = "0.14.0", optional = true } # to play sounds
threadpool = "1.8.1"
[dependencies.bytemuck]

View File

@ -8,6 +8,7 @@ mod mvc;
mod render_ast;
mod render_debug;
mod resources;
#[cfg(feature = "with_sound")]
mod sound;
mod theme;
mod util;

View File

@ -22,6 +22,7 @@ use crate::editor::mvc::string_update::start_new_string;
use crate::editor::mvc::string_update::update_small_string;
use crate::editor::mvc::string_update::update_string;
use crate::editor::mvc::tld_value_update::{start_new_tld_value, update_tld_val_name};
#[cfg(feature = "with_sound")]
use crate::editor::sound::play_sound;
use crate::ui::text::caret_w_select::CaretWSelect;
use crate::ui::text::lines::MoveCaretFun;
@ -521,7 +522,7 @@ impl<'a> EdModel<'a> {
&mut self,
modifiers: &Modifiers,
virtual_keycode: VirtualKeyCode,
sound_thread_pool: &mut ThreadPool,
_sound_thread_pool: &mut ThreadPool,
) -> EdResult<()> {
match virtual_keycode {
Left => self.move_caret_left(modifiers)?,
@ -560,7 +561,8 @@ impl<'a> EdModel<'a> {
self.dirty = true;
}
F12 => {
sound_thread_pool.execute(move || {
#[cfg(feature = "with_sound")]
_sound_thread_pool.execute(move || {
play_sound("./editor/src/editor/resources/sounds/bell_sound.mp3");
});
}

View File

@ -1,14 +1,14 @@
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"description": "Niv fork using unstable nix packages.",
"homepage": "https://github.com/Anton-4/niv",
"owner": "Anton-4",
"repo": "niv",
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
"rev": "f292d8d149a0e5d1e7fdd0ef68d5dde75814ef7e",
"sha256": "0lf52chvqfl5jq09sc2k9vg8faqnd27f3ic5cgzp68jk036bax7r",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
"url": "https://github.com/Anton-4/niv/archive/f292d8d149a0e5d1e7fdd0ef68d5dde75814ef7e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {

View File

@ -65,6 +65,9 @@ let
# note: niv manages its own nixpkgs so it doesn't need pkgs.callPackage. Do
# `cachix use niv` to get cached builds!
(import sources.niv { }).niv
# tools for development environment
less
];
in pkgs.mkShell {
buildInputs = inputs ++ darwinInputs ++ linuxInputs;