mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-30 05:40:34 +00:00
22 lines
519 B
Kotlin
22 lines
519 B
Kotlin
package com.dfsek.terra
|
|
|
|
import org.gradle.api.Project
|
|
import java.io.ByteArrayOutputStream
|
|
|
|
fun Project.getGitHash(): String {
|
|
val stdout = ByteArrayOutputStream()
|
|
exec {
|
|
commandLine = mutableListOf("git", "rev-parse", "--short", "HEAD")
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
}
|
|
|
|
fun Project.gitClone(name: String) {
|
|
val stdout = ByteArrayOutputStream()
|
|
exec {
|
|
commandLine = mutableListOf("git", "clone", name)
|
|
standardOutput = stdout
|
|
}
|
|
}
|