mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Meta: Add a vcpkg cache to the devcontainer
This also means that the prebuilt devcontainer will have a populated vcpkg binary cache, speeding up the first build by a lot.
This commit is contained in:
parent
8e716daa3d
commit
c4f7361a5b
Notes:
github-actions[bot]
2024-10-15 00:15:14 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/c4f7361a5b7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1763
4 changed files with 76 additions and 5 deletions
|
@ -6,7 +6,13 @@
|
|||
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
|
||||
"./features/ladybird": {
|
||||
"llvm_version": 18,
|
||||
"llvm_version": 18
|
||||
},
|
||||
"./features/vcpkg-cache": {
|
||||
"release_triplet": true,
|
||||
// FIXME: Figure out how to have the CI prebuilt version set both of these true
|
||||
"debug_triplet": false,
|
||||
"sanitizer_triplet": false
|
||||
},
|
||||
"ghcr.io/devcontainers/features/desktop-lite": {
|
||||
"password": "vscode",
|
||||
|
@ -44,17 +50,15 @@
|
|||
"Toolchain/Local/**": true,
|
||||
"Toolchain/Tarballs/**": true,
|
||||
"Toolchain/Build/**": true,
|
||||
"Build/**": true,
|
||||
"Build/**": true
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/.git": true,
|
||||
"Toolchain/Local/**": true,
|
||||
"Toolchain/Tarballs/**": true,
|
||||
"Toolchain/Build/**": true,
|
||||
"Build/**": true,
|
||||
"Build/**": true
|
||||
},
|
||||
// Force clang-format to respect Ladybird's .clang-format style file. This is not necessary if you're not using the Microsoft C++ extension.
|
||||
"C_Cpp.clang_format_style": "file",
|
||||
// Tab settings
|
||||
"editor.tabSize": 4,
|
||||
"editor.useTabStops": false,
|
||||
|
|
27
.devcontainer/features/vcpkg-cache/devcontainer-feature.json
Normal file
27
.devcontainer/features/vcpkg-cache/devcontainer-feature.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "Caches Ladybird's vcpkg dependencies",
|
||||
"id": "vcpkg-cache",
|
||||
"version": "1.0.0",
|
||||
"description": "Create a prebuilt vcpkg binary cache for Ladybird developer use",
|
||||
"installsAfter": [ "./features/ladybird" ],
|
||||
"containerEnv": {
|
||||
"VCPKG_BINARY_SOURCES": ";files,/usr/local/share/vcpkg-binary-cache,read"
|
||||
},
|
||||
"options": {
|
||||
"release_triplet": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Build vcpkg dependencies with release configuration"
|
||||
},
|
||||
"debug_triplet": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Build vcpkg dependencies with debug configuration"
|
||||
},
|
||||
"sanitizer_triplet": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Build vcpkg dependencies with sanitizer configuration"
|
||||
}
|
||||
}
|
||||
}
|
39
.devcontainer/features/vcpkg-cache/install.sh
Normal file
39
.devcontainer/features/vcpkg-cache/install.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
# Prebuild ladybird's vcpkg dependencies
|
||||
set -e
|
||||
|
||||
# FIXME: Add some options to make this more flexible and usable by other projects
|
||||
# FIXME: Find a way to do this without cloning ladybird
|
||||
|
||||
cd /tmp
|
||||
|
||||
CACHE_DIR=/usr/local/share/vcpkg-binary-cache
|
||||
mkdir -p ${CACHE_DIR}
|
||||
|
||||
# Clone ladybird to get access to vcpkg.json and vcpkg commit id
|
||||
git clone https://github.com/LadybirdBrowser/ladybird.git --depth 1
|
||||
cd ladybird
|
||||
# Grab and bootstrap the exact commit of vcpkg that trunk is using
|
||||
python3 ./Toolchain/BuildVcpkg.py
|
||||
|
||||
# Install the vcpkg.json in manifest mode from the root of the repo
|
||||
# Set the binary cache directory to the one we intend to use at container runtime
|
||||
export VCPKG_ROOT="${PWD}/Toolchain/Tarballs/vcpkg"
|
||||
export VCPKG_BINARY_SOURCES="clear;files,${CACHE_DIR},readwrite"
|
||||
|
||||
# Check options to see which versions we should build
|
||||
if [ "${RELEASE_TRIPLET}" = "true" ]; then
|
||||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/release-triplets"
|
||||
fi
|
||||
|
||||
if [ "${DEBUG_TRIPLET}" = "true" ]; then
|
||||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/debug-triplets"
|
||||
fi
|
||||
|
||||
if [ "${SANITIZER_TRIPLET}" = "true" ]; then
|
||||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/sanitizer-triplets"
|
||||
fi
|
||||
|
||||
# Clean up to reduce layer size
|
||||
cd /tmp
|
||||
rm -rf ladybird
|
1
.github/workflows/dev-container.yml
vendored
1
.github/workflows/dev-container.yml
vendored
|
@ -6,6 +6,7 @@ on:
|
|||
push:
|
||||
paths:
|
||||
- '.devcontainer/**'
|
||||
- 'vcpkg.json'
|
||||
schedule:
|
||||
# https://crontab.guru/#0_0_*_*_1
|
||||
- cron: '0 0 * * 1'
|
||||
|
|
Loading…
Reference in a new issue