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

31 lines
1.0 KiB
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
2022-08-08 07:48:45 +00:00
fun Project.makeManifest(skipClass: Boolean): PluginManifest {
2022-08-07 19:04:52 +00:00
val extension = this.extensions.getCloudstream()
2022-08-08 06:09:55 +00:00
require(this.version != "unspecified") {
"No version is set"
}
2022-08-08 07:53:41 +00:00
if (!skipClass) {
require(extension.pluginClassName != null) {
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
}
2022-08-08 06:09:55 +00:00
}
2022-08-08 07:53:41 +00:00
2022-08-07 19:04:52 +00:00
return PluginManifest(
2022-08-08 07:40:35 +00:00
pluginClassName = extension.pluginClassName,
2022-08-07 19:04:52 +00:00
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
)
}