update PluginManifest

This commit is contained in:
C10udburst 2022-08-07 21:04:52 +02:00
parent 7c3e21eaf2
commit c06ce1833e
5 changed files with 31 additions and 15 deletions

View file

@ -21,9 +21,11 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
internal var pluginClassName: String? = null
val updateUrl: Property<String> = project.objects.property(String::class.java)
val sourceUrl: Property<String> = project.objects.property(String::class.java)
val repositoryUrl: Property<String> = project.objects.property(String::class.java)
val description: Property<String> = project.objects.property(String::class.java)
val authors: ListProperty<String> = project.objects.listProperty(String::class.java)
val isAdult: Property<Boolean> = project.objects.property(Boolean::class.java)
val status: Property<Int> = project.objects.property(Int::class.java)
}
class ApkInfo(extension: CloudstreamExtension, release: String) {

View file

@ -0,0 +1,21 @@
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()
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
)
}

View file

@ -5,6 +5,8 @@ data class PluginManifest(
val name: String,
val version: String,
val authors: List<String>,
val sourceUrl: String?,
val updateUrl: String?,
val repositoryUrl: String?,
val description: String?,
val isAdult: Boolean?,
val status: Int
)

View file

@ -17,7 +17,6 @@ abstract class DeployWithAdbTask : DefaultTask() {
@TaskAction
fun deployWithAdb() {
val extension = project.extensions.getCloudstream()
val android = project.extensions.getByName("android") as BaseExtension
AdbServerLauncher(Subprocess(), android.adbExecutable.absolutePath).launch()

View file

@ -2,6 +2,7 @@ package com.lagradost.cloudstream3.gradle.tasks
import com.lagradost.cloudstream3.gradle.getCloudstream
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
import com.lagradost.cloudstream3.gradle.makeManifest
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.tasks.ProcessLibraryManifest
import groovy.json.JsonBuilder
@ -66,16 +67,7 @@ fun registerTasks(project: Project) {
}
manifestFile.writeText(
JsonBuilder(
PluginManifest(
pluginClassName = extension.pluginClassName!!,
name = project.name,
version = project.version.toString(),
authors = extension.authors.get(),
sourceUrl = extension.sourceUrl.get(),
updateUrl = extension.updateUrl.get()
)
).toPrettyString()
JsonBuilder(project.makeManifest()).toPrettyString()
)
}