-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sc
109 lines (86 loc) · 2.37 KB
/
build.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import scala.util.Success
import scala.util.Try
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import mill._
import mill.scalalib._
import mill.scalajslib._
import mill.scalajslib.api._
import mill.scalalib.scalafmt._
import coursier.maven.MavenRepository
import $ivy.`io.indigoengine::mill-indigo:0.15.2`, millindigo._
import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.5`
import io.github.davidgregory084.TpolecatModule
object snake extends MillIndigo with TpolecatModule with ScalafmtModule {
def scalaVersion = "3.3.1"
def scalaJSVersion = "1.14.0"
val indigoOptions: IndigoOptions =
IndigoOptions.defaults
.withTitle("Snake - Made with Indigo")
.withWindowWidth(720)
.withWindowHeight(516)
.withBackgroundColor("black")
.excludeAssets {
case p if p.startsWith(os.RelPath("asset_dev")) => true
case _ => false
}
val indigoGenerators: IndigoGenerators =
IndigoGenerators("snake.generated")
.listAssets("Assets", indigoOptions.assets)
.generateConfig("SnakeConfig", indigoOptions)
def buildGame() = T.command {
T {
compile()
fastLinkJS()
indigoBuild()()
}
}
def buildGameFull() = T.command {
T {
compile()
fullLinkJS()
indigoBuildFull()()
}
}
def runGame() = T.command {
T {
compile()
fastLinkJS()
indigoRun()()
}
}
def runGameFull() = T.command {
T {
compile()
fullLinkJS()
indigoRunFull()()
}
}
val indigoVersion = "0.15.2"
def ivyDeps = Agg(
ivy"io.indigoengine::indigo-json-circe::$indigoVersion",
ivy"io.indigoengine::indigo::$indigoVersion",
ivy"io.indigoengine::indigo-extras::$indigoVersion"
)
object test extends ScalaJSTests {
def ivyDeps = Agg(
ivy"org.scalameta::munit::0.7.29"
)
def testFramework = "munit.Framework"
override def moduleKind = T(mill.scalajslib.api.ModuleKind.CommonJSModule)
}
def publishGame() = T.command {
val docs = os.pwd / "docs"
if (os.exists(docs)) {
os.remove.all(docs)
}
os.makeDir.all(docs)
val outPath = os.pwd / "docs"
os.makeDir.all(outPath)
val buildDir = os.pwd / "out" / "snake" / "indigoBuildFull.dest"
os.list(buildDir)
.toList
.foreach { p =>
os.copy(p, outPath / p.last)
}
}
}