From 68831bc44b747e7e42b4ce0dcc1e8e1742dd920d Mon Sep 17 00:00:00 2001 From: Pedro Gonnet Date: Tue, 13 Aug 2024 07:58:34 -0700 Subject: [PATCH] Force the compiler binary `mtime`s to a fixed value for `cmake-android-*` workflow builds. Currently, `ccache` is not getting any hits because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (it copies the binaries to the `tool-cache`, which sets their `mtime`s to the current time, see discussion [here](https://github.com/hendrikmuhs/ccache-action/issues/94)). PiperOrigin-RevId: 662517571 --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eddf7680982..9d16dbe55db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -282,6 +282,15 @@ jobs: key: ${{ github.job }}-${{ matrix.arch }} max-size: "1G" save: ${{ inputs.update-caches }} + - name: Force compiler binary mtime + # The nttld/setup-ndk action downloads the compiler binaries and copies them to the + # tools-cache, where their mtimes are set to the current time. This is bad since ccache + # uses the compiler binary mtime to determine whether two compilations match. We solve + # this problem by coercing the mtime of the compiler binaries to a fixed value. Note that + # if the compiler does indeed change, this will also cause the path to change as it would + # imply using a different NDK version. + run: | + find ${{ steps.setup-ndk.outputs.ndk-path }} -wholename '*/bin/clang*' -executable -type f,l -exec touch -h -t 202408130000 {} + - name: Configure and build run: scripts/build-android-${{ matrix.arch }}.sh working-directory: ${{ github.workspace }}