diff --git a/buildSrc/src/main/kotlin/ProjectSettings.kt b/buildSrc/src/main/kotlin/ProjectSettings.kt index d0b9f82..52087ab 100644 --- a/buildSrc/src/main/kotlin/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/ProjectSettings.kt @@ -2,7 +2,6 @@ * Copyright (c) 2020 Mustafa Ozhan. All rights reserved. */ import org.gradle.api.Project -import java.io.ByteArrayOutputStream object ProjectSettings { private const val MAYOR_VERSION = 2 @@ -15,12 +14,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() }