gosu-lang / gradle-gosu-plugin

BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

GosuCompile shouldn't rely on SourceTask.source field #47

Open lptr opened 6 years ago

lptr commented 6 years ago

In getSourceRoots() there is this code that refers to the source field from SourceTask:

    for(Object obj : this.source) {
      if(obj instanceof SourceDirectorySet) {
        returnValues.addAll(((SourceDirectorySet) obj).getSrcDirs());
      }
    }

The source field was exposed before as protected, but we are removing that in Gradle 5.0. Please use getSource() instead.

DPUkyle commented 6 years ago

At first glance, I thought it was just sloppy programming. But there is a reason I originally accessed the field directly - I need the raw values, some of which are instances of SourceDirectorySet.

It's ugly but reflection might be the only solution 👎👎

lptr commented 6 years ago

Why do you need the SourceDirectorySet? Why does gosu need both the source directories and the sources themselves? Could you maybe calculate the source directories by observing the source files (and collecting common root dirs)?

DPUkyle commented 6 years ago

Yes that can work. There are some complicating factors though; I'll be in touch via Slack.

DPUkyle commented 6 years ago

See gradle/gradle#6845