2021-08-20 15:01:43 -04:00
|
|
|
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> {
|
2021-09-03 13:25:55 -04:00
|
|
|
core.startGroup('Restore Gradle User Home from cache')
|
2021-08-20 15:01:43 -04:00
|
|
|
await cacheGradleUserHome.restore()
|
2021-09-03 13:25:55 -04:00
|
|
|
core.endGroup()
|
|
|
|
|
|
|
|
core.startGroup('Restore project .gradle directory from cache')
|
|
|
|
core.saveState(BUILD_ROOT_DIR, buildRootDirectory)
|
2021-08-20 15:01:43 -04:00
|
|
|
await cacheProjectDotGradle.restore(buildRootDirectory)
|
2021-09-03 13:25:55 -04:00
|
|
|
core.endGroup()
|
2021-08-20 15:01:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function save(): Promise<void> {
|
2021-09-03 13:25:55 -04:00
|
|
|
core.startGroup('Cache Gradle User Home')
|
2021-08-20 15:01:43 -04:00
|
|
|
await cacheGradleUserHome.save()
|
2021-09-03 13:25:55 -04:00
|
|
|
core.endGroup()
|
|
|
|
|
|
|
|
core.startGroup('Cache project .gradle directory')
|
|
|
|
const buildRootDirectory = core.getState(BUILD_ROOT_DIR)
|
2021-08-20 15:01:43 -04:00
|
|
|
await cacheProjectDotGradle.save(buildRootDirectory)
|
2021-09-03 13:25:55 -04:00
|
|
|
core.endGroup()
|
2021-08-20 15:01:43 -04:00
|
|
|
}
|