-
Notifications
You must be signed in to change notification settings - Fork 821
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
Gradle hide empty generated folders #4525
Gradle hide empty generated folders #4525
Conversation
a2358fe
to
8e4582e
Compare
@@ -159,7 +160,7 @@ public synchronized SourceGroup[] getSourceGroups(String type) { | |||
for (SourceType st : stype) { | |||
Set<File> processed = new HashSet<>(); | |||
for (String group : gradleSources.keySet()) { | |||
Set<File> dirs = gradleSources.get(group).getSourceDirs(st); | |||
Set<File> dirs = filterEmptyGeneratedDirs(gradleSources.get(group).getSourceDirs(st)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK to filter the empty dirs from the data layer ? I'd rather leave them discoverable (as they are valid source roots), but filter them from the UI only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good insight! Thanks! Moving it to the UI!
25b1a51
to
7ea9599
Compare
@@ -79,7 +97,8 @@ public List<SourceGroup> keys() { | |||
ret.addAll(Arrays.asList(srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA))); | |||
ret.addAll(Arrays.asList(srcs.getSourceGroups(GradleSourcesImpl.SOURCE_TYPE_KOTLIN))); | |||
ret.addAll(Arrays.asList(srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES))); | |||
ret.addAll(Arrays.asList(srcs.getSourceGroups(GradleSourcesImpl.SOURCE_TYPE_GENERATED))); | |||
generatedGroups = Arrays.asList(srcs.getSourceGroups(GradleSourcesImpl.SOURCE_TYPE_GENERATED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: generatedGroups
access is unsynchronized; here, the value should be assigned first to local, then to generatedGroups + added to ret, to be consistent (within this thread). generatedGroups
could be possibly volatile
7ea9599
to
a049d85
Compare
* Fix Gradle resourche watchers not attached on project open * Hide empty generated source dirs * Move the SourceGroup filtering to the UI Cleanup a bunch of raw type error msgs related to TreeSet.
* Fix Gradle resourche watchers not attached on project open * Hide empty generated source dirs * Move the SourceGroup filtering to the UI Cleanup a bunch of raw type error msgs related to TreeSet.
* Fix Gradle resourche watchers not attached on project open * Hide empty generated source dirs * Move the SourceGroup filtering to the UI
When added the support of Generated source directories in Gradle project, the project view become a bit crowded, as the generated folders are always generated by Gradle.
Here there are two empty folder one for java and one for groovy.
Same project with the new code.
While implementing the change, I discovered a bug which prevented the freshly opened project to listen on resource changes. That one is the fist commit.