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
|
var repository: Repo? = null
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
|
var buildBranch: String = "builds"
|
||||||
|
|
||||||
fun overrideUrlPrefix(url: String) {
|
fun overrideUrlPrefix(url: String) {
|
||||||
if (apkinfo == null) {
|
if (apkinfo == null) {
|
||||||
apkinfo = ApkInfo(this, "pre-release")
|
apkinfo = ApkInfo(this, "pre-release")
|
||||||
|
@ -43,31 +45,32 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun setRepo(url: String) {
|
fun setRepo(url: String) {
|
||||||
when {
|
var type: String? = null
|
||||||
url.startsWith("https://github.com") -> {
|
|
||||||
val split = url
|
var split = when {
|
||||||
|
url.startsWith("https://github.com") -> {
|
||||||
|
type = "github"
|
||||||
|
url
|
||||||
.removePrefix("https://")
|
.removePrefix("https://")
|
||||||
.removePrefix("github.com")
|
.removePrefix("github.com")
|
||||||
.removeSurrounding("/")
|
|
||||||
.split("/")
|
|
||||||
setRepo(split[0], split[1], "github")
|
|
||||||
}
|
}
|
||||||
url.startsWith("https://gitlab.com") -> {
|
url.startsWith("https://gitlab.com") -> {
|
||||||
val split = url
|
type = "gitlab"
|
||||||
|
url
|
||||||
.removePrefix("https://")
|
.removePrefix("https://")
|
||||||
.removePrefix("gitlab.com")
|
.removePrefix("gitlab.com")
|
||||||
.removeSurrounding("/")
|
|
||||||
.split("/")
|
|
||||||
setRepo(split[0], split[1], "gitlab")
|
|
||||||
}
|
}
|
||||||
!url.startsWith("https://") -> { // assume default as github
|
!url.startsWith("https://") -> { // assume default as github
|
||||||
val split = url
|
type = "github"
|
||||||
.removeSurrounding("/")
|
url
|
||||||
.split("/")
|
|
||||||
setRepo(split[0], split[1], "github")
|
|
||||||
}
|
}
|
||||||
else -> throw IllegalArgumentException("Unknown domain, please set repository via setRepo(user, repo, type)")
|
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
|
internal var pluginClassName: String? = null
|
||||||
|
|
|
@ -36,7 +36,7 @@ fun Project.makePluginEntry(): PluginEntry {
|
||||||
val repo = extension.repository
|
val repo = extension.repository
|
||||||
|
|
||||||
return PluginEntry(
|
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,
|
status = extension.status,
|
||||||
version = version ?: -1,
|
version = version ?: -1,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
|
|
Loading…
Reference in a new issue