All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugsnag.android.gradle.internal.GitVersionValueSource.kt Maven / Gradle / Ivy

The newest version!
package com.bugsnag.android.gradle.internal

import org.gradle.api.provider.ValueSource
import org.gradle.api.provider.ValueSourceParameters
import org.gradle.process.ExecOperations
import java.io.ByteArrayOutputStream
import java.nio.charset.Charset
import javax.inject.Inject

abstract class GitVersionValueSource : ValueSource {
    @get:Inject
    abstract val execOperations: ExecOperations

    override fun obtain(): String {
        val output = ByteArrayOutputStream()
        execOperations.exec {
            it.commandLine("git", "--version")
            it.standardOutput = output
        }
        return output.toString(Charset.defaultCharset())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy