diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5d1b2c587..d836cd9a81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,22 +32,29 @@ jobs: with: path: src/chrome/build/pgo_profiles/ key: pgo-linux-openwrt-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} - - name: Cache AFDO (Android) - uses: actions/cache@v4 - with: - path: src/chrome/android/profiles/ - key: afdo-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} - name: Cache Android NDK (Android) uses: actions/cache@v4 with: path: src/third_party/android_toolchain/ndk/ key: android-ndk-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} - - run: ./get-clang.sh - - run: EXTRA_FLAGS='target_os="android"' ./get-clang.sh + - id: ccache-timestamp + run: echo "CCACHE_TIMESTAMP=$(date +%s)" >>$GITHUB_OUTPUT + - name: Host tool ccache + uses: actions/cache@v4 + with: + path: src/.host_tool_cache + key: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}-${{ steps.ccache-timestamp.outputs.CCACHE_TIMESTAMP }} + restore-keys: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}- + - name: Install APT packages + run: | + sudo apt update + sudo apt install ninja-build pkg-config ccache + - run: EXTRA_FLAGS='target_os="android" target_cpu="x64"' ./get-clang.sh - run: | if [ ! -f qemu-user*.deb ]; then wget https://snapshot.debian.org/archive/debian/20250405T083429Z/pool/main/q/qemu/qemu-user_9.2.2%2Bds-1%2Bb2_amd64.deb fi + - run: EXTRA_FLAGS='target_os="android" target_cpu="x64"' WARMUP_HOST_TOOLS=1 ./build.sh cache-toolchains-win: runs-on: windows-2022 steps: @@ -139,6 +146,12 @@ jobs: src/out/sysroot-build/trixie/trixie_* src/out/sysroot-build/sid/sid_* key: sysroot-linux-${{ matrix.arch }}-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} + - name: Host tool ccache + uses: actions/cache@v4 + with: + path: src/.host_tool_cache + key: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}-${{ steps.ccache-timestamp.outputs.CCACHE_TIMESTAMP }} + restore-keys: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}- - id: ccache-timestamp run: echo "CCACHE_TIMESTAMP=$(date +%s)" >>$GITHUB_OUTPUT - name: Cache ccache files @@ -208,11 +221,6 @@ jobs: src/gn/ src/qemu-user*.deb key: toolchains-posix-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} - - name: Cache AFDO (Android) - uses: actions/cache@v4 - with: - path: src/chrome/android/profiles/ - key: afdo-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} - name: Cache Android NDK (Android) uses: actions/cache@v4 with: @@ -223,6 +231,12 @@ jobs: with: path: src/out/sysroot-build/android/ key: sysroot-android-${{ matrix.arch }}-${{ hashFiles('CHROMIUM_VERSION') }}-v${{ env.CACHE_EPOCH }} + - name: Host tool ccache + uses: actions/cache@v4 + with: + path: src/.host_tool_cache + key: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}-${{ steps.ccache-timestamp.outputs.CCACHE_TIMESTAMP }} + restore-keys: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }}- - id: ccache-timestamp run: echo "CCACHE_TIMESTAMP=$(date +%s)" >>$GITHUB_OUTPUT - name: Cache ccache files @@ -602,6 +616,11 @@ jobs: with: path: src/out/sysroot-build/openwrt key: sysroot-openwrt-23.05.0-${{ matrix.arch }}-v${{ env.CACHE_EPOCH }} + - name: Host tool ccache + uses: actions/cache@v4 + with: + path: src/.host_tool_cache + key: ccache-posix-${{ hashFiles('CHROMIUM_VERSION') }} - id: ccache-timestamp run: echo "CCACHE_TIMESTAMP=$(date +%s)" >>$GITHUB_OUTPUT - name: Cache ccache files diff --git a/.gitignore b/.gitignore index 0d98ee8d2a..639be9dc50 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ src/gn/ src/third_party/llvm-build/ src/third_party/android_toolchain/ src/out/ +src/.host_tool_cache/ .vscode/ *.pyc diff --git a/src/build.sh b/src/build.sh index cbffa32819..d78ec855d8 100755 --- a/src/build.sh +++ b/src/build.sh @@ -79,6 +79,8 @@ flags="$flags"' enable_backup_ref_ptr_support=false enable_dangling_raw_ptr_checks=false + + use_clang_modules=false ' if [ "$WITH_SYSROOT" ]; then @@ -116,4 +118,16 @@ export DEPOT_TOOLS_WIN_TOOLCHAIN=0 ./gn/out/gn gen "$out" --args="$flags $EXTRA_FLAGS" +if [ "$host_os" = linux ]; then + clang_x64_targets=$(grep -o ' | .*' $out/toolchain.ninja | grep -o ' clang_x64/[^ ]*' | sort -u) + if [ "$clang_x64_targets" ]; then + CCACHE_DIR=$PWD/.host_tool_cache ccache -z + CCACHE_DIR=$PWD/.host_tool_cache ninja -C "$out" $clang_x64_targets + CCACHE_DIR=$PWD/.host_tool_cache ccache -s + if [ "$WARMUP_HOST_TOOLS" ]; then + exit 0 + fi + fi +fi + ninja -C "$out" naive