PEAT Online Course -
How To Improve Your Personal Performance in Java work Technology

  • YOU + CONTROL
  • Focus
  • Autonomy
  • Proficiency
  • Purpose
  • Covid-19!!!
  • Deep Hidden Meaning
  • FREE updates
GET 75% OFF NOW
Your Promo code: TECHLAYOFF
Exclusively on
VIMEO ON-DEMAND

Building ScalaFX 1.0 with Gradle 1.1

28 August 2012 2 comments

2 minutes

429

After becoming a little disenchanted with the SBT for Scala, I wanted an alternative that was more logical, simpler to understand and had a better user experience. After all, the whole point of a domain specific language is to make the writing of the script, formulae or grammar to be affordable to the users. A DSL must be comprehensible to the users, it must be relatively easy to write the script in the language of the domain, and surely must be mostly free of annoyances. The great examples of course are spreadsheets like Excel, the XML Stylesheet Language for Transformations (XSLT) and shell scripts (like DOS, BASH).

I recently added a build.grade file to the ScalaFX project. Here is a screen cast about how to use Gradle build instead of the current SBT file.

Building ScalaFX 1.0 with Gradle 1.1 from Peter Pilgrim on Vimeo.

The only sore point so far, I have found with Gradle, is that the project takes it name from the containing folder. In other words, I found that force setting the artifactId does not work.

group = 'org.scalafx'
artifactId = 'ScalaFX-javaone-2012'  // This does not work
version = '1.0-SNAPSHOT'

That might be worth considering when moving project folders around in order to make a quick research branch for a delta, or look at some other committer’s changes separately from your own.

Because Gradle is written in Groovy, you have the full power of that dynamic language to play with. I was able to write a groovy task to push a UNIX bash launcher script in less than ten minutes. I was also able to run a launcher within Gradle for the Colorful Circles demo app. The Gradle documentation is a lot better than SBT, in my humble opinion.

In SBT, if you missed adding a single blank line between statement declarations, or you forgot to add an extra delimiter between to Seq() or perhaps used the wrong method name “+” versus “++” then you could be lost for quite a long time.

It would good to see how the Scala Plugin for Gradle could work with recently announced Zinc and Incremental Compilation from Typesafe. After reading that blog post, I think Zinc, Gradle and Scala plug-in should just work. Has anyone tried this combination yet? I have not yet.

PS: Under Windows, you need to comment out the “chmod” line in the build.gradle for now. I will fix this later on before the 1.0 release.

PS PS: With the Vimeo, you might prefer to click on the HD option to see improved clarity.

+PP+

2 Comments

  1. Hi Peter,

    thanks for the great posting. Just wanted to let you know that we are planning to add incremental Scala compilation to Gradle 1.3 (which we want to release in roughly 6 weeks).

    Hans

    Comment by Hans Dockter — 10 September 2012 @ 4:33 pm

  2. Hi Hans
    Thanks for commenting here. Incremental Scala compilation to Gradle 1.3 will be fantastic.

    Comment by admin — 10 September 2012 @ 7:13 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Hey all! Thanks for visiting. I provide fringe benefits to interested readers: checkout consultancy, training or mentorship Please make enquiries by email or
call +44 (0)7397 067 658.

Due to the Off-Payroll Working plan for the UK government, I am enforcing stricter measures on contracts. All potential public sector GOV.UK contracts engagements must be approved by QDOS and/or SJD Accounting. Please enquire for further information.