gradle/src/main/kotlin/com/lagradost/cloudstream3/gradle/Utils.kt

30 lines
984 B
Kotlin
Raw Normal View History

2022-08-07 19:04:52 +00:00
package com.lagradost.cloudstream3.gradle
import org.gradle.api.Project
import com.lagradost.cloudstream3.gradle.getCloudstream
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
import groovy.json.JsonBuilder
fun Project.makeManifest(): PluginManifest {
val extension = this.extensions.getCloudstream()
2022-08-08 06:09:55 +00:00
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"
}
2022-08-07 19:04:52 +00:00
return PluginManifest(
pluginClassName = extension.pluginClassName!!,
name = this.name,
version = this.version.toString(),
2022-08-08 06:09:55 +00:00
authors = extension.authors.getOrElse(listOf()),
repositoryUrl = extension.repositoryUrl.orNull,
description = extension.description.orNull,
isAdult = extension.isAdult.getOrElse(false),
status = extension.status.getOrElse(3)
2022-08-07 19:04:52 +00:00
)
}