mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Provide a `.devcontainer` definition, following the Dev Container Specification, to give contributors a ready-made Linux environment with the tools needed to build CMake, run its test suite, build its documentation, and satisfy its style rules. Base the container on Ubuntu, which offers the broadest ecosystem of packages and tooling for development, including a recent `cmake` and the `clang-format` version our style rules require, exactly. Mirror the package lists of the Debian image our CI infrastructure uses, section by section, so that the dependencies available closely match the ones against which merge requests are tested. Build the image the way the images under `.gitlab/ci/docker/` are built: bind mount the package lists and the installation script rather than copying them in, and cache the package lists and downloaded archives so that a rebuild fetches only what has changed. Run optional `.devcontainer/hooks/root.sh` and `.devcontainer/hooks/user.sh` scripts, both ignored by Git, so that developers may customize the container without modifying tracked files. Document usage in a new `Help/dev/devcontainer.rst`. Fixes: #28043
26 lines
999 B
Bash
Executable File
26 lines
999 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Report whether this clone and its development container are ready to use
|
|
# and, if they are not, print what remains to be set up. Run each time a
|
|
# tool attaches to the container. See `Help/dev/devcontainer.rst`.
|
|
|
|
set -u
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Check that development setup is up-to-date, the way our `pre-commit` hook
|
|
# does. `Utilities/SetupForDevelopment.sh` is interactive, so the container
|
|
# cannot run it on the developer's behalf.
|
|
eval "$(grep '^SetupForDevelopment_VERSION=' Utilities/SetupForDevelopment.sh)"
|
|
setup_done=$(git config --get hooks.SetupForDevelopment || echo 0)
|
|
if test "$setup_done" -lt "${SetupForDevelopment_VERSION:-0}"; then
|
|
cat <<MESSAGE
|
|
git: this work tree is not set up for development.
|
|
Run 'Utilities/SetupForDevelopment.sh' to configure your Git identity and
|
|
install the project's commit hooks. The work tree is shared with the host,
|
|
so running it here sets up both.
|
|
MESSAGE
|
|
else
|
|
echo "git: this work tree is set up for development."
|
|
fi
|