From 9f8d2a98b85831c9ea5e90bbfdaf0492fed7c639 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:50:46 -0800 Subject: [PATCH 01/10] chore: promote dfx 0.24.3 (#4024) * chore: update Motoko version to 0.13.4 (#4022) --------- Signed-off-by: Eric Swanson Co-authored-by: DFINITY bot <58022693+dfinity-bot@users.noreply.github.com> From 95a40d350bc965d79fd925dba64ff4b58dc30bd9 Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Thu, 30 Jan 2025 14:57:08 -0500 Subject: [PATCH 02/10] add a devcontainer --- .devcontainer/Dockerfile | 11 +++++++++++ .devcontainer/devcontainer.json | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..678fd7e38f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +FROM debian:12 + +RUN \ + apt update && apt install -y \ + build-essential \ + cmake \ + curl \ + git + +RUN \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..bf4387a65b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +{ + "name": "sdk", + "build": { + "dockerfile": "Dockerfile" + }, + "mounts": [ + { + "source": "${localEnv:HOME}/.cache", + "target": "/root/.cache", + "type": "bind" + } + ], + "customizations": { + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml", + "vadimcn.vscode-lldb", + "EditorConfig.EditorConfig" + ], + "settings": { + "editor.formatOnSave": true, + "rust-analyzer.checkOnSave.command": "clippy" + } + } + } +} From d299828ef4680a0444fb210ad5a267c28d2dd058 Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Thu, 30 Jan 2025 14:57:29 -0500 Subject: [PATCH 03/10] dont fail when building in docker on mac --- src/dfx/assets/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dfx/assets/build.rs b/src/dfx/assets/build.rs index 242ac2a071..c697387b14 100644 --- a/src/dfx/assets/build.rs +++ b/src/dfx/assets/build.rs @@ -99,6 +99,7 @@ fn find_assets(sources: Sources) -> PathBuf { &*env::var("CARGO_CFG_TARGET_OS").unwrap(), ) { ("x86_64" | "aarch64", "macos") => sources.x86_64_darwin, // rosetta + ("aarch64", "linux") => sources.x86_64_linux, ("x86_64", "linux" | "windows") => sources.x86_64_linux, (arch, os) => panic!("Unsupported OS type {arch}-{os}"), }; From 6f188d0d978f0d4ba606a043fecc5ac015ceb56a Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Thu, 30 Jan 2025 14:58:14 -0500 Subject: [PATCH 04/10] add an editorconfig --- .devcontainer/Dockerfile | 5 ++++- .devcontainer/devcontainer.json | 1 + .editorconfig | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .editorconfig diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 678fd7e38f..b6fde22af0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,4 +8,7 @@ RUN \ git RUN \ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- \ + -y \ + --default-toolchain 1.78.0 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bf4387a65b..8568e07a64 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,6 @@ { "name": "sdk", + "privileged": true, "build": { "dockerfile": "Dockerfile" }, diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..26479964b2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.rs] +indent_size = 4 +max_line_length = 100 From 42ead2f9634f70ddb1bfe7709cb4134a22887542 Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Fri, 31 Jan 2025 17:49:46 +0000 Subject: [PATCH 05/10] add mold and sccache --- .cargo/config.toml | 3 +++ .devcontainer/Dockerfile | 18 +++++++++++++++--- .devcontainer/devcontainer.json | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..d29d6c330c --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b6fde22af0..760740c52f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,12 +3,24 @@ FROM debian:12 RUN \ apt update && apt install -y \ build-essential \ + clang \ cmake \ curl \ - git + git \ + libssl-dev \ + mold \ + pkg-config RUN \ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ - | sh -s -- \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ -y \ --default-toolchain 1.78.0 + +RUN \ + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | sh + +RUN \ + $HOME/.cargo/bin/cargo \ + binstall --locked sccache + +ENV RUSTC_WRAPPER=sccache diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8568e07a64..842e3e7232 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,7 +21,7 @@ ], "settings": { "editor.formatOnSave": true, - "rust-analyzer.checkOnSave.command": "clippy" + "rust-analyzer.check.command": "clippy" } } } From 35c2c2f1132d90bd91107fa4ca76b6480395ac6d Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Fri, 31 Jan 2025 18:42:37 +0000 Subject: [PATCH 06/10] sccache needs incremental builds to be off --- .devcontainer/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 760740c52f..f9a08c7d1a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -23,4 +23,8 @@ RUN \ $HOME/.cargo/bin/cargo \ binstall --locked sccache +ENV SCCACHE_DIRECT=true +ENV SCCACHE_LOG=info + ENV RUSTC_WRAPPER=sccache +ENV CARGO_INCREMENTAL=false From a6f7f9e6736584116be8eb9ae73a816b44331902 Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Mon, 3 Feb 2025 14:53:14 +0000 Subject: [PATCH 07/10] remove sccache --- .cargo/config.toml | 3 --- .devcontainer/Dockerfile | 16 +++++----------- Cargo.toml | 4 ++++ 3 files changed, 9 insertions(+), 14 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index d29d6c330c..0000000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -linker = "clang" -rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f9a08c7d1a..a0efe0cee0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,6 +3,7 @@ FROM debian:12 RUN \ apt update && apt install -y \ build-essential \ + ccache \ clang \ cmake \ curl \ @@ -16,15 +17,8 @@ RUN \ -y \ --default-toolchain 1.78.0 -RUN \ - curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | sh - -RUN \ - $HOME/.cargo/bin/cargo \ - binstall --locked sccache - -ENV SCCACHE_DIRECT=true -ENV SCCACHE_LOG=info +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang +ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold" -ENV RUSTC_WRAPPER=sccache -ENV CARGO_INCREMENTAL=false +ENV CC="ccache clang" +ENV CXX="ccache clang++" diff --git a/Cargo.toml b/Cargo.toml index 97044c6b8b..b137e527cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,5 +89,9 @@ lto = true [profile.dev.package.argon2] opt-level = 3 +# [profile.dev.package.wasm-opt-sys] +# opt-level = 0 +# debug = false + [profile.release.package.ic-frontend-canister] opt-level = 'z' From de9980b2089e4fbd8b3b6b131546852e25cc50f1 Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Mon, 3 Feb 2025 21:29:13 +0000 Subject: [PATCH 08/10] update dockerfile rust toolchain --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a0efe0cee0..18cef86ba5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,7 +15,7 @@ RUN \ RUN \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ -y \ - --default-toolchain 1.78.0 + --default-toolchain 1.81.0 ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold" From 2135a85d43deaa7833f1dee2f02c49ae74441a0d Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Thu, 6 Feb 2025 17:13:19 +0000 Subject: [PATCH 09/10] remove comment --- Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b137e527cd..97044c6b8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,9 +89,5 @@ lto = true [profile.dev.package.argon2] opt-level = 3 -# [profile.dev.package.wasm-opt-sys] -# opt-level = 0 -# debug = false - [profile.release.package.ic-frontend-canister] opt-level = 'z' From 021ffcffc46eda8aa0567287c465598d6ee1d52c Mon Sep 17 00:00:00 2001 From: Or Ricon Date: Thu, 6 Feb 2025 17:20:31 +0000 Subject: [PATCH 10/10] update the changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 991dbad559..e3b5c8a6da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ ### feat: streamlined output during asset synchronization +### feat: add devcontainer + ## Dependencies ### Motoko