[GRADLE-287] Provide Scala Plugin Created: 29/Oct/08  Updated: 04/Jan/13  Resolved: 16/Aug/09

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.8

Type: New Feature
Reporter: Ross Black Assignee: Adam Murdoch
Resolution: Fixed Votes: 3

Attachments: Text File scala-plugin-04Nov2008.patch     Text File scala-plugin-29Oct2008.patch    


I know this is not scheduled until after 1.0, but I was playing with scala and gradle and thought that this would be useful.

I have attached a patch that provides code for a plugin to perform Scala compilation and doc generation.
Unfortunately I have run out of time and wont be able to get back to do any more work on this for a while.
Hopefully it provides a reasonable starting point.

The plugin provides the basics for ant tasks and gradle convention tasks.
I have not tested it very thoroughly, but it appears to work OK for the very simple scala project.
The areas that need further work:

  • downloading scala via dependencies, and setting the classpath
  • testing
  • mixed scala/java projects (this is just starting to be supported in 2.7.2)
  • raw (not using ant) implementations of the execution classes.

A few thoughts:

  • I attempted to give the execute methods of the ant tasks a signature that could be the same for the raw (not using ant) implementation.
  • It would be good if compilation (and doc) tasks for all languages/compilers could be the same so that the implementation could be switched easily via configuration, and more code could be re-used across various plugins. This might mean moving properties like 'sourceCompatibility' into each options object (which would be different per compiler?)
  • The ScalaCompile task extends Compile, but that means it gets a lot of properties that are not used. Perhaps a refactor to extract some common properties.

Hope this helps.

Comment by Ross Black [ 04/Nov/08 ]

I have updated the Scala plugin so that it does not require an installation of scala, and gets the libraries it needs via dependencies. The test project now runs successfully for the full pass of compile, test, scaladoc, etc. This is definitely the last work I can do on the plugin for a significant period of time.

I could not submit it in the patch file, but the scalaproject needs junit-4.4.jar in the lib directory (same as javaproject)

I am sure it needs more thorough testing of various options and paths, but the plugin should now be generally usable.

Comment by Ross Black [ 11/Aug/09 ]

I have created a git branch containing the scala plugin updated for the latest (0.7+) gradle code.

Comment by Ross Black [ 15/Aug/09 ]

Some future work for this plugin:

  • Add a chapter to the user guide
  • Cleanup bootclasspath & extdirs options (figure out where they belong)
  • Decide whether to leave defineScalaAnt as a task, or just perform this functionality within each task
  • Implement feedback to indicate that work has been done (ie. files compiled)
  • Allow mixed compilation of scala and java (the scala compiler now allows mutual dependencies between scala and java)
  • Possibly integrate some of the functionality from sbt (http://code.google.com/p/simple-build-tool/) to provide incremental compilation
Comment by Adam Murdoch [ 16/Aug/09 ]

This has been applied to trunk. Thank you for this patch.

Generated at Wed Jun 30 11:26:20 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.