gradle/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/GenSourcesTask.kt

23 lines
773 B
Kotlin
Raw Permalink Normal View History

2022-08-04 11:30:09 +00:00
package com.lagradost.cloudstream3.gradle.tasks
2022-08-04 07:52:23 +00:00
2022-08-04 11:30:09 +00:00
import com.lagradost.cloudstream3.gradle.getCloudstream
2022-08-04 07:52:23 +00:00
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import java.util.function.Function
2022-08-06 10:00:02 +00:00
import java.net.URL
import com.lagradost.cloudstream3.gradle.download
import com.lagradost.cloudstream3.gradle.createProgressLogger
2022-08-04 07:52:23 +00:00
abstract class GenSourcesTask : DefaultTask() {
@TaskAction
fun genSources() {
2022-08-04 07:58:18 +00:00
val extension = project.extensions.getCloudstream()
2022-08-04 07:52:23 +00:00
val apkinfo = extension.apkinfo!!
2022-08-04 09:09:51 +00:00
val sourcesJarFile = apkinfo.cache.resolve("cloudstream-sources.jar")
2022-08-04 07:52:23 +00:00
2022-08-06 10:00:02 +00:00
val url = URL("${apkinfo.urlPrefix}/app-sources.jar")
2022-08-04 07:52:23 +00:00
2022-08-06 10:00:02 +00:00
url.download(sourcesJarFile, createProgressLogger(project, "Download sources"))
2022-08-04 07:52:23 +00:00
}
}