Skip to content

Commit c44c996

Browse files
smarterbiboudis
authored andcommitted
Build with mill
1 parent a753b14 commit c44c996

File tree

6 files changed

+30
-60
lines changed

6 files changed

+30
-60
lines changed

.travis.yml

-8
This file was deleted.

README.md

+23-41
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,51 @@
1-
# Example sbt project that compiles using Dotty
1+
# Example mill project that compiles using Dotty
22

3-
[![Build Status](https://travis-ci.org/lampepfl/dotty-example-project.svg?branch=master)](https://travis-ci.org/lampepfl/dotty-example-project)
3+
**NOTE**: Dotty support in mill is experimental. For now, sbt remains the
4+
preferred option, see http://github.com/lampepfl/dotty-example-project for an
5+
example sbt project.
46

57
## Usage
68

7-
This is a normal sbt project, you can compile code with `sbt compile` and run it
8-
with `sbt run`, `sbt console` will start a Dotty REPL.
9-
10-
If compiling this example project fails, you probably have a global sbt plugin
11-
that does not work with dotty, try to disable all plugins in
12-
`~/.sbt/1.0/plugins` and `~/.sbt/1.0`.
9+
This is a normal mill project, you can compile code with `mill root.compile` and run it
10+
with `mill root.run`, `mill -i root.console` will start a Dotty REPL.
1311

1412
### IDE support
1513

16-
Dotty comes built-in with IDE support, to try it out see
17-
http://dotty.epfl.ch/docs/usage/ide-support.html
18-
19-
## Making a new Dotty project
20-
The fastest way to start a new Dotty project is to use one of the following templates:
21-
* [Simple Dotty project](https://github.com/lampepfl/dotty.g8)
22-
* [Dotty project that cross-compiles with Scala 2](https://github.com/lampepfl/dotty-cross.g8)
14+
Dotty comes built-in with IDE support, unfortunately this support is only
15+
available using sbt and not mill for now, see http://dotty.epfl.ch/docs/usage/ide-support.html
2316

2417
## Using Dotty in an existing project
2518

26-
You will need to make the following adjustments to your build:
27-
28-
### project/plugins.sbt
29-
```scala
30-
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.0")
31-
```
32-
33-
### project/build.properties
34-
```scala
35-
sbt.version=1.2.7
36-
```
37-
38-
Older versions of sbt are not supported.
39-
40-
41-
### build.sbt
42-
Any version number that starts with `0.` is automatically recognized as Dotty by
43-
the `sbt-dotty` plugin, you don't need to set up anything:
19+
### build.sc
20+
Any version number that starts with `0.` is automatically recognized as Dotty,
21+
you don't need to set up anything:
4422

4523
```scala
46-
scalaVersion := "0.13.0-RC1"
24+
def scalaVersion = "0.13.0-RC1"
4725
```
4826

4927
#### Nightly builds
5028
If the latest release of Dotty is missing a bugfix or feature you need, you may
5129
wish to use a nightly build. Look at the bottom of
5230
https://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.14/ to find the version
53-
number for the latest nightly build. Alternatively, you can set `scalaVersion :=
54-
dottyLatestNightlyBuild.get` to always use the latest nightly build of dotty.
31+
number for the latest nightly build.
5532

5633
## Getting your project to compile with Dotty
5734

5835
When porting an existing project, it's a good idea to start out with the Scala 2
5936
compatibility mode (note that this mode affects typechecking and thus may
60-
prevent some valid Dotty code from compiling) by adding to your `build.sbt`:
37+
prevent some valid Dotty code from compiling) by adding to your `build.sc`:
6138

6239
```scala
63-
scalacOptions ++= { if (isDotty.value) Seq("-language:Scala2") else Nil }
40+
def scalacOptions = T {
41+
if (Dep.isDotty(scalaVersion()))
42+
Seq("-language:Scala2")
43+
else
44+
Seq()
45+
}
6446
```
6547

66-
Using the `isDotty` setting ensures that this option will only be set when
48+
Using the `Dep.isDotty` method ensures that this option will only be set when
6749
compiling with Dotty.
6850

6951
A tool to port code from Scala 2.x to Dotty is currently in development at
@@ -73,13 +55,13 @@ If your build contains dependencies that have only been published for Scala 2.x,
7355
you may be able to get them to work on Dotty by replacing:
7456

7557
```scala
76-
libraryDependencies += "a" %% "b" % "c"
58+
ivy"a::b:c"
7759
```
7860

7961
by:
8062

8163
```scala
82-
libraryDependencies += ("a" %% "b" % "c").withDottyCompat(scalaVersion.value)
64+
ivy"a::b:c".withDottyCompat(scalaVersion())
8365
```
8466

8567
Or you can alternatively use:

build.sbt

-9
This file was deleted.

build.sc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import mill._, scalalib._
2+
3+
object root extends SbtModule {
4+
def millSourcePath = ammonite.ops.pwd
5+
def scalaVersion = "0.13.0-RC1"
6+
def publishVersion = "0.1.0"
7+
}

project/build.properties

-1
This file was deleted.

project/plugins.sbt

-1
This file was deleted.

0 commit comments

Comments
 (0)