typelead/gradle-eta

feature request: multi-module support

Closed this issue · 3 comments

Projects which combine Eta with other JVM languages such as Java will tend to have a multi-module structure in which Eta is used only in certain modules, rather than at the top level or in all modules.

An example is the Semantic Synchrony project (see the Gitter channel for some context). It is currently a pure Java, Maven multiproject; however, I am interested in migrating some core parser and model-view code to Haskell. This code exists only in the 'brain' module of the project, and that is where I would like to use Eta. I have gotten a start in the 'eta' branch by moving to Gradle and using gradle-eta, but I found I had to put the *.cabal file at the top level. The Eta artifacts are also built at the top level. The Haskell code and the gradle-eta dependency, meanwhile, are only in the module.

It would lower the barrier to adoption if it were possible to constrain Eta to one or more modules of a multi-module build. An example multi-module build in the examples directory would be perfect.

@joshsh We found that we were using getRootDir() instead of getProjectDir() which was messing it up for multi-module builds as you discovered. We have pushed a fix on master.

Let us know if you have trouble setting it up. It should be as simple as adding the plugin in the build.gradle of the subproject and running the :[module]:compileEta task. If you have any more suggestions on how to make it smoother, please file more issues.

@joshsh There's an example in examples/multi demonstrating a multi-project build. We've updated the README with clear instructions on how to build the plugin from source. Let us know if you need any assistance.

@joshsh We now have now deployed the plugin to the Gradle Plugin Portal so you should be able to use it easily. See the README for more details.