Move Sources to a target's configurations, and add subclasses for each language

Review Request #3274 - Created Dec. 18, 2015 and submitted

Stu Hood
2634, 2744
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 .java file (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 Sources to 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 extensions property, which could become a default filter on globs for instances of a Sources subclass, but it is currently only used for validation of literal files lists
  • Move Sources to the configurations list for a target, which allows for uniform selection of configuration by type
  • Add a helper to Target to 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?


Stu Hood
Stu Hood
Stu Hood
Stu Hood
Review request changed

Status: Closed (submitted)

Change Summary:

Merged tbr as d04269205613084d0cefe5f947c35c5cbf152404