diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/CloudstreamExtension.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/CloudstreamExtension.kt index bee909a..f59498d 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/CloudstreamExtension.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/CloudstreamExtension.kt @@ -38,10 +38,10 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) { internal var pluginClassName: String? = null - val description: Property = project.objects.property(String::class.java) - val authors: ListProperty = project.objects.listProperty(String::class.java) - val adult: Property = project.objects.property(Boolean::class.java) - val status: Property = project.objects.property(Int::class.java) + var description: String? = null + var authors = listOf() + var isAdult = false + var status = 3 } class ApkInfo(extension: CloudstreamExtension, release: String) { diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt index 5360878..51e5bd9 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt @@ -8,18 +8,19 @@ import groovy.json.JsonBuilder fun Project.makeManifest(): PluginManifest { val extension = this.extensions.getCloudstream() - require(this.version != "unspecified") { - "No version is set" - } - require(extension.pluginClassName != null) { "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( pluginClassName = extension.pluginClassName, name = this.name, - pluginVersion = this.version.toString(), + pluginVersion = version ?: -1, apiVersion = extension.apiVersion ) } @@ -27,22 +28,23 @@ fun Project.makeManifest(): PluginManifest { fun Project.makePluginEntry(): PluginEntry { val extension = this.extensions.getCloudstream() - require(this.version != "unspecified") { - "No version is set" + val version = this.version.toString().toIntOrNull(10) + if (version == null) { + logger.warn("'${project.version}' is not a valid version. Use an integer.") } val repo = extension.repository return PluginEntry( url = (if (repo == null) "" else repo.getRawLink("${this.name}.cs3", "builds")), - status = extension.status.getOrElse(3), - version = this.version.toString(), + status = extension.status, + version = version ?: -1, name = this.name, internalName = this.name, - authors = extension.authors.getOrElse(listOf()), - description = extension.description.orNull, + authors = extension.authors, + description = extension.description, repositoryUrl = (if (repo == null) null else repo.url), - isAdult = extension.adult.getOrElse(false), + isAdult = extension.isAdult, apiVersion = extension.apiVersion ) } \ No newline at end of file diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginEntry.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginEntry.kt index 71a0900..2b32b7b 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginEntry.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginEntry.kt @@ -3,7 +3,7 @@ package com.lagradost.cloudstream3.gradle.entities data class PluginEntry( val url: String, val status: Int, - val version: String, + val version: Int, val name: String, val internalName: String, val authors: List, diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt index c176231..20f7aa9 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt @@ -3,6 +3,6 @@ package com.lagradost.cloudstream3.gradle.entities data class PluginManifest( val pluginClassName: String?, val name: String, - val pluginVersion: String, + val pluginVersion: Int, val apiVersion: Int ) \ No newline at end of file