mirror of
https://github.com/recloudstream/gradle.git
synced 2024-08-14 23:56:59 +00:00
fix
This commit is contained in:
parent
b346926f90
commit
b96f8a062e
4 changed files with 12 additions and 7 deletions
|
@ -5,20 +5,20 @@ import com.lagradost.cloudstream3.gradle.getCloudstream
|
||||||
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
|
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
|
||||||
import groovy.json.JsonBuilder
|
import groovy.json.JsonBuilder
|
||||||
|
|
||||||
fun Project.makeManifest(): PluginManifest {
|
fun Project.makeManifest(skipClass: Boolean?): PluginManifest {
|
||||||
val extension = this.extensions.getCloudstream()
|
val extension = this.extensions.getCloudstream()
|
||||||
|
|
||||||
require(this.version != "unspecified") {
|
require(this.version != "unspecified") {
|
||||||
"No version is set"
|
"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"
|
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return PluginManifest(
|
return PluginManifest(
|
||||||
pluginClassName = extension.pluginClassName!!,
|
pluginClassName = extension.pluginClassName,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
version = this.version.toString(),
|
version = this.version.toString(),
|
||||||
authors = extension.authors.getOrElse(listOf()),
|
authors = extension.authors.getOrElse(listOf()),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.gradle.entities
|
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 version: String,
|
val version: String,
|
||||||
val authors: List<String>,
|
val authors: List<String>,
|
||||||
|
|
|
@ -22,7 +22,7 @@ abstract class MakePluginsJsonTask : DefaultTask() {
|
||||||
for (subproject in project.allprojects) {
|
for (subproject in project.allprojects) {
|
||||||
val cloudstream = subproject.extensions.findCloudstream() ?: continue
|
val cloudstream = subproject.extensions.findCloudstream() ?: continue
|
||||||
|
|
||||||
lst.add(subproject.makeManifest())
|
lst.add(subproject.makeManifest(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFile.asFile.get().writeText(
|
outputFile.asFile.get().writeText(
|
||||||
|
@ -31,7 +31,7 @@ abstract class MakePluginsJsonTask : DefaultTask() {
|
||||||
JsonGenerator.Options()
|
JsonGenerator.Options()
|
||||||
.excludeNulls()
|
.excludeNulls()
|
||||||
.build()
|
.build()
|
||||||
).toString()
|
).toPrettyString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.gradle.makeManifest
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.build.gradle.tasks.ProcessLibraryManifest
|
import com.android.build.gradle.tasks.ProcessLibraryManifest
|
||||||
import groovy.json.JsonBuilder
|
import groovy.json.JsonBuilder
|
||||||
|
import groovy.json.JsonGenerator
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.tasks.AbstractCopyTask
|
import org.gradle.api.tasks.AbstractCopyTask
|
||||||
import org.gradle.api.tasks.bundling.Zip
|
import org.gradle.api.tasks.bundling.Zip
|
||||||
|
@ -69,7 +70,11 @@ fun registerTasks(project: Project) {
|
||||||
}
|
}
|
||||||
|
|
||||||
manifestFile.writeText(
|
manifestFile.writeText(
|
||||||
JsonBuilder(project.makeManifest()).toPrettyString()
|
JsonBuilder(project.makeManifest(),
|
||||||
|
JsonGenerator.Options()
|
||||||
|
.excludeNulls()
|
||||||
|
.build()
|
||||||
|
).toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue