Speciftying a DevContainer in gem5 allows for users to quickly create an environment in which they can develop, build, and run gem5. The ".devcontainer/devcontainer.json" file specifies the properties of the container. In this commit they are as follows: 1. The Docker image ghcr.io/gem5/devcontainer. This is built from "util/dockerfiles/devcontainer". This Dockerfile provides all dependencies and a pre-built gem5 binary from the current main branch (added to "/usr/local/bin"). In order to support this Docker container on different platforms we use the Docker multi-platform feature. As such, this must be built using `docker buildx bake devcontainer --push` which reads the `docker-bake.hcl file for the specification of the multi-platform image. 2. Visual Studio extensions. This is a list of Visual Studio Code extensions useful when developing gem5. They are automatically added the Visual Studio dev container. 3. Features. Features are enhancemets that can be added to a DevContainer. Normally they are libraries and other commonly used tools to be included in the Container. As we have our dependencies specified in the Dockerfile here we select one to enable Docker inside the container, one to enable the Github CLI, one to improve Linting, and finally one to enable the vscode CLI. 4. The On Create Command : This command allows us to specify commands to be run after the DevContainer is created. In this case we execute ".devcontainer/on-create.sh" which, right now, refreshes the git index and installed the pre-commit checks.
39 lines
1.7 KiB
Bash
Executable File
39 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2024 The Regents of the University of California
|
|
# All Rights Reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are
|
|
# met: redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer;
|
|
# redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution;
|
|
# neither the name of the copyright holders nor the names of its
|
|
# contributors may be used to endorse or promote products derived from
|
|
# this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# This script is run when the Docker container specified in devcontainer.json
|
|
# is created.
|
|
|
|
set -e
|
|
|
|
# Refresh the git index.
|
|
git update-index
|
|
|
|
# Install the pre-commit checks.
|
|
./util/pre-commit-install.sh
|