mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-30 14:48:56 +08:00
Persist build-scan-capture init script into Gradle User Home
Instead of writing this file to a temp directory and referencing it on the Gradle command line, the init script is now written to Gradle User Home so that it is picked up automatically.
This commit is contained in:
@@ -7,6 +7,7 @@ import * as exec from '@actions/exec'
|
||||
|
||||
import {AbstractCache, CacheEntryListener, CacheListener} from './cache-base'
|
||||
import {getCacheKeyPrefix, hashFileNames, tryDelete} from './cache-utils'
|
||||
import {writeBuildScanCaptureInitScript} from './build-scan-capture'
|
||||
|
||||
const META_FILE_DIR = '.gradle-build-action'
|
||||
|
||||
@@ -32,6 +33,10 @@ export class GradleUserHomeCache extends AbstractCache {
|
||||
const propertiesFile = path.resolve(gradleUserHome, 'gradle.properties')
|
||||
this.debug(`Initializing gradle.properties to disable daemon: ${propertiesFile}`)
|
||||
fs.writeFileSync(propertiesFile, 'org.gradle.daemon=false')
|
||||
|
||||
const initScript = path.resolve(gradleUserHome, 'init.gradle')
|
||||
this.debug(`Adding init script to capture build scans: ${initScript}`)
|
||||
writeBuildScanCaptureInitScript(initScript)
|
||||
}
|
||||
|
||||
async afterRestore(listener: CacheListener): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user