Skip to content

Commit

Permalink
[Oztechan/CCC#3555] Replace executions with provider based methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan committed Jun 19, 2024
1 parent 10b1900 commit 41e10bf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions buildSrc/src/main/kotlin/ProjectSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}

0 comments on commit 41e10bf

Please sign in to comment.