-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mill
More file actions
180 lines (143 loc) · 5.46 KB
/
Copy pathbuild.mill
File metadata and controls
180 lines (143 loc) · 5.46 KB
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
179
180
//| mill-version: 1.1.6
//| mvnDeps:
//| - com.goyeau::mill-git::0.3.2
//| - com.goyeau::mill-scalafix::0.6.0
//| - com.disneystreaming.smithy4s::smithy4s-mill-codegen-plugin::0.19.7
//| - io.github.simple-scala-tooling::smithy-trait-codegen-mill::0.2.0
package build
import com.goyeau.mill.git.GitVersionedPublishModule
import com.goyeau.mill.scalafix.ScalafixModule
import mill._
import mill.javalib._
import mill.javalib.publish._
import mill.scalalib._
import org.scala.abusers.SmithyTraitCodegenPlugin
import smithy4s.codegen.mill._
val jsonrpcVersion = "0.2.0"
val langoustineVersion = "0.1.0"
val smithyVersion = "1.70.0"
trait CommonJavaModule extends JavaModule {
def repositories = Seq(
"https://s01.oss.sonatype.org/content/repositories/snapshots",
"https://s01.oss.sonatype.org/content/repositories/releases",
)
}
trait CommonScalaModule extends ScalaModule with CommonJavaModule with ScalafixModule {
def scalaVersion = "3.3.7"
}
trait CommonPublishModule extends SonatypeCentralPublishModule with GitVersionedPublishModule {
def pomSettings = PomSettings(
description = "Smithy definitions for Language Server Protocol",
organization = "io.github.simple-scala-tooling",
url = "https://github.com/simple-scala-tooling/lsp-smithy",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("simple-scala-tooling", "lsp-smithy"),
developers = Seq(
Developer(
id = "ghostbuster91",
name = "Kasper Kondzielski",
url = "https://github.com/ghostbuster91",
),
Developer(
id = "kubukoz",
name = "Jakub Kozłowski",
url = "https://github.com/kubukoz",
),
),
)
}
object lspSmithyTraits
extends CommonJavaModule
with CommonPublishModule
with SmithyTraitCodegenPlugin.SmithyTraitCodegenSettings {
def artifactName = "lsp-smithy-traits"
def smithyTraitCodegenSourcesDir = Task.Source("resources")
def smithyTraitCodegenJavaPackage = "lsp"
def smithyTraitCodegenNamespace = "lsp"
def smithyTraitCodegenDependencies = Task {
defaultResolver()
.classpath(Seq(
mvn"tech.neander:jsonrpclib-smithy:$jsonrpcVersion".excludeOrg("software.amazon.smithy"),
mvn"com.disneystreaming.alloy:alloy-core:0.3.38".excludeOrg("software.amazon.smithy"),
))
.map(_.path)
}
def mvnDeps = Seq(
mvn"tech.neander:jsonrpclib-smithy:$jsonrpcVersion",
mvn"com.disneystreaming.alloy:alloy-core:0.3.38",
)
}
object lspSmithyDefinitions extends CommonJavaModule with CommonPublishModule {
def artifactName = "lsp-smithy-definitions"
def moduleDeps = Seq(lspSmithyTraits)
def smithySourcesDir = Task.Source("resources")
def resources = Task { Seq(smithySourcesDir()) }
}
object lspSmithy extends CommonScalaModule {
def moduleDeps = Seq(lspSmithyTraits)
def forkEnv = Task {
Map("TARGET_PATH" -> (lspSmithyDefinitions.smithySourcesDir().path / "META-INF" / "smithy").toString)
}
def mainClass = Some("org.scala.abusers.lspsmithy.main")
def mvnDeps = Seq(
mvn"tech.neander::langoustine-meta::$langoustineVersion",
mvn"io.circe::circe-parser:0.14.15",
mvn"com.lihaoyi::os-lib:0.11.4",
mvn"software.amazon.smithy:smithy-model:$smithyVersion",
mvn"tech.neander:jsonrpclib-smithy:$jsonrpcVersion",
mvn"com.disneystreaming.alloy:alloy-core:0.3.38",
)
def scalacOptions = Seq("-Wunused:all")
def updateModelFiles() = Task.Command {
val version = "3.18"
def baseUrl(file: String) =
s"https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/lsp/$version/metaModel/$file"
val schemaFile = "metaModel.schema.json"
val modelFile = "metaModel.json"
val downloadDir = moduleDir / "resources"
val schemaPath = downloadDir / schemaFile
val modelPath = downloadDir / modelFile
Task.log.info(s"Downloading $schemaFile")
os.write.over(schemaPath, scala.io.Source.fromURL(baseUrl(schemaFile)).mkString, createFolders = true)
Task.log.info(s"Downloading $modelFile")
os.write.over(modelPath, scala.io.Source.fromURL(baseUrl(modelFile)).mkString, createFolders = true)
downloadDir
}
object test extends ScalaTests {
def mvnDeps = Seq(
mvn"org.typelevel::weaver-cats:0.12.0",
mvn"org.typelevel::cats-effect:3.7.0",
mvn"software.amazon.smithy:smithy-diff:$smithyVersion",
)
def testFramework = "weaver.framework.CatsEffect"
}
}
object exampleClientSmithy extends CommonScalaModule with Smithy4sModule {
def smithy4sAllowedNamespaces = Some(Set("lsp"))
def moduleDeps = Seq(lspSmithyDefinitions)
def smithy4sIvyDeps = Seq(
mvn"tech.neander:jsonrpclib-smithy:$jsonrpcVersion",
mvn"com.disneystreaming.alloy:alloy-core:0.3.38",
)
def mvnDeps = Seq(
mvn"com.disneystreaming.smithy4s::smithy4s-core:${smithy4sVersion()}",
mvn"tech.neander::jsonrpclib-smithy4s:$jsonrpcVersion",
)
}
object exampleClient extends CommonScalaModule with Smithy4sModule {
def moduleDeps = Seq(exampleClientSmithy, lspSmithy, lspSmithyDefinitions)
def mvnDeps = Seq(
mvn"tech.neander::jsonrpclib-smithy4s:$jsonrpcVersion",
mvn"tech.neander::jsonrpclib-fs2:$jsonrpcVersion",
mvn"co.fs2::fs2-io:3.13.0",
)
def forkEnv = Task {
Map("SERVER_JAR" -> dummyServer.assembly().path.toString)
}
}
object dummyServer extends CommonScalaModule {
def mvnDeps = Seq(
mvn"tech.neander::langoustine-lsp::$langoustineVersion",
mvn"tech.neander::langoustine-app::$langoustineVersion",
)
}