Coder Social home page Coder Social logo

Comments (8)

joshafeinberg avatar joshafeinberg commented on June 28, 2024 1

You shouldn't need that second block. We will create that lintByImpact task for you and internally check if the module is affected. If you delete that this should work properly but feel free to reopen

from affectedmoduledetector.

ss0930 avatar ss0930 commented on June 28, 2024

You shouldn't need that second block. We will create that lintByImpact task for you and internally check if the module is affected. If you delete that this should work properly but feel free to reopen

allprojects {
  tasks.register("lintByImpact") {
    def lintReleaseTask = it.project.tasks.findByName("lintRelease")
    if (lintReleaseTask != null) {
      it.dependsOn(lintReleaseTask)
    }
  }
}

This block is added to have lintByImpact act as a wrapper task around lintRelease. This is done because not every module is configured for lint and may not have lintRelease task. So if a module is affected/changed but does not have lint, then gradle will try to execute lintRelease for that module but fail due to no task available

from affectedmoduledetector.

joshafeinberg avatar joshafeinberg commented on June 28, 2024

This is fixed by #233 and will be part of the next release

from affectedmoduledetector.

ss0930 avatar ss0930 commented on June 28, 2024

@joshafeinberg when is the next release expected to be out?

from affectedmoduledetector.

joshafeinberg avatar joshafeinberg commented on June 28, 2024

Probably in the next week or two

from affectedmoduledetector.

ss0930 avatar ss0930 commented on June 28, 2024

Is there a way to achieve this before the new release is out? Right now I am getting an error because not all modules have lint and adding the second block causes task in all modules to be executed.

from affectedmoduledetector.

ss0930 avatar ss0930 commented on June 28, 2024

Okay, found a work around using a check AffectedModuleDetector.isProjectAffected(it.project). Will use this until the fix is released in the new version.

allprojects {
  tasks.register("lintByImpact") {
    def lintReleaseTask = it.project.tasks.findByName("lintRelease")
    if (lintReleaseTask != null && AffectedModuleDetector.isProjectAffected(it.project)) {
      it.dependsOn(lintReleaseTask)
    }
  }
}

from affectedmoduledetector.

ss0930 avatar ss0930 commented on June 28, 2024

@joshafeinberg The above approach works on a sample project. However, when trying the same in my actual project, I get the following error during sync

Caused by: org.gradle.api.UnknownDomainObjectException: Extension with name 'AffectedModuleDetectorPlugin' does not exist. Currently registered extension names: [..., affectedModuleDetector]
	at org.gradle.internal.extensibility.ExtensionsStorage.unknownExtensionException(ExtensionsStorage.java:144)
	at org.gradle.internal.extensibility.ExtensionsStorage.getByName(ExtensionsStorage.java:123)
	at org.gradle.internal.extensibility.DefaultConvention.getByName(DefaultConvention.java:175)
	at com.dropbox.affectedmoduledetector.AffectedModuleDetector$Companion.getInstance(AffectedModuleDetector.kt:196)
	at com.dropbox.affectedmoduledetector.AffectedModuleDetector$Companion.getOrThrow(AffectedModuleDetector.kt:201)
	at com.dropbox.affectedmoduledetector.AffectedModuleDetector$Companion.isProjectAffected(AffectedModuleDetector.kt:248)
	at com.dropbox.affectedmoduledetector.AffectedModuleDetector.isProjectAffected(AffectedModuleDetector.kt)
	at com.dropbox.affectedmoduledetector.AffectedModuleDetector$isProjectAffected.call(Unknown Source)
	at build_7zf0s7eu8gxds3n6vju1hes3g$_run_closure7$_closure25.doCall

Any idea why I am seeing this error? If I remove the if check AffectedModuleDetector.isProjectAffected(it.project) from the script, sync is successful.

I do have the 2 following imports at the top

import com.dropbox.affectedmoduledetector.AffectedModuleConfiguration
import com.dropbox.affectedmoduledetector.AffectedModuleDetector

from affectedmoduledetector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.