mirror of
https://github.com/recloudstream/gradle.git
synced 2024-08-14 23:56:59 +00:00
use an int for version
This commit is contained in:
parent
0df1fcdf08
commit
c1a4db8a66
4 changed files with 20 additions and 18 deletions
|
@ -38,10 +38,10 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
|
||||||
|
|
||||||
internal var pluginClassName: String? = null
|
internal var pluginClassName: String? = null
|
||||||
|
|
||||||
val description: Property<String> = project.objects.property(String::class.java)
|
var description: String? = null
|
||||||
val authors: ListProperty<String> = project.objects.listProperty(String::class.java)
|
var authors = listOf<String>()
|
||||||
val adult: Property<Boolean> = project.objects.property(Boolean::class.java)
|
var isAdult = false
|
||||||
val status: Property<Int> = project.objects.property(Int::class.java)
|
var status = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
class ApkInfo(extension: CloudstreamExtension, release: String) {
|
class ApkInfo(extension: CloudstreamExtension, release: String) {
|
||||||
|
|
|
@ -8,18 +8,19 @@ import groovy.json.JsonBuilder
|
||||||
fun Project.makeManifest(): PluginManifest {
|
fun Project.makeManifest(): PluginManifest {
|
||||||
val extension = this.extensions.getCloudstream()
|
val extension = this.extensions.getCloudstream()
|
||||||
|
|
||||||
require(this.version != "unspecified") {
|
|
||||||
"No version is set"
|
|
||||||
}
|
|
||||||
|
|
||||||
require(extension.pluginClassName != null) {
|
require(extension.pluginClassName != null) {
|
||||||
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
|
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val version = this.version.toString().toIntOrNull(10)
|
||||||
|
if (version == null) {
|
||||||
|
logger.warn("'${project.version}' is not a valid version. Use an integer.")
|
||||||
|
}
|
||||||
|
|
||||||
return PluginManifest(
|
return PluginManifest(
|
||||||
pluginClassName = extension.pluginClassName,
|
pluginClassName = extension.pluginClassName,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
pluginVersion = this.version.toString(),
|
pluginVersion = version ?: -1,
|
||||||
apiVersion = extension.apiVersion
|
apiVersion = extension.apiVersion
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -27,22 +28,23 @@ fun Project.makeManifest(): PluginManifest {
|
||||||
fun Project.makePluginEntry(): PluginEntry {
|
fun Project.makePluginEntry(): PluginEntry {
|
||||||
val extension = this.extensions.getCloudstream()
|
val extension = this.extensions.getCloudstream()
|
||||||
|
|
||||||
require(this.version != "unspecified") {
|
val version = this.version.toString().toIntOrNull(10)
|
||||||
"No version is set"
|
if (version == null) {
|
||||||
|
logger.warn("'${project.version}' is not a valid version. Use an integer.")
|
||||||
}
|
}
|
||||||
|
|
||||||
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", "builds")),
|
||||||
status = extension.status.getOrElse(3),
|
status = extension.status,
|
||||||
version = this.version.toString(),
|
version = version ?: -1,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
internalName = this.name,
|
internalName = this.name,
|
||||||
authors = extension.authors.getOrElse(listOf()),
|
authors = extension.authors,
|
||||||
description = extension.description.orNull,
|
description = extension.description,
|
||||||
repositoryUrl = (if (repo == null) null else repo.url),
|
repositoryUrl = (if (repo == null) null else repo.url),
|
||||||
isAdult = extension.adult.getOrElse(false),
|
isAdult = extension.isAdult,
|
||||||
apiVersion = extension.apiVersion
|
apiVersion = extension.apiVersion
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ package com.lagradost.cloudstream3.gradle.entities
|
||||||
data class PluginEntry(
|
data class PluginEntry(
|
||||||
val url: String,
|
val url: String,
|
||||||
val status: Int,
|
val status: Int,
|
||||||
val version: String,
|
val version: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
val internalName: String,
|
val internalName: String,
|
||||||
val authors: List<String>,
|
val authors: List<String>,
|
||||||
|
|
|
@ -3,6 +3,6 @@ package com.lagradost.cloudstream3.gradle.entities
|
||||||
data class PluginManifest(
|
data class PluginManifest(
|
||||||
val pluginClassName: String?,
|
val pluginClassName: String?,
|
||||||
val name: String,
|
val name: String,
|
||||||
val pluginVersion: String,
|
val pluginVersion: Int,
|
||||||
val apiVersion: Int
|
val apiVersion: Int
|
||||||
)
|
)
|
Loading…
Reference in a new issue