I am new to both Gradle and Dotty (and still relatively new to Scala overall). I was able to create a Scala project with Gradle like this:
gradle init --dsl kotlin --type scala-library --package com.stackoverflow.example
and I know that Dotty can be used with SBT. But is there a way to wire up Dotty with Gradle (yet)?
From inside the new project directory, run the init task using the following command in a terminal: gradle init . When prompted, select the 2: application project type and 5: Scala as implementation language. Next you can choose the DSL for writing buildscripts - 1 : Groovy or 2: Kotlin .
Gradle supports version 1.6. 0 of Zinc and above. The Zinc compiler itself needs a compatible version of scala-library that may be different from the version required by your application. Gradle takes care of specifying a compatible version of scala-library for you.
Introduction. A compiler plugin is a compiler component that lives in a separate JAR file from the main compiler. The compiler can then load that plugin and gain extra functionality. This tutorial briefly walks you through writing a plugin for the Scala compiler.
There’s dotty examples repository with demonstrations of how to build dotty with various build tools including gradle.
https://github.com/michelou/dotty-examples/blob/master/examples/dotty-example-project/build.gradle
As you can see there’s nothing standard yet, but when there will be, I believe maintainers will update this repo.
In my personal project I did something similar to this with some simplifications:
https://github.com/SimY4/xpath-to-xml/blob/master/xpath-to-xml-scala/build-3.gradle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With