From 991da7bdd172add5eb664a4d713ca53513d5d5f3 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Wed, 5 Jun 2024 12:43:37 +0200 Subject: [PATCH] Build: fix issues --- .github/workflows/build.yml | 8 ++++++-- build.gradle | 31 +++++++++++++++++-------------- gradle.properties | 3 ++- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 075ce0fc91..e54ba7a8ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,8 @@ jobs: build: name: "Gradle build" runs-on: ubuntu-latest + env: + GRADLE_MICROG_VERSION_WITHOUT_GIT: 1 steps: - name: "Checkout sources" @@ -41,7 +43,9 @@ jobs: echo "Matcher configured: ${NAME:?}" fi done + - name: "Inspect Gradle tasks" + run: "./gradlew tasks" - name: "Execute Gradle assemble" - run: "./gradlew --no-daemon assemble" + run: "./gradlew assemble" - name: "Execute Gradle check" - run: "./gradlew --no-daemon check" + run: "./gradlew check" diff --git a/build.gradle b/build.gradle index f918023429..92339b13f2 100644 --- a/build.gradle +++ b/build.gradle @@ -67,27 +67,30 @@ def execResult(... args) { providers.exec { commandLine args }.standardOutput.asText.get() } +def ignoreGit = providers.environmentVariable('GRADLE_MICROG_VERSION_WITHOUT_GIT').getOrElse('0') == '1' def gmsVersion = "24.09.13" def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', '')) def vendingVersion = "40.2.26" def vendingVersionCode = Integer.parseInt(vendingVersion.replaceAll('\\.', '')) -def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').trim().substring(1) -def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD").trim()) -def gitCommitId = execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').trim().split(' ')[0] +def gitVersionBase = !ignoreGit ? execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').trim().substring(1) : "v0.0.0.$gmsVersionCode" +def gitCommitCount = !ignoreGit ? Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD").trim()) : 0 +def gitCommitId = !ignoreGit ? execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').trim().split(' ')[0] : '0000000' def gitDirty = false -execResult('git', 'status', '--porcelain').lines().each { stat -> - def status = stat.substring(0,2) - def file = stat.substring(3) - if (status == '??') { - if (subprojects.any { p -> file.startsWith(p.name + '/') }) { - logger.lifecycle('Dirty file: {} (untracked)', file) - gitDirty = true +if (!ignoreGit) { + execResult('git', 'status', '--porcelain').lines().each { stat -> + def status = stat.substring(0,2) + def file = stat.substring(3) + if (status == '??') { + if (subprojects.any { p -> file.startsWith(p.name + '/') }) { + logger.lifecycle('Dirty file: {} (untracked)', file) + gitDirty = true + } else { + logger.info('New file outside module: {} (ignored for dirty check)', file) + } } else { - logger.info('New file outside module: {} (ignored for dirty check)', file) + logger.lifecycle('Dirty file: {} (changed)', file) + gitDirty = true } - } else { - logger.lifecycle('Dirty file: {} (changed)', file) - gitDirty = true } } def ourVersionBase = gitVersionBase.substring(0, gitVersionBase.lastIndexOf('.')) diff --git a/gradle.properties b/gradle.properties index 4d1a0f2d02..1c50760c87 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ android.useAndroidX=true org.gradle.configuration-cache=true -org.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +org.gradle.caching=true +org.gradle.jvmargs=-Xmx4096m -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED