From 41e10bf70fe7c12ef9d861dc1cd5314a7a6df358 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Wed, 19 Jun 2024 13:46:38 +0300 Subject: [PATCH] [Oztechan/CCC#3555] Replace executions with provider based methods --- buildSrc/src/main/kotlin/ProjectSettings.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/ProjectSettings.kt b/buildSrc/src/main/kotlin/ProjectSettings.kt index 8691e6a..cf1a9c6 100644 --- a/buildSrc/src/main/kotlin/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/ProjectSettings.kt @@ -3,7 +3,6 @@ */ import org.gradle.api.JavaVersion import org.gradle.api.Project -import java.io.ByteArrayOutputStream object ProjectSettings { const val COMPILE_SDK_VERSION = 34 @@ -21,12 +20,8 @@ object ProjectSettings { project: Project ) = "$MAYOR_VERSION.$MINOR_VERSION.${gitCommitCount(project).toInt() - VERSION_DIF}" - private fun gitCommitCount(project: Project): String { - val os = ByteArrayOutputStream() - project.exec { - commandLine = "git rev-list --first-parent --count HEAD".split(" ") - standardOutput = os - } - return String(os.toByteArray()).trim() - } + @Suppress("UnstableApiUsage") + private fun gitCommitCount(project: Project): String = project.providers.exec { + commandLine("git rev-list --first-parent --count HEAD".split(" ")) + }.standardOutput.asText.get().trim() }