Move Sources to a target's configurations, and add subclasses for each language
Review Request #3274 - Created Dec. 18, 2015 and submitted
|benjyw, ity, jsirois, patricklaw|
Since resources don't have any particular extension, they need to be explicitly marked as being resources. In addition, since it is possible that a user might want to explicitly treat a non-compilable
.javafile (as an example) as a resource, it's important that the JavacPlanner not use (only) the extension to determine the type of a source.
This change uses subclasses of
Sourcesto differentiate between sources of different types/extensions, and moves Sources off of their distinguished place on
Target, and into the configurations list.
- Make Sources abstract, with an
extensionsproperty, which could become a default filter on globs for instances of a
Sourcessubclass, but it is currently only used for validation of literal
- Move Sources to the configurations list for a target, which allows for uniform selection of configuration by type
- Add a helper to
Targetto match configuration by type
- Add ResourcesPlanner to provide a Classpath for Resources
- Add an example java project that consumes resources
One downside of this change is that every useful Target will have at least one
configurations member: I think we're going to want to lower the friction on defining configurations as close to zero as possible, perhaps by having them defined as a repeated parameter on the end of the Target constructor, rather than in a nested list?
Rebased atop r3245
Bit of unrelated flakiness in travis; will be merging --tbr.
Revision 3 (+223 -116)