mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 10:37:51 +02:00
Use Version Catalog & clean up Gradle files (#6728)
This commit is contained in:
32
buildSrc/src/main/kotlin/Commands.kt
Normal file
32
buildSrc/src/main/kotlin/Commands.kt
Normal file
@ -0,0 +1,32 @@
|
||||
import org.gradle.api.Project
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.TimeZone
|
||||
import java.util.Date
|
||||
|
||||
// Git is needed in your system PATH for these commands to work.
|
||||
// If it's not installed, you can return a random value as a workaround
|
||||
fun Project.getCommitCount(): String {
|
||||
return runCommand("git rev-list --count HEAD")
|
||||
// return "1"
|
||||
}
|
||||
|
||||
fun Project.getGitSha(): String {
|
||||
return runCommand("git rev-parse --short HEAD")
|
||||
// return "1"
|
||||
}
|
||||
|
||||
fun Project.getBuildTime(): String {
|
||||
val df = SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
|
||||
df.timeZone = TimeZone.getTimeZone("UTC")
|
||||
return df.format(Date())
|
||||
}
|
||||
|
||||
fun Project.runCommand(command: String): String {
|
||||
val byteOut = ByteArrayOutputStream()
|
||||
project.exec {
|
||||
commandLine = command.split(" ")
|
||||
standardOutput = byteOut
|
||||
}
|
||||
return String(byteOut.toByteArray()).trim()
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
object BuildPluginsVersion {
|
||||
const val AGP = "7.1.1"
|
||||
const val KOTLIN = "1.6.10"
|
||||
const val KOTLINTER = "3.6.0"
|
||||
const val VERSIONS_PLUGIN = "0.42.0"
|
||||
const val ABOUTLIB_PLUGIN = "8.9.4"
|
||||
}
|
Reference in New Issue
Block a user