Compare commits

..

No commits in common. "711629926ea541b3dc7c464566ae0d93afb93ed2" and "ec90f79c5b25cd1d41a266c8e28bf33758eeb23e" have entirely different histories.

3 changed files with 14 additions and 53 deletions

View file

@ -16,8 +16,6 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
var repository: Repo? = null
internal set
var buildBranch: String = "builds"
fun overrideUrlPrefix(url: String) {
if (apkinfo == null) {
@ -26,51 +24,16 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
apkinfo!!.urlPrefix = url
}
fun setRepo(user: String, repo: String, url: String, rawLinkFormat: String) {
repository = Repo(user, repo, url, rawLinkFormat)
fun setRepo(user: String, repo: String) {
repository = Repo(user, repo)
}
fun setRepo(user: String, repo: String, type: String) {
when {
type == "github" -> setRepo(user, repo, "https://github.com/${user}/${repo}", "https://raw.githubusercontent.com/${user}/${repo}/%branch%/%filename%")
type == "gitlab" -> setRepo(user, repo, "https://gitlab.com/${user}/${repo}", "https://gitlab.com/${user}/${repo}/-/raw/%branch%/%filename%")
type.startsWith("gitlab-") -> {
val domain = type.removePrefix("gitlab-")
setRepo(user, repo, "https://${domain}/${user}/${repo}", "https://${domain}/${user}/${repo}/-/raw/%branch%/%filename%")
}
type.startsWith("gitea-") -> {
val domain = type.removePrefix("gitea-")
setRepo(user, repo, "https://${domain}/${user}/${repo}", "https://${domain}/${user}/${repo}/raw/branch/%branch%/%filename%")
}
else -> throw IllegalArgumentException("Unknown type ${type}. Use github, gitlab, gitlab-<domain> or gitea-<domain> or set repository via setRepo(user, repo, url, rawLinkFormat)")
}
}
fun setRepo(url: String) {
var type: String? = null
var split = when {
url.startsWith("https://github.com") -> {
type = "github"
url
.removePrefix("https://")
.removePrefix("github.com")
}
url.startsWith("https://gitlab.com") -> {
type = "gitlab"
url
.removePrefix("https://")
.removePrefix("gitlab.com")
}
!url.startsWith("https://") -> { // assume default as github
type = "github"
url
}
else -> throw IllegalArgumentException("Unknown domain, please set repository via setRepo(user, repo, type)")
}
.removePrefix("/")
.removeSuffix("/")
fun setRepo(identifier: String) {
val split = identifier
.removePrefix("https://")
.removePrefix("github.com")
.removeSurrounding("/")
.split("/")
setRepo(split[0], split[1], type)
repository = Repo(split[0], split[1])
}
internal var pluginClassName: String? = null
@ -92,11 +55,12 @@ class ApkInfo(extension: CloudstreamExtension, release: String) {
val jarFile = cache.resolve("cloudstream.jar")
}
class Repo(val user: String, val repo: String, val url: String, val rawLinkFormat: String) {
class Repo(val user: String, val repo: String) {
val url: String
get() = "https://github.com/${user}/${repo}"
fun getRawLink(filename: String, branch: String): String {
return rawLinkFormat
.replace("%filename%", filename)
.replace("%branch%", branch)
return "https://raw.githubusercontent.com/${user}/${repo}/${branch}/${filename}"
}
}

View file

@ -36,7 +36,7 @@ fun Project.makePluginEntry(): PluginEntry {
val repo = extension.repository
return PluginEntry(
url = (if (repo == null) "" else repo.getRawLink("${this.name}.cs3", extension.buildBranch)),
url = (if (repo == null) "" else repo.getRawLink("${this.name}.cs3", "builds")),
status = extension.status,
version = version ?: -1,
name = this.name,

View file

@ -32,7 +32,6 @@ abstract class CompileResourcesTask : Exec() {
executable = aaptExecutable.path
args("compile")
args("--dir", input.asFile.get().path)
args("-v")
args("-o", tmpRes.path)
execute()
}
@ -50,8 +49,6 @@ abstract class CompileResourcesTask : Exec() {
args("-R", tmpRes.path)
args("--manifest", manifestFile.asFile.get().path)
args("--auto-add-overlay")
args("--warn-manifest-validation")
args("-v")
args("-o", outputFile.asFile.get().path)
execute()
}