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