diff --git a/.github/actions/build-dist/action.yml b/.github/actions/build-dist/action.yml index 26dd48ed..b1898491 100644 --- a/.github/actions/build-dist/action.yml +++ b/.github/actions/build-dist/action.yml @@ -8,6 +8,13 @@ runs: node-version: 24 cache: npm cache-dependency-path: sources/package-lock.json + - name: Build legacy caching module + shell: bash + run: | + npm install + npm run build + working-directory: sources/legacy-caching + - name: Build distribution shell: bash run: | @@ -20,6 +27,8 @@ runs: - name: Copy the generated sources/dist directory to the top-level dist shell: bash run: | + mkdir -p sources/dist/legacy-caching + cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/ cp -r sources/dist . - name: Upload distribution diff --git a/.github/workflows/ci-update-dist.yml b/.github/workflows/ci-update-dist.yml index 91eceaeb..cf81d844 100644 --- a/.github/workflows/ci-update-dist.yml +++ b/.github/workflows/ci-update-dist.yml @@ -38,6 +38,12 @@ jobs: run: | npm exec -y -- pacote extract @gradle-tech/develocity-agent@3.0.1 ~/.node_libraries/@gradle-tech/develocity-agent + - name: Build legacy caching module + run: | + npm clean-install + npm run build + working-directory: sources/legacy-caching + - name: Install npm dependencies run: | npm clean-install @@ -58,6 +64,8 @@ jobs: - name: Copy the generated sources/dist directory to the top-level dist run: | + mkdir -p sources/dist/legacy-caching + cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/ cp -r sources/dist . - name: Import GPG key to sign commits diff --git a/build b/build index 5edd2601..63f2c366 100755 --- a/build +++ b/build @@ -6,6 +6,9 @@ build_legacy_caching() { npm clean-install npm run build cd ../.. + # Copy legacy caching bundle into sources/dist so the CI bot picks it up + mkdir -p sources/dist/legacy-caching + cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/ } cd sources diff --git a/sources/legacy-caching/src/gradle-utils.ts b/sources/legacy-caching/src/gradle-utils.ts index b0bff1a7..a153ca86 100644 --- a/sources/legacy-caching/src/gradle-utils.ts +++ b/sources/legacy-caching/src/gradle-utils.ts @@ -90,16 +90,6 @@ export function findGradleExecutableForCleanup(buildResults: BuildResults): stri } } - // Try the Gradle installation directory as a fallback - for (const result of buildResults.results) { - if (versionIsAtLeast(result.gradleVersion, '8.11')) { - const executable = path.resolve(result.gradleHomeDir, 'bin', IS_WINDOWS ? 'gradle.bat' : 'gradle') - if (fs.existsSync(executable)) { - return executable - } - } - } - core.info('Could not locate a Gradle >= 8.11 executable for cache cleanup.') return null } diff --git a/sources/src/cache-service-loader.ts b/sources/src/cache-service-loader.ts index b25f2b84..e731c83f 100644 --- a/sources/src/cache-service-loader.ts +++ b/sources/src/cache-service-loader.ts @@ -75,7 +75,7 @@ export async function loadVendoredCacheService(): Promise { } export async function loadLegacyCacheService(): Promise { - const legacyLibraryPath = findLibraryPath('sources/legacy-caching/dist/index.js') + const legacyLibraryPath = findLibraryPath('dist/legacy-caching/index.js') const moduleUrl = pathToFileURL(legacyLibraryPath).href return (await import(moduleUrl)) as CacheService }