From 3d091fa7a8253761c7281a1e6d119b1ec233eab1 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Sat, 11 Jun 2022 09:18:48 -0600 Subject: [PATCH] Move initscripts into src/resources/init-scripts --- src/cache-base.ts | 6 +++--- .../build-result-capture-service.plugin.groovy | 0 .../{ => init-scripts}/build-result-capture.init.gradle | 0 .../com/gradle/gradlebuildaction/BaseInitScriptTest.groovy | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename src/resources/{ => init-scripts}/build-result-capture-service.plugin.groovy (100%) rename src/resources/{ => init-scripts}/build-result-capture.init.gradle (100%) 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()