From fa0c026e0721fdffab1b6ef8705c179fd01b29a2 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Fri, 27 Aug 2021 06:56:16 -0600 Subject: [PATCH] Always execute Gradle with --no-daemon The Gradle daemon is not useful for ephemeral builds, and the process can hold file locks which interfere with cache entry generation. In the case where multiple Gradle invocations occur in the same job, we could provide a way for users to override this behaviour, taking care of stopping any daemon process at the end of the job. --- .github/workflows/prod.yml | 12 ++++++------ src/main.ts | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 8a10cf7..963130e 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -19,12 +19,12 @@ jobs: uses: ./ with: build-root-directory: __tests__/samples/basic - arguments: test --no-daemon + arguments: test - name: Build with configuration-cache enabled uses: ./ with: build-root-directory: __tests__/samples/basic - arguments: test --no-daemon --configuration-cache + arguments: test --configuration-cache gradle-execution: needs: basic-build @@ -70,7 +70,7 @@ jobs: uses: ./ with: build-root-directory: __tests__/samples/basic - arguments: test --no-daemon + arguments: test configuration-cache: needs: basic-build @@ -85,7 +85,7 @@ jobs: uses: ./ with: build-root-directory: __tests__/samples/basic - arguments: test --configuration-cache --no-daemon + arguments: test --configuration-cache read-only-cache: needs: basic-build @@ -100,7 +100,7 @@ jobs: uses: ./ with: build-root-directory: __tests__/samples/basic - arguments: test --no-daemon + arguments: test distributions-cache-enabled: read-only gradle-user-home-cache-enabled: read-only project-dot-gradle-cache-enabled: read-only @@ -110,7 +110,7 @@ jobs: with: gradle-version: 6.9 build-root-directory: __tests__/samples/basic - arguments: test --no-daemon + arguments: test distributions-cache-enabled: false gradle-user-home-cache-enabled: false project-dot-gradle-cache-enabled: false diff --git a/src/main.ts b/src/main.ts index a238619..83a355f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,13 +15,16 @@ export async function run(): Promise { await caches.restore(buildRootDirectory) try { + const args: string[] = parseCommandLineArguments() + args.push('--no-daemon') + const result = await execution.execute( await resolveGradleExecutable( workspaceDirectory, buildRootDirectory ), buildRootDirectory, - parseCommandLineArguments() + args ) if (result.buildScanUrl) {