Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devilune committed Sep 14, 2019
0 parents commit d367189
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*.DS_Store
*.class
*.log
*~

# sbt specific
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
project/local-plugins.sbt
.history
.dotty-ide.json
.dotty-ide-artifact
_site

# Scala-IDE specific
.scala_dependencies
.cache
.classpath
.project
.settings
classes/

# idea
.idea
.idea_modules
/.worksheet/
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
dotty-graalvm.g8
=================
A [Giter8][g8] template for [Dotty] using [GraalVM].

Template usage
--------------
Using `sbt` version `1.3.0`, do:
```
sbt new devilune/dotty-graalvm.g8
```
in the folder where you want to clone the template.

Generated project usage
--------------
Compile
```
sbt compile
```

Run
```
sbt run
```

Test
```
sbt test
```

Building native image
```
sbt graalvm-native-image:packageBin
```

Note:
You need to install [GraalVM] and [GraalVM Native Image].

Edit
```
sbt launchIDE
```

See also [IDE support for Dotty].

Template license
----------------
Written in 2019 by [devilune]

To the extent possible under law, the author(s) have dedicated all copyright and related
and neighboring rights to this template to the public domain worldwide.
This template is distributed without any warranty. See <http://creativecommons.org/publicdomain/zero/1.0/>.

[g8]: http://www.foundweekends.org/giter8/
[Dotty]: http://dotty.epfl.ch/
[IDE support for Dotty]: https://dotty.epfl.ch/docs/usage/ide-support.html
[GraalVM]: https://www.graalvm.org
[GraalVM Native Image]: https://www.graalvm.org/docs/reference-manual/aot-compilation/
[devilune]: https://github.com/devilune
13 changes: 13 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This build is for this Giter8 template.
// To test the template run `g8` or `g8Test` from the sbt session.
// See http://www.foundweekends.org/giter8/testing.html#Using+the+Giter8Plugin for more details.
lazy val root = project
.in(file("."))
.settings(
name := "dotty-graalvm-template",
test in Test := {
val _ = (g8Test in Test).toTask("").value
},
scriptedLaunchOpts ++= List("-Xms1024m", "-Xmx1024m", "-XX:ReservedCodeCacheSize=128m", "-XX:MaxPermSize=256m", "-Xss2m", "-Dfile.encoding=UTF-8"),
resolvers += Resolver.url("typesafe", url("http://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.ivyStylePatterns)
)
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.3.0
1 change: 1 addition & 0 deletions project/giter8.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.11.0")
37 changes: 37 additions & 0 deletions src/main/g8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# sbt project compiled with Dotty using GraalVM

## Usage

Compile
```
sbt compile
```

Run
```
sbt run
```

Test
```
sbt test
```

Building native image
```
sbt graalvm-native-image:packageBin
```

Note:
You need to install [GraalVM] and [GraalVM Native Image].

Edit
```
sbt launchIDE
```

See also [IDE support for Dotty].

[GraalVM]: https://www.graalvm.org
[GraalVM Native Image]: https://www.graalvm.org/docs/reference-manual/aot-compilation/
[IDE support for Dotty]: https://dotty.epfl.ch/docs/usage/ide-support.html
17 changes: 17 additions & 0 deletions src/main/g8/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
val dottyVersion = "0.18.1-RC1"

enablePlugins(GraalVMNativeImagePlugin)
graalVMNativeImageOptions ++= Seq(
"--initialize-at-build-time",
)

lazy val root = project
.in(file("."))
.settings(
name := "dotty-graalvm-simple",
version := "0.1.0",

scalaVersion := dottyVersion,

libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
)
2 changes: 2 additions & 0 deletions src/main/g8/default.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name=Dotty GraalVM Project Template
description=A template to demonstrate a minimal Dotty application using GraalVM
1 change: 1 addition & 0 deletions src/main/g8/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.3.0
2 changes: 2 additions & 0 deletions src/main/g8/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.4.1")
11 changes: 11 additions & 0 deletions src/main/g8/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

object Main {

def main(args: Array[String]): Unit = {
println("Hello world!")
println(msg)
}

def msg = "I was compiled by dotty :)"

}
9 changes: 9 additions & 0 deletions src/main/g8/src/test/scala/Test1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

import org.junit.Test
import org.junit.Assert._

class Test1 {
@Test def t1(): Unit = {
assertEquals("I was compiled by dotty :)", Main.msg)
}
}

0 comments on commit d367189

Please sign in to comment.