This commit is contained in:
C10udburst 2022-08-08 09:48:45 +02:00
parent b96f8a062e
commit 90beeee220
3 changed files with 3 additions and 26 deletions

View file

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

View file

@ -1,22 +0,0 @@
package com.lagradost.cloudstream3.gradle.tasks
import com.lagradost.cloudstream3.gradle.getCloudstream
import com.lagradost.cloudstream3.gradle.makeManifest
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.AbstractCopyTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import java.nio.charset.StandardCharsets
import groovy.json.JsonBuilder
abstract class DumpManifestTask : DefaultTask() {
@TaskAction
fun dumpManifest() {
val manifestFile = project.buildDir.resolve("${project.name}.json")
manifestFile.writeText(
JsonBuilder(project.makeManifest()).toPrettyString()
)
}
}

View file

@ -70,7 +70,7 @@ fun registerTasks(project: Project) {
}
manifestFile.writeText(
JsonBuilder(project.makeManifest(),
JsonBuilder(project.makeManifest(false),
JsonGenerator.Options()
.excludeNulls()
.build()