From 39e3b755b02bb26bdcbf9ec764ad8ba61276e21a Mon Sep 17 00:00:00 2001 From: binarynoise Date: Tue, 19 Aug 2025 01:10:10 +0200 Subject: [PATCH] update commit count logic --- .../convention/src/main/kotlin/Github.kt | 10 ++++++--- .../src/main/kotlin/buildlogic/git/Git.kt | 12 ++++++++--- modules.gradle.kts | 20 ++++++++++++++++++ settings.gradle.kts | 21 +------------------ 4 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 modules.gradle.kts diff --git a/build-logic/convention/src/main/kotlin/Github.kt b/build-logic/convention/src/main/kotlin/Github.kt index 92eb702..b9277de 100644 --- a/build-logic/convention/src/main/kotlin/Github.kt +++ b/build-logic/convention/src/main/kotlin/Github.kt @@ -74,9 +74,13 @@ abstract class GithubCreateReleaseTask : Github() { val name = "${project.name}-v$commitCount" if (repository.getReleaseByTagName(tagName) != null) { - doLast { - project.logger.warn("Release $name already exists") - } + val logString = "Release $name already exists" + + project.gradle.addBuildListener(object : BuildAdapter() { + override fun buildFinished(result: BuildResult) { + println(logString) + } + }) return } diff --git a/build-logic/convention/src/main/kotlin/buildlogic/git/Git.kt b/build-logic/convention/src/main/kotlin/buildlogic/git/Git.kt index 47c4be3..735b0a3 100644 --- a/build-logic/convention/src/main/kotlin/buildlogic/git/Git.kt +++ b/build-logic/convention/src/main/kotlin/buildlogic/git/Git.kt @@ -10,11 +10,17 @@ import org.gradle.process.ExecOutput private fun Project.getCommitCountExec() = providers.exec { executable("git") args("rev-list", "--count", "HEAD") - args(projectDir.absolutePath) - args(rootProject.file("gradle").absolutePath) + args(projectDir) + args(rootProject.file("gradle")) args(rootProject.file("build-logic")) - rootProject.projectDir.listFiles { file -> file.isFile && file.extension != "md" }!!.forEach { args(it.absolutePath) } + args(rootProject.file("build.gradle.kts")) + args(rootProject.file("settings.gradle.kts")) + args(rootProject.file("gradle.properties")) + args(rootProject.file("proguard-rules.pro")) + + args(rootProject.file("gradlew")) + args(rootProject.file("gradlew.bat")) extensions.findByType()?.let { val metadata = rootProject.file("metadata").resolve(it.namespace ?: "-") diff --git a/modules.gradle.kts b/modules.gradle.kts new file mode 100644 index 0000000..48b5bfc --- /dev/null +++ b/modules.gradle.kts @@ -0,0 +1,20 @@ +include(":AlwaysAllowChargingFeedback") +include(":AlwaysAllowMultiInstanceSplit") +include(":AnimationScaleMod") +include(":AntiBrightnessChange") +include(":AutomaticAdvancedSettingsExpander") +include(":BetterBluetoothDeviceSort") +include(":BetterVerboseWiFiLogging") +include(":ClassHunter") +include(":CodecMod") +include(":DontResetIfBootedAndConnected") +include(":FreeNotifications") +include(":KeepSplitScreenRatio") +include(":MotionEventMod") +include(":MuteSlf4jWarnings") +include(":OpenWifiOnTop") +include(":PersistentForegroundServiceNotifications") +include(":PreventAudioFocus") +include(":ResetAllNotificationChannels") +include(":RotationControl") +include(":UpsideWifi") diff --git a/settings.gradle.kts b/settings.gradle.kts index 19fd583..c949c3f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,23 +44,4 @@ include(":logger") include(":reflection") include(":template") -include(":AlwaysAllowChargingFeedback") -include(":AlwaysAllowMultiInstanceSplit") -include(":AnimationScaleMod") -include(":AntiBrightnessChange") -include(":AutomaticAdvancedSettingsExpander") -include(":BetterBluetoothDeviceSort") -include(":BetterVerboseWiFiLogging") -include(":ClassHunter") -include(":CodecMod") -include(":DontResetIfBootedAndConnected") -include(":FreeNotifications") -include(":KeepSplitScreenRatio") -include(":MotionEventMod") -include(":MuteSlf4jWarnings") -include(":OpenWifiOnTop") -include(":PersistentForegroundServiceNotifications") -include(":PreventAudioFocus") -include(":ResetAllNotificationChannels") -include(":RotationControl") -include(":UpsideWifi") +apply(from = "modules.gradle.kts")