diff --git a/src/cache-base.ts b/src/cache-base.ts index 015f018..1b547c6 100644 --- a/src/cache-base.ts +++ b/src/cache-base.ts @@ -175,15 +175,15 @@ export class GradleStateCache { private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void { const initScriptFilenames = ['build-result-capture.init.gradle', 'build-result-capture-service.plugin.groovy'] for (const initScriptFilename of initScriptFilenames) { - const initScriptContent = this.readResourceAsString(initScriptFilename) + const initScriptContent = this.readInitScriptAsString(initScriptFilename) const initScriptPath = path.resolve(initScriptsDir, initScriptFilename) 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 - const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', resource) + const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', 'init-scripts', resource) return fs.readFileSync(absolutePath, 'utf8') } diff --git a/src/resources/build-result-capture-service.plugin.groovy b/src/resources/init-scripts/build-result-capture-service.plugin.groovy similarity index 100% rename from src/resources/build-result-capture-service.plugin.groovy rename to src/resources/init-scripts/build-result-capture-service.plugin.groovy diff --git a/src/resources/build-result-capture.init.gradle b/src/resources/init-scripts/build-result-capture.init.gradle similarity index 100% rename from src/resources/build-result-capture.init.gradle rename to src/resources/init-scripts/build-result-capture.init.gradle diff --git a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy index 8b3bfae..f5a9d06 100644 --- a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy +++ b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy @@ -100,7 +100,7 @@ class BaseInitScriptTest extends Specification { settingsFile = new File(testProjectDir, 'settings.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") targetInitScriptsDir.mkdirs()