Generate repo name at build time

This commit is contained in:
FooIbar authored and tarsin committed 2023-07-10 22:13:55 +08:00
1 parent 4ca7b6b11c
commit fb6cb8d3fb
2 files changed
+15 -3

No files matched your search

+11
View File
@@ -61,6 +61,16 @@ android {
formatter.format(Instant.now())
}
val repoName by lazy {
val stdout = ByteArrayOutputStream()
exec {
commandLine = "git remote get-url origin".split(' ')
standardOutput = stdout
}
stdout.toString().trim().removePrefix("https://github.com/").removePrefix("git@github.com:")
.removeSuffix(".git")
}
defaultConfig {
applicationId = "moe.tarsin.ehviewer"
minSdk = 28
@@ -85,6 +95,7 @@ android {
)
buildConfigField("String", "COMMIT_SHA", "\"$commitSha\"")
buildConfigField("String", "BUILD_TIME", "\"$buildTime\"")
buildConfigField("String", "REPO_NAME", "\"$repoName\"")
}
externalNativeBuild {
@@ -54,9 +54,10 @@ import tachiyomi.data.release.GithubWorkflowRuns
import java.io.File
import java.util.zip.ZipInputStream
private const val REPO_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer"
private const val API_URL = "https://api.github.com/repos/Ehviewer-Overhauled/Ehviewer"
private const val RELEASE_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer/releases"
private const val REPO_NAME = BuildConfig.REPO_NAME
private const val REPO_URL = "https://github.com/$REPO_NAME"
private const val API_URL = "https://api.github.com/repos/$REPO_NAME"
private const val RELEASE_URL = "$REPO_URL/releases"
@Composable
@Stable