mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-25 18:42:09 +00:00
Move initscripts into src/resources/init-scripts
This commit is contained in:
parent
a8d44c9749
commit
3d091fa7a8
4 changed files with 4 additions and 4 deletions
|
@ -175,15 +175,15 @@ export class GradleStateCache {
|
||||||
private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void {
|
private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void {
|
||||||
const initScriptFilenames = ['build-result-capture.init.gradle', 'build-result-capture-service.plugin.groovy']
|
const initScriptFilenames = ['build-result-capture.init.gradle', 'build-result-capture-service.plugin.groovy']
|
||||||
for (const initScriptFilename of initScriptFilenames) {
|
for (const initScriptFilename of initScriptFilenames) {
|
||||||
const initScriptContent = this.readResourceAsString(initScriptFilename)
|
const initScriptContent = this.readInitScriptAsString(initScriptFilename)
|
||||||
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
|
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
|
||||||
fs.writeFileSync(initScriptPath, initScriptContent)
|
fs.writeFileSync(initScriptPath, initScriptContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readResourceAsString(resource: string): string {
|
private readInitScriptAsString(resource: string): string {
|
||||||
// Resolving relative to __dirname will allow node to find the resource at runtime
|
// Resolving relative to __dirname will allow node to find the resource at runtime
|
||||||
const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', resource)
|
const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', 'init-scripts', resource)
|
||||||
return fs.readFileSync(absolutePath, 'utf8')
|
return fs.readFileSync(absolutePath, 'utf8')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class BaseInitScriptTest extends Specification {
|
||||||
settingsFile = new File(testProjectDir, 'settings.gradle')
|
settingsFile = new File(testProjectDir, 'settings.gradle')
|
||||||
buildFile = new File(testProjectDir, 'build.gradle')
|
buildFile = new File(testProjectDir, 'build.gradle')
|
||||||
|
|
||||||
File srcInitScriptsDir = new File("../../src/resources")
|
File srcInitScriptsDir = new File("../../src/resources/init-scripts")
|
||||||
File targetInitScriptsDir = new File(testProjectDir, "initScripts")
|
File targetInitScriptsDir = new File(testProjectDir, "initScripts")
|
||||||
targetInitScriptsDir.mkdirs()
|
targetInitScriptsDir.mkdirs()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue