diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..18cef86ba5 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +FROM debian:12 + +RUN \ + apt update && apt install -y \ + build-essential \ + ccache \ + clang \ + cmake \ + curl \ + git \ + libssl-dev \ + mold \ + pkg-config + +RUN \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ + -y \ + --default-toolchain 1.81.0 + +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang +ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold" + +ENV CC="ccache clang" +ENV CXX="ccache clang++" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..842e3e7232 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "sdk", + "privileged": true, + "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.check.command": "clippy" + } + } + } +} 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d475cc31f..0e858260dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ ### feat: streamlined output during asset synchronization +### feat: add devcontainer + ## Dependencies ### Motoko 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}"), };