This commit is contained in:
C10udburst 2022-08-08 09:40:35 +02:00
parent b346926f90
commit b96f8a062e
4 changed files with 12 additions and 7 deletions

View file

@ -5,20 +5,20 @@ import com.lagradost.cloudstream3.gradle.getCloudstream
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
import groovy.json.JsonBuilder
fun Project.makeManifest(): PluginManifest {
fun Project.makeManifest(skipClass: Boolean?): PluginManifest {
val extension = this.extensions.getCloudstream()
require(this.version != "unspecified") {
"No version is set"
}
require(extension.pluginClassName != null) {
require((skipClass == null || !skipClass) && extension.pluginClassName != null) {
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
}
return PluginManifest(
pluginClassName = extension.pluginClassName!!,
pluginClassName = extension.pluginClassName,
name = this.name,
version = this.version.toString(),
authors = extension.authors.getOrElse(listOf()),

View file

@ -1,7 +1,7 @@
package com.lagradost.cloudstream3.gradle.entities
data class PluginManifest(
val pluginClassName: String,
val pluginClassName: String?,
val name: String,
val version: String,
val authors: List<String>,

View file

@ -22,7 +22,7 @@ abstract class MakePluginsJsonTask : DefaultTask() {
for (subproject in project.allprojects) {
val cloudstream = subproject.extensions.findCloudstream() ?: continue
lst.add(subproject.makeManifest())
lst.add(subproject.makeManifest(true))
}
outputFile.asFile.get().writeText(
@ -31,7 +31,7 @@ abstract class MakePluginsJsonTask : DefaultTask() {
JsonGenerator.Options()
.excludeNulls()
.build()
).toString()
).toPrettyString()
)
}
}

View file

@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.gradle.makeManifest
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.tasks.ProcessLibraryManifest
import groovy.json.JsonBuilder
import groovy.json.JsonGenerator
import org.gradle.api.Project
import org.gradle.api.tasks.AbstractCopyTask
import org.gradle.api.tasks.bundling.Zip
@ -69,7 +70,11 @@ fun registerTasks(project: Project) {
}
manifestFile.writeText(
JsonBuilder(project.makeManifest()).toPrettyString()
JsonBuilder(project.makeManifest(),
JsonGenerator.Options()
.excludeNulls()
.build()
).toString()
)
}