mirror of
https://github.com/recloudstream/gradle.git
synced 2024-08-14 23:56:59 +00:00
fix url stuff
This commit is contained in:
parent
2448a204df
commit
a52375b346
2 changed files with 18 additions and 15 deletions
|
@ -17,6 +17,8 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
|
|||
var repository: Repo? = null
|
||||
internal set
|
||||
|
||||
var buildBranch: String = "builds"
|
||||
|
||||
fun overrideUrlPrefix(url: String) {
|
||||
if (apkinfo == null) {
|
||||
apkinfo = ApkInfo(this, "pre-release")
|
||||
|
@ -43,31 +45,32 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
|
|||
}
|
||||
}
|
||||
fun setRepo(url: String) {
|
||||
when {
|
||||
var type: String? = null
|
||||
|
||||
var split = when {
|
||||
url.startsWith("https://github.com") -> {
|
||||
val split = url
|
||||
type = "github"
|
||||
url
|
||||
.removePrefix("https://")
|
||||
.removePrefix("github.com")
|
||||
.removeSurrounding("/")
|
||||
.split("/")
|
||||
setRepo(split[0], split[1], "github")
|
||||
}
|
||||
url.startsWith("https://gitlab.com") -> {
|
||||
val split = url
|
||||
type = "gitlab"
|
||||
url
|
||||
.removePrefix("https://")
|
||||
.removePrefix("gitlab.com")
|
||||
.removeSurrounding("/")
|
||||
.split("/")
|
||||
setRepo(split[0], split[1], "gitlab")
|
||||
}
|
||||
!url.startsWith("https://") -> { // assume default as github
|
||||
val split = url
|
||||
.removeSurrounding("/")
|
||||
.split("/")
|
||||
setRepo(split[0], split[1], "github")
|
||||
type = "github"
|
||||
url
|
||||
}
|
||||
else -> throw IllegalArgumentException("Unknown domain, please set repository via setRepo(user, repo, type)")
|
||||
}
|
||||
.removePrefix("/")
|
||||
.removeSuffix("/")
|
||||
.split("/")
|
||||
|
||||
setRepo(split[0], split[1], type)
|
||||
}
|
||||
|
||||
internal var pluginClassName: String? = null
|
||||
|
|
|
@ -36,7 +36,7 @@ fun Project.makePluginEntry(): PluginEntry {
|
|||
val repo = extension.repository
|
||||
|
||||
return PluginEntry(
|
||||
url = (if (repo == null) "" else repo.getRawLink("${this.name}.cs3", "builds")),
|
||||
url = (if (repo == null) "" else repo.getRawLink("${this.name}.cs3", extension.buildBranch)),
|
||||
status = extension.status,
|
||||
version = version ?: -1,
|
||||
name = this.name,
|
||||
|
|
Loading…
Reference in a new issue