-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from LemLib/chore/devcontainer-setup
🧑💻 add devcontainer setup with sim
- Loading branch information
Showing
6 changed files
with
121 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
FROM rust:1.67 as builder | ||
|
||
RUN git clone https://github.com/vexide/vex-v5-qemu.git /vex-v5-qemu | ||
|
||
WORKDIR /vex-v5-qemu | ||
RUN cd packages/kernel; cargo build --target-dir /target/kernel | ||
|
||
RUN cd packages/client-cli; cargo install --path . --root /target/client-cli | ||
|
||
FROM mcr.microsoft.com/devcontainers/cpp:1-noble | ||
# ------------ | ||
# Install Required Packages | ||
# ------------ | ||
RUN sudo apt-get update | ||
COPY ./.devcontainer/packagelist /packagelist | ||
RUN sudo apt-get -y install $(cat /packagelist | sed 's/\r//') | ||
RUN rm /packagelist # Cleanup image | ||
RUN sudo apt-get clean # Cleanup image | ||
|
||
# ------------ | ||
# Install Clangd | ||
# ------------ | ||
RUN curl -sLo clangd.zip $( \ | ||
curl -s https://api.github.com/repos/clangd/clangd/releases/latest \ | ||
| jq -r '[.assets[] | select(.name | test ("^clangd-linux"))][0].browser_download_url' \ | ||
) \ | ||
&& unzip clangd.zip -d /usr/local/share \ | ||
&& mv /usr/local/share/clangd_*/ /usr/local/share/clangd \ | ||
&& rm clangd.zip | ||
|
||
ENV PATH="$PATH:/usr/local/share/clangd/bin" | ||
|
||
# ------------ | ||
# Install PROS CLI | ||
# ------------ | ||
RUN pip install --break-system-packages pros-cli | ||
|
||
# ------------ | ||
# Install ARM Toolchain | ||
# ------------ | ||
COPY --from=ghcr.io/lemlib/pros-build:v2.0.2 /gcc-arm-none-eabi-10.3-2021.10 /usr/local/share/arm-none-eabi | ||
ENV PATH="$PATH:/usr/local/share/arm-none-eabi/bin" | ||
|
||
# Copy the simulator binary | ||
COPY --from=builder /target/client-cli/bin/client-cli /usr/local/bin/simulator | ||
|
||
# Clone pros kernel source so we can reference it when debugging | ||
COPY ./project.pros /project.pros | ||
ENV PROS_SOURCE_PATH="$HOME/.pros" | ||
RUN git clone https://github.com/purduesigbots/pros.git $PROS_SOURCE_PATH \ | ||
--depth 1 \ | ||
--branch $(</project.pros jq -r '.["py/state"].templates.kernel.version') | ||
RUN rm /project.pros # Cleanup image | ||
|
||
# Copy the sim kernel, as its required to run the simulator | ||
ENV V5_SIM_PATH="$HOME/.vex-v5-qemu" | ||
ENV V5_SIM_KERNEL_PATH="$V5_SIM_PATH/kernel" | ||
COPY --from=builder /target/kernel/armv7a-none-eabi/debug/kernel $V5_SIM_KERNEL_PATH | ||
|
||
# Copy the sim source, so we can reference it when debugging | ||
ENV V5_SIM_SOURCE_PATH="$V5_SIM_PATH/source" | ||
COPY --from=builder /vex-v5-qemu $V5_SIM_SOURCE_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
All files in the .devcontainer folder are taken from | ||
https://github.com/darkMatter781x/HighStakes and are licensed under the MIT | ||
license as follows. | ||
|
||
===== BEGIN LICENSE ===== | ||
|
||
MIT License | ||
|
||
Copyright (c) 2024 Andrew Curtis and Kairui Dai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
{ | ||
"postCreateCommand": "chmod 777 .devcontainer/postCreateCommand.bash && .devcontainer/postCreateCommand.bash && source ~/.bashrc" | ||
} | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"clangd.path": "/usr/local/share/clangd/bin/clangd" | ||
}, | ||
"extensions": [ | ||
"jeff-hykin.better-cpp-syntax", | ||
"llvm-vs-code-extensions.vscode-clangd", | ||
"streetsidesoftware.code-spell-checker", | ||
"cschlosser.doxdocgen", | ||
"ms-azuretools.vscode-docker", | ||
"vivaxy.vscode-conventional-commits" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
git | ||
python3-minimal | ||
python3-pip | ||
pipx | ||
qemu-system | ||
gdb-multiarch | ||
jq |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters