-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Handle multiple output source directories #12
Conversation
* existing file tree dependency to specified task. And then return the complete fileCollection, contain | ||
* all .class files available for analysis. | ||
*/ | ||
FileCollection presentClassDirs = sourceSet.getOutput().getClassesDirs().filter(File::exists); |
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.
filtering prevents a NoSuchFileException from being throw down in fb/sb internals as it will attempt to access directories even though they don't exist.
A better approach would be to handle this exception where it arises and skip this "potentially" costly operation here.
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.
Almost LGTM, but could you reproduce existing problem by unit test? This change has no test code.
Yeah, I'll look into it when I get back from holidays. :)
13. mar. 2018 02:07 skrev "Kengo TODA" <notifications@github.com>:
… ***@***.**** commented on this pull request.
Almost LGTM, but could you reproduce existing problem by unit test? This
change has no test code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACQQlhtoqw_hGSJUn-cd9O7n49GmhH5mks5tdynKgaJpZM4SU4jU>
.
|
Any progress on this? |
Forgot a bit about it, on paternity leave atm. Picking this up now. Will
update with test coverage latest thursday.
|
@terribleherbst @KengoTODA having some trouble writing tests to replicate the failure scenario / success scenario with the fix. The tests I've written pass succesfully regardles of fix or not, however when I copy the project created by the tests and run the tasks manually through console/IDE, I get the expected results. Simple example of the test I wrote which should "fail". But spotbugsMain task reports Success. `public class IssueTest {
}` Got some idea's ? :) |
I guess the test case should be created in a different way, at least I have a different scenario. I do have the following structure:
Could you try this? |
Any updates? |
Yeah, back @ work now. Will see if I can sort this out over the next couple of days. |
We're running into the same issue in one of our projects where we have modules with mixed Scala/Java code. This is currently a blocker for our migration from FindBugs to SpotBugs. I already verified that this pull request fixes the issue for us, so very interested in seeing this merged. If I can offer any assistance, let me know :) |
@fholger your more than welcome to pitch in here. Writing these test's are doing my head inn. I've been messing about with the gradle testkit, modeling the new test's after the existing tests to no avail. Unit test report: BUILD SUCCESSFUL in 8s Copying the project created from the unit test and running task via IDE/cmd: BUILD SUCCESSFUL in 0s Taken from a run in one of our projects: FAILURE: Build failed with an exception.
BUILD FAILED in 5s So in theory, the unit test SHOULD reply with NO-SOURCE for spotbugsMain, but for some reason it responds with SUCCESS.. Why I havn't been able to figure out, currently my only suspicion is that there is something funky going on with the test kit runnner, cause common sense argues that if it behaves correctly through cmd and IDE execution the only remaining sinner is the test kit runner. @fholger if you have any good idea's I'm all ears. I'm thinking that a solution to this could be to establish a secondary stand alone project within the project running integration tests. So we'll create a sub project which consists of java/scala/groovy/kothlin classes and make the sub project depend on the plugin. This project would then act as the main verification that the plugin acts as advertised. We're doing something similar for our own custom plugin, Thoughts @KengoTODA PS: @terribleherbst that is one of the test cases which should be covered once we get this testing working. But fyi this pull request does handle that. |
@KevinMcT I quickly hacked together a "minimal" sample of the setup we have in our project and put it into a test. It works as expected in that it fails on current master, but works with your fix. Although "minimal" is a bit of a misnomer, since it depends on Scala and thus needs to download Scala packages. Maybe you can replace Scala with something more lightweight, but either way, this is the test I ended up with:
|
@fholger I found the issue. Much to the credit of your example. The gradleRunner seems to ignore the fact that we're specifying a version for the plugin in the buildscript. As such is only uses the available local code. (Which sort of makes sense.) But on the other hand it ruins my initial take on the test. So after conferring with one of my colleagues I think we've found a fair enough test proposal. I'll push a second PR with only the test in it, which will fail. And update this PR with the test as well which will run the test successfully. Given that proof, @KengoTODA I reckon you've got validation to submit this PR. The 2nd failing PR can then be abandoned as there is no point point merging that in first producing an erroneous build just to fix it with a 2nd commit. |
Bah fcked up a bit on the conflict resolution >.< Serves me right for getting so used to gerrit.. |
fbd2165
to
73ced8f
Compare
** SHOULD NOT BE MERGED - ABANDON UPON MERGE OF: PULL#12 ** github.com/spotbugs/pull/12 Commit only contains the tests which verify that the fix contained within pull request spotbugs#12 fixes these issues. These test will fail upon build. Check PR#12 to confirm that the fix results in a succesful build.
@KengoTODA #28 is running without the proposed fix. Hope this is good enough. PS. Don't merge #28 💀 :) |
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.
Fix seems good. Please explain your change in CHANGELOG.md, then we can merge this change.
* Modification to handle changes made in gradle 4.0 - See https://docs.gradle.org/4.0/release-notes.html Location of classes in the build directory
* Added tests corresponding to the Failure PR. Confirming the validity of the fix proposed.
* Updated changelog to include mention of the fix. * Minor addition to .gitignore - Ignore intellij generated project files.
@KengoTODA flow got a bit interrupted as I didn't use a feature branch for this PR. But requested changes have been added and conflicts resolved. Good to merge? 😺 |
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.
LGTM
Location of classes in the build directory