Skip to content

Commit ef60ea6

Browse files
feat(plugin): update dependency task for LSParanoidTask (#master)
Improve LSParanoidTask dependency configuration: - Use merge classes or jar task instead of compile tasks - Handle cases where dependency task is not found - Update version to 0.6.16 Signed-off-by: androidacy-user <[email protected]>
1 parent 6c9e8a3 commit ef60ea6

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010

1111
allprojects {
1212
group = "com.github.Androidacy.LSParanoid"
13-
version = "0.6.15"
13+
version = "0.6.16"
1414

1515
plugins.withType(JavaPlugin::class.java) {
1616
extensions.configure(JavaPluginExtension::class.java) {

gradle-plugin/src/main/java/org/lsposed/lsparanoid/plugin/LSParanoidPlugin.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ class LSParanoidPlugin : Plugin<Project> {
5656
LSParanoidTask::output,
5757
)
5858
project.afterEvaluate {
59-
project.tasks.withType(JavaCompile::class.java) { javaCompileTask ->
60-
if (javaCompileTask.name.startsWith("compile${variant.name.replaceFirstChar { it.uppercase() }}")) {
61-
task.configure { it.dependsOn(javaCompileTask) }
62-
}
59+
val dependencyTaskName = if (project.plugins.hasPlugin("com.android.application")) {
60+
"merge${variant.name.replaceFirstChar { it.titlecase() }}Classes"
61+
} else {
62+
"jar" // or bundleLibCompileToJar<VariantName>
6363
}
64+
val dependencyTask = project.tasks.findByName(dependencyTaskName)
6465

65-
project.tasks.withType(KotlinCompile::class.java) { kotlinCompileTask ->
66-
if (kotlinCompileTask.name.startsWith("compile${variant.name.replaceFirstChar { it.uppercase() }}")) {
67-
task.configure { it.dependsOn(kotlinCompileTask) }
68-
}
66+
if (dependencyTask != null) {
67+
task.configure { it.dependsOn(dependencyTask) }
68+
} else {
69+
// Handle the case where the dependency task is not found, maybe throw an error or log a warning
70+
project.logger.warn("Dependency task '$dependencyTaskName' not found for LSParanoid plugin")
6971
}
7072
}
7173
}

0 commit comments

Comments
 (0)