Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluded modules should not be added to task graph #167

Merged
merged 2 commits into from
Oct 31, 2022

Conversation

joshafeinberg
Copy link
Member

Fixes #159

I believe this fix should handle excluded modules not being added at all to the task graph by checking the configuration before adding it

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Merging #167 (e2bcf44) into main (f041be2) will increase coverage by 0.09%.
The diff coverage is 42.85%.

@@             Coverage Diff              @@
##               main     #167      +/-   ##
============================================
+ Coverage     50.37%   50.46%   +0.09%     
- Complexity       66       67       +1     
============================================
  Files            13       13              
  Lines           532      535       +3     
  Branches         99       99              
============================================
+ Hits            268      270       +2     
- Misses          237      238       +1     
  Partials         27       27              
Impacted Files Coverage Δ
...ctedmoduledetector/AffectedModuleDetectorPlugin.kt 51.45% <42.85%> (+0.45%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

project.pluginManager.withPlugin(pluginId) {
getAffectedPath(testType, project)?.let { path ->
if (AffectedModuleDetector.isProjectProvided(project)) {
if (AffectedModuleDetector.isProjectProvided(project) && !isExcludedModule(config, path)) {
Copy link
Contributor

@Evleaps Evleaps Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can call return before here. Calling afterEvaluate and withPlugin is not necessary in my mind.

value = rootProject.extensions.findByName(AffectedModuleConfiguration.name),
lazyMessage = { "Unable to find ${AffectedTestConfiguration.name} in $rootProject" }
) as AffectedModuleConfiguration
val mainConfiguration = requireConfiguration(rootProject)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method calls quite often in big multymodule projects.

  1. too much boilerplate
  2. DRY
  3. we can do small optimization with singleton

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the changes to task registration this won't be called as often so that isn't a huge deal

  1. Can you explain what you mean by boilerplate? I don't see anything here out of the ordinary
  2. I understand what DRY is, this infact removes duplicate code and fixes a but committed by you (wrong configuration.name)
  3. Extensions is a map meaning looking up by name is a constant time function call, essentially the same as doing it via a singleton. Plus we don't have to worry about the lifecycle of setting the singleton

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recognized your comments in my previous PR. Actually, I was wrong. Thank u for the explanation.

I closed my previous PR, a bit pity my time. But it is the right way.

We can merge your version for solving the problem.

@joshafeinberg joshafeinberg merged commit bc56d36 into main Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

excludedModules is not working with custom task.
3 participants