2021-06-24 15:13:54 -04:00
import * as path from 'path'
import fs from 'fs'
2020-06-13 07:44:30 -04:00
const IS_WINDOWS = process . platform === 'win32'
2019-09-23 06:10:49 -04:00
export function wrapperFilename ( ) : string {
2020-06-13 07:44:30 -04:00
return IS_WINDOWS ? 'gradlew.bat' : 'gradlew'
2019-09-21 10:01:53 -04:00
}
2019-09-23 06:10:49 -04:00
export function installScriptFilename ( ) : string {
2020-06-13 07:44:30 -04:00
return IS_WINDOWS ? 'gradle.bat' : 'gradle'
2019-09-21 10:01:53 -04:00
}
2021-06-24 15:13:54 -04:00
export function validateGradleWrapper ( gradlewDirectory : string ) : void {
const wrapperProperties = path . resolve (
gradlewDirectory ,
'gradle/wrapper/gradle-wrapper.properties'
)
if ( ! fs . existsSync ( wrapperProperties ) ) {
throw new Error (
` Cannot locate a Gradle wrapper properties file at ' ${ wrapperProperties } '. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured. `
)
}
}