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

[SUPPORT] After running :project:focus unrelated projects fail to configure #37

Open
Nava2 opened this issue Jul 7, 2023 · 8 comments

Comments

@Nava2
Copy link

Nava2 commented Jul 7, 2023

We're trying to use this plugin in a large repo. However, when the focus is applied, it generates a .focus file and focus.settings.gradle which appears to have all of the expected projects.

Though, when running ./gradlew clean, it attempts to configure projects that are not in the focus file.

I've been debugging this for a few hours and can't produce a minimal reproducible set. Any help would be appreciated in what to track down. If I hazard a guess, there's some Plugin that is pulling in dependencies recursively -- but I am unsure.

@Nava2 Nava2 changed the title After running :project:focus unrelated projects fail to configure [SUPPORT] After running :project:focus unrelated projects fail to configure Jul 8, 2023
@rharter
Copy link
Collaborator

rharter commented Jul 8, 2023 via email

@Nava2
Copy link
Author

Nava2 commented Jul 8, 2023

Oh absolutely I don't think it's caused by the plugin. I'm curious if you've got any suggestions on chasing down the issue. I find it odd that we're getting projects applied that should be unfocused. I'm sure it's in our build, but the gradle logs are keeping their secrets to themselves.

@rharter
Copy link
Collaborator

rharter commented Jul 9, 2023 via email

@Nava2
Copy link
Author

Nava2 commented Jul 9, 2023

I'll verify soon, but that is pretty entertaining that I happened to randomly pick a task that happened to have the clean contract that's incompatible with the entire premise.

I really appreciate the time, I'll have to check this in a few days. I'll close off the issue after I verify. Thank you!

@Nava2
Copy link
Author

Nava2 commented Jul 9, 2023

😢 Seems like that wasn't the issue. I'm unable to import the project into IntelliJ after :focus -- same error. I think I'll have to do some process of elimination with all the different plugins.

@elshad-faire
Copy link

We finally figured out what the issue is. More details in gradle/gradle#27115

In short, the problem is how the include function in settings.gradle.kts works:

"As an example, the path a:b adds a project with path a:b, name b and project directory $rootDir/a/b. It also adds the a project with path :a, name a and project directory $rootDir/a, if it does not exist already."

We have so many cases that a and a:b are both Gradle projects.

I am wondering if the Dropbox team faced this problem. If so how you went about resolving it? cc @rharter

@rharter
Copy link
Collaborator

rharter commented Dec 9, 2023

Hmm, are you saying that you have a project structure like

.
└── a/
    ├── build.gradle
    ├── src/
    │   └── main
    └── b/
        ├── build.gradle
        └── src/
            └── main

And your generated focus.settings.gradle contains include(":a:b"), but you don't want it to include :a and it does?

If so, that's not something we've seen at Dropbox and, unfortunately, I can't even think of a way to work around that. That suggests that there's no way to include project :a:b without including :a, and the point of the Focus plugin is to only include the required projects. If we were to consider :a a "required" project in this case then we would also have to include it's dependencies, and that quickly nullifies any benefit of the Focus plugin.

@elshad-faire
Copy link

Yes you have summarized the problem correctly. And yes this is not a focus plugin issue. It is a gradle issue.

I think this issue can be closed. Maybe action item could be to improve the documentation to mention about this case and then point to the suggestion at gradle/gradle#27115 (comment).

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

3 participants