mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Add Beta flavor builds
Use Beta tag instead of version check in advanced settings Simplify beta check logic in advanced settings new version app check fixes for beta
This commit is contained in:
parent
4b24dfc9f9
commit
2040462c49
8 changed files with 98 additions and 42 deletions
39
buildSrc/src/main/kotlin/Commands.kt
Normal file
39
buildSrc/src/main/kotlin/Commands.kt
Normal file
|
@ -0,0 +1,39 @@
|
|||
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.getCommitCountSinceLastRelease(): String {
|
||||
val lastTag = runCommand("git describe --tags --abbrev=0")
|
||||
return runCommand("git rev-list --count $lastTag..HEAD").toIntOrNull()?.toString() ?: "1"
|
||||
// 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()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue