From 86ede2f2051e5d4b22a3200fe40b85141a6e4c23 Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Thu, 21 Sep 2023 18:08:36 -0300 Subject: [PATCH] feat(multisrc): Make specific multisrc generation easier for gradle CLI bros --- multisrc/build.gradle.kts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/multisrc/build.gradle.kts b/multisrc/build.gradle.kts index cd231c70a3..4d2fdb4959 100644 --- a/multisrc/build.gradle.kts +++ b/multisrc/build.gradle.kts @@ -38,9 +38,23 @@ tasks { register("generateExtensions") { classpath = configurations.compileOnly.get() + configurations.androidApis.get() + // android.jar path - files("$buildDir/intermediates/aar_main_jar/debug/classes.jar") // jar made from this module + layout.buildDirectory.files("intermediates/aar_main_jar/debug/classes.jar") // jar made from this module + + // Default generator class, generates extensions for all themes. mainClass.set("generator.GeneratorMainKt") + // Only generate extensions from a specified theme. + if (project.hasProperty("theme")) { + val theme = project.property("theme") + val themeDir = file("src/main/java/eu/kanade/tachiyomi/multisrc/$theme") + if (themeDir.isDirectory) { + val className = themeDir.list()!! + .first { it.endsWith("Generator.kt") } + .removeSuffix(".kt") + mainClass.set("eu.kanade.tachiyomi.multisrc.$theme.$className") + } + } + workingDir = workingDir.parentFile // project root errorOutput = System.out // for GitHub workflow commands