add :makePluginsJson task and set zip to .cs3

This commit is contained in:
C10udburst 2022-08-08 09:32:27 +02:00
parent 239a3363cd
commit b346926f90
2 changed files with 48 additions and 5 deletions

View file

@ -0,0 +1,37 @@
package com.lagradost.cloudstream3.gradle.tasks
import com.lagradost.cloudstream3.gradle.findCloudstream
import com.lagradost.cloudstream3.gradle.makeManifest
import com.lagradost.cloudstream3.gradle.entities.PluginManifest
import groovy.json.JsonBuilder
import groovy.json.JsonGenerator
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.util.LinkedList
abstract class MakePluginsJsonTask : DefaultTask() {
@get:OutputFile
abstract val outputFile: RegularFileProperty
@TaskAction
fun makePluginsJson() {
val lst = LinkedList<PluginManifest>()
for (subproject in project.allprojects) {
val cloudstream = subproject.extensions.findCloudstream() ?: continue
lst.add(subproject.makeManifest())
}
outputFile.asFile.get().writeText(
JsonBuilder(
lst,
JsonGenerator.Options()
.excludeNulls()
.build()
).toString()
)
}
}

View file

@ -18,6 +18,16 @@ fun registerTasks(project: Project) {
val extension = project.extensions.getCloudstream() val extension = project.extensions.getCloudstream()
val intermediates = project.buildDir.resolve("intermediates") val intermediates = project.buildDir.resolve("intermediates")
if (project.rootProject.tasks.findByName("makePluginsJson") == null) {
project.rootProject.tasks.register("makePluginsJson", MakePluginsJsonTask::class.java) {
it.group = TASK_GROUP
it.outputs.upToDateWhen { false }
it.outputFile.set(it.project.buildDir.resolve("plugins.json"))
}
}
project.tasks.register("genSources", GenSourcesTask::class.java) { project.tasks.register("genSources", GenSourcesTask::class.java) {
it.group = TASK_GROUP it.group = TASK_GROUP
} }
@ -69,6 +79,7 @@ fun registerTasks(project: Project) {
//zip.dependsOn(compileResources.get()) //zip.dependsOn(compileResources.get())
zip.isPreserveFileTimestamps = false zip.isPreserveFileTimestamps = false
zip.archiveBaseName.set(project.name) zip.archiveBaseName.set(project.name)
zip.archiveExtension.set("cs3")
zip.archiveVersion.set("") zip.archiveVersion.set("")
zip.destinationDirectory.set(project.buildDir) zip.destinationDirectory.set(project.buildDir)
@ -82,11 +93,6 @@ fun registerTasks(project: Project) {
it.group = TASK_GROUP 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) { project.tasks.register("deployWithAdb", DeployWithAdbTask::class.java) {
it.group = TASK_GROUP it.group = TASK_GROUP
it.dependsOn("make") it.dependsOn("make")