mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
Load extensions from subdirectories
This commit is contained in:
parent
6adcf61daa
commit
20895f2ef6
@ -59,7 +59,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
// should be bumped with each stable release
|
||||
val inspectorVersion = "v0.5.1"
|
||||
val inspectorVersion = "v0.6.0"
|
||||
|
||||
// counts commit count on master
|
||||
val inspectorRevision = runCatching {
|
||||
@ -108,7 +108,8 @@ tasks {
|
||||
freeCompilerArgs = listOf(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
|
||||
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
||||
"-Xopt-in=kotlin.io.path.ExperimentalPathApi",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,13 @@ import kotlinx.serialization.json.Json
|
||||
import mu.KotlinLogging
|
||||
import suwayomi.tachidesk.manga.impl.extension.Extension.installAPK
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.extension
|
||||
import kotlin.streams.toList
|
||||
|
||||
object InspectorMain {
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
suspend fun inspectorMain(args: Array<String>) {
|
||||
@ -28,16 +33,15 @@ object InspectorMain {
|
||||
val tmpDirPath = args[2]
|
||||
|
||||
val tmpDir = File(tmpDirPath, "tmp").also { it.mkdir() }
|
||||
val extensions = File(apksPath).listFiles().orEmpty().mapNotNull {
|
||||
if (it.extension == "apk") {
|
||||
logger.info("Installing ${it.absolutePath}")
|
||||
|
||||
val (pkgName, sources) = installAPK(tmpDir) {
|
||||
it
|
||||
}
|
||||
val extensions = Files.find(Paths.get(apksPath), 2, { _, fileAttributes -> fileAttributes.isRegularFile })
|
||||
.filter { it.extension == "apk" }
|
||||
.toList()
|
||||
.map {
|
||||
logger.info("Installing $it")
|
||||
val (pkgName, sources) = installAPK(tmpDir) { it.toFile() }
|
||||
pkgName to sources.map { source -> SourceJson(source) }
|
||||
} else null
|
||||
}.toMap()
|
||||
}
|
||||
.toMap()
|
||||
|
||||
File(outputPath).writeText(Json.encodeToString(extensions))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user