Skip to content

Commit

Permalink
feat(plugin): update dependency task for LSParanoidTask (#master)
Browse files Browse the repository at this point in the history
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 <opensource@androidacy.com>
  • Loading branch information
androidacy-user committed Oct 15, 2024
1 parent 6c9e8a3 commit ef60ea6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

allprojects {
group = "com.github.Androidacy.LSParanoid"
version = "0.6.15"
version = "0.6.16"

plugins.withType(JavaPlugin::class.java) {
extensions.configure(JavaPluginExtension::class.java) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,18 @@ class LSParanoidPlugin : Plugin<Project> {
LSParanoidTask::output,
)
project.afterEvaluate {
project.tasks.withType(JavaCompile::class.java) { javaCompileTask ->
if (javaCompileTask.name.startsWith("compile${variant.name.replaceFirstChar { it.uppercase() }}")) {
task.configure { it.dependsOn(javaCompileTask) }
}
val dependencyTaskName = if (project.plugins.hasPlugin("com.android.application")) {
"merge${variant.name.replaceFirstChar { it.titlecase() }}Classes"
} else {
"jar" // or bundleLibCompileToJar<VariantName>
}
val dependencyTask = project.tasks.findByName(dependencyTaskName)

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

0 comments on commit ef60ea6

Please sign in to comment.