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

Affected Projects listing all modules #5

Closed
mshearer123 opened this issue Aug 17, 2020 · 11 comments
Closed

Affected Projects listing all modules #5

mshearer123 opened this issue Aug 17, 2020 · 11 comments

Comments

@mshearer123
Copy link

Hi,

Thanks for this project, I think it's going to make a huge difference to our CI environment.

At the minute running changedModules lists all the modules in the app as affected.
Is there anyway to debug what is going on? I can see logger.isInfoEnabled but not sure how to toggle that.

@ismaeldivita
Copy link
Owner

ismaeldivita commented Aug 17, 2020

Hi @mshearer123
If you enable the Info level you gonna be able to see which files changed, their modules and the impact of the changes.
Just add -i when you run your command

./gradlew testChangesModules -i

Not sure if it's your case, but normally when you're setuping the plugin for the first time, it will trigger the task for all modules since you're modifying the root build.gradle. Next PR's should be fine

@mshearer123
Copy link
Author

mshearer123 commented Aug 18, 2020

Thanks @ismaeldivita

unfortunately we use this sort of code below in settings.gradle to allow modules within folders

file("features").safeListFiles { dir ->
  include("features-${dir.name}")
  project(":features-${dir.name}").projectDir = dir
}

We'll revisit if we can change that

@ismaeldivita
Copy link
Owner

This code seems to just register the modules inside "features" folder automatically. I can't see a problem and this should not impact on the plugin.

The plugin should work fine with nested sub-projects like this.
:app
:foo
:foo:bar
:foo:bar:z

If you could share more details or provide a sample repo reproducing the problem I can take a look.

@mshearer123
Copy link
Author

I think it's the filepath throwing it.
for
/features/feature1

this line in the project locator
(projectPaths.indices).all { projectPaths[it] == filePaths[it] }

will compare features-feature1 with features

This is obviously incorrect, but works for our setup
(projectPaths.indices).all { projectPaths[it] == (filePaths[it] + "-" + filePaths[it + 1]) }

@mshearer123
Copy link
Author

Sample with the issue - https://github.com/mshearer123/ChangeTrackerExample

in branch test with a change in only feature1

output from task

Changed Files
- features/feature2/src/main/java/com/mas/feature2/SecondFragment.kt

Changed Projects
- null

Affected Projects
- project ':app'
- project ':features-feature1'
- project ':features-feature2'

@ismaeldivita
Copy link
Owner

ismaeldivita commented Aug 18, 2020

Got it

I shouldn't use the project path to search for a module, but the projectDir instead.
I'll fix it

@mshearer123
Copy link
Author

mshearer123 commented Aug 18, 2020

@ismaeldivita Brilliant.

One other thing, the remote value, does that expect something like https://github.com/mshearer123/ChangeTrackerExample.git ?

@ismaeldivita
Copy link
Owner

Just the remote name like upstream or origin.

@ismaeldivita
Copy link
Owner

Let me know if 0.7.3 fixes your problem

@mshearer123
Copy link
Author

@ismaeldivita works perfectly, thanks very much

@ismaeldivita
Copy link
Owner

Nice, I'll close this one.

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

No branches or pull requests

2 participants