diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt index fee86f0..61c0f88 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt @@ -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()), 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 69fb9b6..3b1ad54 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/entities/PluginManifest.kt @@ -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, diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/MakePluginsJsonTask.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/MakePluginsJsonTask.kt index 6c5a0e3..41ded0e 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/MakePluginsJsonTask.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/MakePluginsJsonTask.kt @@ -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() ) } } \ No newline at end of file diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt index b0361dd..fd69a23 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt @@ -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() ) }