-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
95 lines (87 loc) · 3.23 KB
/
build.sbt
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
import scala.sys.process._
import scala.language.postfixOps
import sbtwelcome._
Global / onChangedBuildSource := ReloadOnSourceChanges
Test / scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0"
lazy val mygame =
(project in file("."))
.enablePlugins(ScalaJSPlugin, SbtIndigo)
.settings( // Normal SBT settings
name := "pong",
version := "0.0.1",
scalaVersion := "3.3.0",
organization := "pkg",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "0.7.29" % Test
),
testFrameworks += new TestFramework("munit.Framework"),
scalafixOnCompile := true,
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
.settings( // Indigo specific settings
showCursor := true,
title := "Infinite Pong!",
gameAssetsDirectory := "assets",
windowStartWidth := 550,
windowStartHeight := 400,
disableFrameRateLimit := false,
electronInstall := indigoplugin.ElectronInstall.Latest,
backgroundColor := "black",
libraryDependencies ++= Seq(
"io.indigoengine" %%% "indigo-json-circe" % "0.15.0-RC3",
"io.indigoengine" %%% "indigo" % "0.15.0-RC3",
"io.indigoengine" %%% "indigo-extras" % "0.15.0-RC3"
)
)
.settings(
code := {
val command = Seq("code", ".")
val run = sys.props("os.name").toLowerCase match {
case x if x contains "windows" => Seq("cmd", "/C") ++ command
case _ => command
}
run.!
}
)
.settings(
logo := "Pong (v" + version.value.toString + ")",
usefulTasks := Seq(
UsefulTask("runGame", "Run the game").noAlias,
UsefulTask("buildGame", "Build web version").noAlias,
UsefulTask("runGameFull", "Run the fully optimised game").noAlias,
UsefulTask(
"buildGameFull",
"Build the fully optimised web version"
).noAlias,
UsefulTask("publishGame", "Publish the game to ghpages").noAlias,
UsefulTask("code", "Launch VSCode").noAlias
),
logoColor := scala.Console.MAGENTA,
aliasColor := scala.Console.YELLOW,
commandColor := scala.Console.CYAN,
descriptionColor := scala.Console.WHITE
)
.enablePlugins(GhpagesPlugin) // Website stuff
.settings(
siteSourceDirectory := target.value / "indigoBuildFull",
makeSite / includeFilter := "*",
makeSite / excludeFilter := ".DS_Store",
git.remoteRepo := "[email protected]:davesmith00000/pong.git",
ghpagesNoJekyll := true
)
addCommandAlias(
"publishGame",
List(
"buildGameFull",
"makeSite",
"ghpagesPushSite"
).mkString(";", ";", "")
)
addCommandAlias("buildGame", ";compile;fastOptJS;indigoBuild")
addCommandAlias("buildGameFull", ";compile;fullOptJS;indigoBuildFull")
addCommandAlias("runGame", ";compile;fastOptJS;indigoRun")
addCommandAlias("runGameFull", ";compile;fullOptJS;indigoRunFull")
lazy val code =
taskKey[Unit]("Launch VSCode in the current directory")