crosvm/tools/install-deps
Dennis Kempin a5b5e4b9a6 Enable rustfmt nightly in container and CI
This enables nightly rustfmt features in CI so we can keep a consistent
imports style.

The resulting formatting changes are in the follow-up CL and will
need to submit together.

This change also uncovered a bug from a previous commit that caused only
the first command in a series to be waited for. Formatting issues would
not be reported by the tool. The bug is fixed as part of this CL.

BUG=b:302055317
TEST=dev_container presubmit format --no-delta

Change-Id: I5d50609cc89d7e78bce66db120737a302f5c57e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4950268
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-29 18:41:29 +00:00

100 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -ex
sudo apt-get install --yes --no-install-recommends \
black \
ca-certificates \
clang \
cloud-image-utils \
curl \
dpkg-dev \
expect \
g++ \
gcc \
git \
jq \
libavcodec-dev \
libavutil-dev \
libcap-dev \
libclang-dev \
libdbus-1-dev \
libdrm-dev \
libepoxy-dev \
libglib2.0-dev \
libguestfs-tools \
libslirp-dev \
libssl-dev \
libswscale-dev \
libva-dev \
libwayland-dev \
libxext-dev \
lld \
make \
meson \
mypy \
nasm \
ncat \
ninja-build \
openssh-client \
pipx \
pkg-config \
protobuf-compiler \
python3 \
python3-argh \
python3-pip \
python3-rich \
qemu-system-x86 \
rsync \
screen \
strace \
tmux \
wayland-protocols \
wget
# mdformat is not available as a debian package. Install via pipx instead.
pipx install mdformat
pipx inject mdformat mdformat-gfm mdformat-footnote
pipx ensurepath
# Install rustup if not available yet
if ! command -v rustup &>/dev/null; then
wget "https://static.rust-lang.org/rustup/archive/1.25.1/x86_64-unknown-linux-gnu/rustup-init"
echo "5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c *rustup-init" | sha256sum -c -
chmod +x rustup-init
./rustup-init -y --no-modify-path --profile minimal --default-toolchain none
source ${CARGO_HOME:-~/.cargo}/env
rm rustup-init
fi
# Install required rust components.
# This will also ensure the toolchain required by ./rust-toolchain is installed.
rustup component add cargo clippy rustfmt
# LLVM tools are used to generate and process coverage files
rustup component add llvm-tools-preview
# Allow cross-compilation via mingw64
rustup target add x86_64-pc-windows-gnu
# Install nightly toolchain. Only used for rustfmt
rustup toolchain install nightly --profile minimal --component rustfmt
# Cargo extension to install binary packages from github
curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.4.4/cargo-binstall-x86_64-unknown-linux-gnu.tgz | tar -xzvvf - -C ${CARGO_HOME:-~/.cargo}/bin
# The bindgen tool is required to build a crosvm dependency.
cargo binstall --no-confirm bindgen-cli --version "0.68.1"
# binutils are wrappers to call the rustup bundled versions of llvm tools.
cargo binstall --no-confirm cargo-binutils
# The mdbook and mdbook-mermaid tools are used to build the crosvm book.
cargo binstall --no-confirm mdbook --version "0.4.25"
cargo binstall --no-confirm mdbook-mermaid --version "0.12.6"
cargo binstall --no-confirm mdbook-linkcheck --version "0.7.7"
# Nextest is an improved test runner for cargo
cargo binstall --no-confirm cargo-nextest --version "0.9.49"