Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/s-core-devcontainer/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"ghcr.io/devcontainers/features/git-lfs": {
// Installs the latest version from the Distribution
"autoPull": "false" // do not automatically pull LFS files when creating the container
},
"ghcr.io/devcontainers/features/common-utils": {
// Installs latest version from the Distribution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"description": "sha256sums of Bazel Compile Commands to verify the download; format: <codename>:<sha256sum>;<codename>:<sha256sum>;..."
}
},
"postCreateCommand": "/devcontainer/features/s-core-local/post_create_command.sh",
"onCreateCommand": "/devcontainer/features/s-core-local/on_create_command.sh",
"mounts": [ {
"source": "${localEnv:HOME}/.cache/bazel", // default Bazel cache directory
"target": "/var/cache/bazel",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail

# ensure that the Bazel cache directory exists
if [ ! -d /var/cache/bazel ]; then
echo "Creating /var/cache/bazel directory..."
# yes, mkdir -p is idempotent, but we want to see the log message
mkdir -p /var/cache/bazel
fi

# If /var/cache/bazel is not a mountpoint, we assume it is a container-local cache.
# This is the case in codespaces, for example.
# Here, we must ensure that the directory has the correct permissions
# so that Bazel can write to it.
if ! mountpoint -q /var/cache/bazel; then
echo "/var/cache/bazel is not mounted. Using container-local cache and setting permissions."
chown -R "$(id -un):$(id -gn)" /var/cache/bazel
fi

# Configure Bazel to use the cache directory
# This way, Bazel can re-use an existing cache on the host machine, if mounted.
# Note that in some scenarios (like codespaces), it is not and hence resides in the container.
echo "startup --output_user_root=/var/cache/bazel" >> ~/.bazelrc

# Configure clangd to remove the -fno-canonical-system-headers flag, which is
# GCC-specific. If not done, there is an annoying error message on the first
# line of every C++ file when being displayed in Visual Studio Code.
mkdir -p ~/.config/clangd
cat > ~/.config/clangd/config.yaml <<EOF
CompileFlags:
Remove:
- -fno-canonical-system-headers
EOF

This file was deleted.