-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sc
179 lines (148 loc) · 5.43 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import coursier.Repository
import mill._
import scalalib._
import coursier.maven.MavenRepository
import mill.define.Task
import scala.sys.process.Process
import mill.scalajslib._
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
trait MiksiloPublishModule extends PublishModule {
def publishVersion = "0.1.10"
def pomSettings = PomSettings(
description = "Libraries for modular programming language construction",
organization = "com.github.keyboardDrummer",
url = "https://github.com/keyboardDrummer/Miksilo",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("keyboardDrummer", "Miksilo"),
developers = Seq(
Developer("keyboardDrummer", "Remy Willems", "https://github.com/keyboardDrummer")
)
)
}
trait CommonModule extends ScalaModule {
def scalaVersion = "2.13.1"
override def repositoriesTask: Task[Seq[Repository]] = super.repositoriesTask.map(r => {
r ++ Seq(
// Not sure if this is used
MavenRepository("https://oss.sonatype.org/content/repositories/releases"),
// Not sure if this is used
MavenRepository("https://dl.bintray.com/dhpcs/maven"),
MavenRepository("https://repo1.maven.org/maven2/")
)
})
}
trait CommonMainModule extends CommonModule with MavenModule with MiksiloPublishModule {
override def sources = T.sources(
millSourcePath / "src" / "main" / "java",
millSourcePath / "src" / "main" / "scala",
millSourcePath / os.up / "shared" / "src" / "main" / "java",
millSourcePath / os.up / "shared" / "src" / "main" / "scala"
)
trait MyModuleTests extends ScalaModuleTests with MavenModuleTests {
override def sources = T.sources(
millSourcePath / "src" / "test" / "scala",
millSourcePath / "src" / "test" / "java",
millSourcePath / os.up / "shared" / "src" / "test" / "java",
millSourcePath / os.up / "shared" / "src" / "test" / "scala"
)
override def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.1.1")
def testFrameworks = Seq("org.scalatest.tools.Framework")
}
trait Tests extends MyModuleTests
}
trait CommonScalaJSModule extends ScalaJSModule with CommonMainModule {
def scalaJSVersion = "1.5.0"
trait Tests extends super.Tests with TestScalaJSModule {
def scalaJSVersion = "1.5.0"
override def scalaVersion = "2.13.1"
override def sources = {
T.sources(
millSourcePath / "src" / "test" / "scala",
millSourcePath / "src" / "test" / "java",
)
}
}
}
trait CommonJVMModule extends CommonMainModule {
trait Tests extends super.Tests {
override def scalaVersion = "2.13.1"
}
}
object editorParser extends Module {
object js extends CommonScalaJSModule {
// object test extends Tests
}
object jvm extends CommonJVMModule {
override def ivyDeps = Agg(ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}")
object test extends Tests {
override def moduleDeps = super.moduleDeps
}
}
}
object LSPProtocol extends Module {
object js extends CommonScalaJSModule {
override def ivyDeps = Agg(ivy"com.malliina::play-json::2.8.1")
override def moduleDeps = Seq(editorParser.js)
// object test extends Tests
}
object jvm extends CommonJVMModule {
override def moduleDeps = Seq(editorParser.jvm)
override def ivyDeps = Agg(ivy"com.malliina::play-json:2.8.1")
object test extends Tests {
}
}
}
object languageServer extends Module {
object js extends CommonScalaJSModule {
override def moduleDeps = Seq(LSPProtocol.js)
// object test extends Tests
}
object jvm extends CommonJVMModule {
override def moduleDeps = Seq(LSPProtocol.jvm)
object test extends Tests {
override def moduleDeps = super.moduleDeps ++ Seq(
/* For TestUtils */ editorParser.jvm.test,
/* For SourceUtils */ editorParser.jvm)
}
}
}
object modularLanguages extends Module {
object js extends CommonScalaJSModule with DefinesLanguageServerModule {
override def ivyDeps = Agg(ivy"org.scala-lang.modules::scala-parser-combinators:1.1.2")
override def moduleDeps = super.moduleDeps ++ Seq(languageServer.js)
// object test extends Tests
}
object jvm extends CommonJVMModule with DefinesLanguageServerModule {
override def ivyDeps = Agg(ivy"org.scala-lang.modules::scala-parser-combinators:1.1.2")
override def moduleDeps = Seq(languageServer.jvm)
object test extends Tests {
override def moduleDeps = super.moduleDeps ++ Seq(editorParser.jvm.test)
}
}
}
object playground extends CommonMainModule {
override def moduleDeps = Seq(modularLanguages.jvm)
override def ivyDeps = Agg(
ivy"org.scala-lang.modules::scala-swing:3.0.0",
ivy"com.fifesoft:rsyntaxtextarea:3.0.8",
ivy"org.bidib.org.oxbow:swingbits:1.2.2",
ivy"org.swinglabs:swingx:1.6.1",
ivy"jgraph:jgraph:5.13.0.0",
ivy"org.tinyjee.jgraphx:jgraphx:2.3.0.5",
ivy"org.jgrapht:jgrapht-core:0.9.1",
ivy"org.apache.commons:commons-math3:3.5"
)
}
trait DefinesLanguageServerModule extends ScalaModule {
def extensionPath = os.pwd / "vscode-extension"
def vscodePrePublish() = T.command {
val assemblyPath: PathRef = assembly()
val outPath = extensionPath / "out"
os.copy(assemblyPath.path, outPath / "LanguageServer.jar", replaceExisting = true, createFolders = true)
}
def vscode() = T.command {
vscodePrePublish()()
val vscode = Process(Seq("code", s"--extensionDevelopmentPath=$extensionPath"), None)
vscode.!
}
}