mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-01-14 18:01:38 -05:00
b0c29bffb7
Instead of passing `--no-daemon` on the command line, the same functionality is now acheived by writing a gradle.properties file when initializing Gradle User Home.
37 lines
1 KiB
TypeScript
37 lines
1 KiB
TypeScript
import * as exec from '@actions/exec'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
import {writeInitScript} from './build-scan-capture'
|
|
|
|
export async function execute(executable: string, root: string, args: string[]): Promise<BuildResult> {
|
|
let buildScanUrl: string | undefined
|
|
|
|
const initScript = writeInitScript()
|
|
args.push('--init-script')
|
|
args.push(initScript)
|
|
|
|
const buildScanFile = path.resolve(root, 'gradle-build-scan.txt')
|
|
if (fs.existsSync(buildScanFile)) {
|
|
fs.unlinkSync(buildScanFile)
|
|
}
|
|
|
|
const status: number = await exec.exec(executable, args, {
|
|
cwd: root,
|
|
ignoreReturnCode: true
|
|
})
|
|
|
|
if (fs.existsSync(buildScanFile)) {
|
|
buildScanUrl = fs.readFileSync(buildScanFile, 'utf-8')
|
|
}
|
|
|
|
return new BuildResultImpl(status, buildScanUrl)
|
|
}
|
|
|
|
export interface BuildResult {
|
|
readonly status: number
|
|
readonly buildScanUrl?: string
|
|
}
|
|
|
|
class BuildResultImpl implements BuildResult {
|
|
constructor(readonly status: number, readonly buildScanUrl?: string) {}
|
|
}
|