AffectedModuleDetector icon indicating copy to clipboard operation
AffectedModuleDetector copied to clipboard

excludedModules is not working with custom task.

Open GianfrancoMS opened this issue 3 years ago • 4 comments

Environment

  • macOS 12.5
  • Gradle 7.5
  • AMD 0.1.6
  • AGP 7.2.1
  • Detekt 1.21.0
  • Java 17
  • Kotlin 1.6.21

Description

I'm integrating AMD into my project and I created two custom tasks. When I run `./gradlew runAffectedDetekt', I'm getting this error even though linter is specified in the excludedModules.

* What went wrong:
Could not determine the dependencies of task ':runAffectedDetekt'.
> Task with path ':linter:detekt' not found in root project 'Rappi-Android-User'.

This error makes sense since Detekt is not applied in the linter module; however, it should be ignored by AMD if it's specified in the excluded modules.

Configuration

    import com.dropbox.affectedmoduledetector.AffectedModuleConfiguration

    apply plugin: "com.dropbox.affectedmoduledetector"

    def branch = System.getenv('DESTINATION_BRANCH')
    if (!branch) {
        branch = "origin/develop"
    }

    logger.lifecycle("Destination branch: $branch")

    affectedModuleDetector {
        baseDir = "${project.rootDir}"
        pathsAffectingAllModules = [
                "tools/global-dependencies.gradle"
        ]
        logFilename = "output.log"
        logFolder = "${project.rootDir}"
        specifiedBranch = "$branch"
        compareFrom = "SpecifiedBranchCommit"
        excludedModules = ["linter", ":linter"]
        customTasks = [
                new AffectedModuleConfiguration.CustomTask(
                        "runAffectedDetekt,
                        "detekt",
                        "Run detekt"
                ),
                new AffectedModuleConfiguration.CustomTask(
                        "runAffectedAndroidLint",
                        "lintDebug",
                        "Run lint"
                ),
        ]

GianfrancoMS avatar Aug 02 '22 00:08 GianfrancoMS

Hey! Sorry for a long ansver. I'll try to reproduce this issue later and fix it. I let u know the results of my invistigation.

Evleaps avatar Aug 26 '22 17:08 Evleaps

Hey! I couldn't reproduce your issue unfortunately. But I have hipotetical solution for it.

But, @GianfrancoMS can you create sample project with this issue for me? It helps me to test my hipotetical solution and debug problem.

Evleaps avatar Aug 29 '22 15:08 Evleaps

Hey! I'll try to reproduce it in a differente repo as soon as I can, I'll let you know.

GianfrancoMS avatar Sep 22 '22 16:09 GianfrancoMS

Unfortunately, I could not reproduce it in a different repo; I can only reproduce it in my work's project

GianfrancoMS avatar Oct 04 '22 23:10 GianfrancoMS