Add cache for project .gradle dir

- For now, this is limited to configuration-cache directory
This commit is contained in:
Daz DeBoer
2021-08-20 13:01:43 -06:00
parent c211be411e
commit 5340f6e816
6 changed files with 144 additions and 12 deletions

19
src/caches.ts Normal file
View File

@@ -0,0 +1,19 @@
import * as cacheGradleUserHome from './cache-gradle-user-home'
import * as cacheProjectDotGradle from './cache-project-dot-gradle'
import * as core from '@actions/core'
const BUILD_ROOT_DIR = 'BUILD_ROOT_DIR'
export async function restore(buildRootDirectory: string): Promise<void> {
core.saveState(BUILD_ROOT_DIR, buildRootDirectory)
await cacheGradleUserHome.restore()
await cacheProjectDotGradle.restore(buildRootDirectory)
}
export async function save(): Promise<void> {
const buildRootDirectory = core.getState(BUILD_ROOT_DIR)
await cacheGradleUserHome.save()
await cacheProjectDotGradle.save(buildRootDirectory)
}