Skip to content

Commit

Permalink
Swift: tweaks to codespace setup
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 committed Jun 22, 2022
1 parent 7223fed commit 400d7af
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
5 changes: 1 addition & 4 deletions .devcontainer/swift/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/cpp/.devcontainer/base.Dockerfile

# [Choice] Debian / Ubuntu version (use Debian 11, Ubuntu 18.04/22.04 on local arm64/Apple Silicon): debian-11, debian-10, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-ubuntu-22.04

ARG BAZELISK_VERSION=v1.10.1
ARG BAZELISK_DOWNLOAD_SHA=dev-mode
USER root
ADD root.sh /tmp/root.sh
RUN bash /tmp/root.sh && rm /tmp/root.sh
3 changes: 0 additions & 3 deletions .devcontainer/swift/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
},
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "ubuntu-20.04"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
Expand Down
8 changes: 6 additions & 2 deletions .devcontainer/swift/root.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
set -xe

BAZELISK_VERSION=v1.12.0
BAZELISK_DOWNLOAD_SHA=6b0bcb2ea15bca16fffabe6fda75803440375354c085480fe361d2cbf32501db

apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get -y install --no-install-recommends \
zlib1g-dev \
uuid-dev \
python3-distutils \
python3-pip
python3-pip \
bash-completion

# Install Bazel
curl -fSsL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64
([ "${BAZELISK_DOWNLOAD_SHA}" = "dev-mode" ] || echo "${BAZELISK_DOWNLOAD_SHA} */usr/local/bin/bazelisk" | sha256sum --check - )
echo "${BAZELISK_DOWNLOAD_SHA} */usr/local/bin/bazelisk" | sha256sum --check -
chmod 0755 /usr/local/bin/bazelisk
ln -s bazelisk /usr/local/bin/bazel
9 changes: 1 addition & 8 deletions .devcontainer/swift/user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,4 @@ bazel run swift/create-extractor-pack
python3 -m pip install pre-commit --no-warn-script-location
$HOME/.local/bin/pre-commit install

cat >> $HOME/.bashrc << EOF
# have the codeql binary installed by vscode automatically in PATH
bin=\$(ls \$HOME/.vscode-remote/data/User/globalStorage/github.vscode-codeql/*/codeql/codeql -t 2>/dev/null | head -1)
if [[ -n \$bin ]]; then
export PATH=\$PATH:$(dirname "\$bin")
fi
EOF
cat $(dirname $0)/user_bashrc.sh >> $HOME/.bashrc
5 changes: 5 additions & 0 deletions .devcontainer/swift/user_bashrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# have the codeql binary installed by vscode automatically in PATH
bin=$(ls $HOME/.vscode-remote/data/User/globalStorage/github.vscode-codeql/*/codeql/codeql -t 2>/dev/null | head -1)
if [[ -n $bin ]]; then
export PATH=$PATH:$(dirname "$bin")
fi

0 comments on commit 400d7af

Please sign in to comment.