-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Fix has_sources. #4792
Fix has_sources. #4792
Conversation
Came across this working #4780 |
65d1463
to
2c9550a
Compare
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.
Thanks John... one potential change.
return self._ref_address | ||
|
||
def has_sources(self, extension=None): | ||
if not self.source_paths: | ||
return False | ||
if not extension: |
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.
Hm... "True if no extension" is an odd case. AFAICT, this method is only used in Target... would probably be good to inline the logic there so that it is more obvious that it is completely overridden by Resources
. Would that also make this check unnecessary?
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.
The logic is actually if source_paths and not extension
; ie at least 1 source and extension doesn't matter - so not so odd? Agreed its hard to read, but it is now tested at least.
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.
Ah, but the inlining makes sense maybe, I'll look at that...
Previously the default implementation failed to handle an extension of None even though it accepted the argument first class. This is fixed with test coverage added and Resources is fixed to delegate to the fixed implementation after performing its special check.
2c9550a
to
d1970e1
Compare
Resources, | ||
sources=Globs.create_fileset_with_spec('resources', '*.rs')) | ||
self.assertFalse(no_resources.has_sources()) | ||
self.assertFalse(no_resources.has_sources('*.java')) |
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.
Confused about the *.java
here. Shouldn't it be just .java
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.
You're right, fixed.
Resources, | ||
sources=Globs.create_fileset_with_spec('resources', '*.java')) | ||
self.assertTrue(resources.has_sources()) | ||
self.assertFalse(resources.has_sources('*.java')) |
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.
Same Q.
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.
Fixed.
Previously the default implementation failed to handle an extension of
None
even though it accepted the argument first class. This is fixed with test
coverage added and
Resources
is fixed to delegate to the fixed implementationafter performing its special check.