mirror of
https://github.com/recloudstream/gradle.git
synced 2024-08-14 23:56:59 +00:00
fix manifest stuff
This commit is contained in:
parent
c06ce1833e
commit
239a3363cd
4 changed files with 42 additions and 14 deletions
|
@ -8,14 +8,23 @@ 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"
|
||||
}
|
||||
|
||||
|
||||
return PluginManifest(
|
||||
pluginClassName = extension.pluginClassName!!,
|
||||
name = this.name,
|
||||
version = this.version.toString(),
|
||||
authors = extension.authors.get(),
|
||||
repositoryUrl = extension.repositoryUrl.get(),
|
||||
description = extension.description.get(),
|
||||
isAdult = extension.isAdult.get(),
|
||||
status = extension.status.get() ?: 3
|
||||
authors = extension.authors.getOrElse(listOf()),
|
||||
repositoryUrl = extension.repositoryUrl.orNull,
|
||||
description = extension.description.orNull,
|
||||
isAdult = extension.isAdult.getOrElse(false),
|
||||
status = extension.status.getOrElse(3)
|
||||
)
|
||||
}
|
|
@ -7,6 +7,6 @@ data class PluginManifest(
|
|||
val authors: List<String>,
|
||||
val repositoryUrl: String?,
|
||||
val description: String?,
|
||||
val isAdult: Boolean?,
|
||||
val isAdult: Boolean,
|
||||
val status: Int
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
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()
|
||||
)
|
||||
}
|
||||
}
|
|
@ -52,20 +52,12 @@ fun registerTasks(project: Project) {
|
|||
val manifestFile = intermediates.resolve("manifest.json")
|
||||
it.from(manifestFile)
|
||||
it.doFirst {
|
||||
require(project.version != "unspecified") {
|
||||
"No version is set"
|
||||
}
|
||||
|
||||
if (extension.pluginClassName == null) {
|
||||
if (pluginClassFile.exists()) {
|
||||
extension.pluginClassName = pluginClassFile.readText()
|
||||
}
|
||||
}
|
||||
|
||||
require(extension.pluginClassName != null) {
|
||||
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
|
||||
}
|
||||
|
||||
manifestFile.writeText(
|
||||
JsonBuilder(project.makeManifest()).toPrettyString()
|
||||
)
|
||||
|
@ -90,6 +82,11 @@ fun registerTasks(project: Project) {
|
|||
it.group = TASK_GROUP
|
||||
}
|
||||
|
||||
project.tasks.register("dumpManifest", DumpManifestTask::class.java) {
|
||||
it.group = TASK_GROUP
|
||||
it.dependsOn("make")
|
||||
}
|
||||
|
||||
project.tasks.register("deployWithAdb", DeployWithAdbTask::class.java) {
|
||||
it.group = TASK_GROUP
|
||||
it.dependsOn("make")
|
||||
|
|
Loading…
Reference in a new issue