-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.sbt
215 lines (188 loc) · 11.2 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
val dottyVersion = "3.5.2"
import scala.scalanative.build._
ThisBuild/version := "0.9.23-SNAPSHOT"
ThisBuild/versionScheme := Some("semver-spec")
ThisBuild/resolvers ++= Opts.resolver.sonatypeOssSnapshots
val sharedSettings = Seq(
organization := "com.github.rssh",
scalaVersion := dottyVersion,
name := "dotty-cps-async"
)
lazy val root = project
.in(file("."))
.aggregate(cps.js, cps.jvm, cps.native, compilerPlugin, cpsLoomAddOn, logic.jvm, logic.js, logic.native)
.settings(
Sphinx / sourceDirectory := baseDirectory.value / "docs",
SiteScaladocPlugin.scaladocSettings(CpsJVM, cps.jvm / Compile / packageDoc / mappings, "api/jvm"),
SiteScaladocPlugin.scaladocSettings(CpsJS, cps.js / Compile / packageDoc / mappings, "api/js"),
SiteScaladocPlugin.scaladocSettings(CpsNative, cps.native / Compile / packageDoc / mappings, "api/native"),
SiteScaladocPlugin.scaladocSettings(Root, logic.jvm / Compile / packageDoc / mappings, "api/logic/jvm"),
siteDirectory := baseDirectory.value / "target" / "site",
git.remoteRepo := "[email protected]:rssh/dotty-cps-async.git",
publishArtifact := false,
)
.enablePlugins(SphinxPlugin,
SiteScaladocPlugin,
GhpagesPlugin
).disablePlugins(MimaPlugin)
lazy val cps = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("."))
.settings(sharedSettings)
.disablePlugins(SitePreviewPlugin)
.jvmSettings(
scalacOptions ++= Seq( //"-Yexplicit-nulls",
"-unchecked", "-Ydebug-trace", "-Ydebug-names", "-Xprint-types",
"-Ydebug", "-uniqid", "-Xcheck-macros", "-Ycheck:macro", "-Yprint-syms",
"-Wsafe-init",
),
// -explain
// -Ydebug-error
// -Ydebug-tree-with-id -1
Compile / doc / scalacOptions := Seq("-groups",
"-source-links:shared=github://rssh/dotty-cps-async/master#shared",
"-source-links:jvm=github://rssh/dotty-cps-async/master#jvm"),
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % "test",
mimaPreviousArtifacts := Set("com.github.rssh" %% "dotty-cps-async" % "0.9.21")
).jsSettings(
scalaJSUseMainModuleInitializer := true,
Compile / doc / scalacOptions := Seq("-groups",
"-source-links:shared=github://rssh/dotty-cps-async/master#shared",
"-source-links:js=github://rssh/dotty-cps-async/master#js"),
libraryDependencies += ("org.scala-js" %% "scalajs-junit-test-runtime" % "1.8.0" % Test).cross(CrossVersion.for3Use2_13),
mimaFailOnNoPrevious := false
).nativeSettings(
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test,
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full),
//nativeConfig ~= {
// _.withSourceLevelDebuggingConfig(_.enableAll) // enable generation of debug informations
// .withOptimize(false) // disable Scala Native optimizer
// .withMode(scalanative.build.Mode.debug) // compile using LLVM without optimizations
//}
)
lazy val CpsJVM = config("cps.jvm")
lazy val CpsJS = config("cps.js")
lazy val CpsNative = config("cps.native")
lazy val Root = config("root")
lazy val cpsLoomAddOn = project.in(file("jvm-loom-addon"))
.dependsOn(cps.jvm)
.disablePlugins(SitePreviewPlugin)
.settings(sharedSettings)
.settings(
name := "dotty-cps-async-loom",
scalacOptions ++= Seq("-Xtarget:21", "-explain" /*, "-color:never"*/ ),
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % "test",
)
lazy val cpsLoomTest = project.in(file("jvm-loom-tests"))
.dependsOn(cps.jvm, cpsLoomAddOn)
.disablePlugins(SitePreviewPlugin)
.settings(sharedSettings)
.settings(name := "dotty-cps-async-loom-test")
.settings(
// TODO: remove sources, add dependency from java
//Compile / unmanagedSourceDirectories ++= Seq(
// baseDirectory.value / ".." / "jvm" / "src" / "main" / "scala",
// baseDirectory.value / ".." / "shared" / "src" / "main" / "scala",
//),
Compile / unmanagedSourceDirectories := Seq(),
Test / unmanagedSourceDirectories ++= Seq(
baseDirectory.value / ".." / "jvm" / "src" / "test" / "scala",
baseDirectory.value / ".." / "shared" / "src" / "test" / "scala",
),
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % "test",
Test/fork := true,
//for macos
//Test/javaHome := Some(file("/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home/")),
//for linux:
//Test/javaHome := Some(file("/usr/lib/jvm/jdk-19")),
//now we have jdk
//Test/javaOptions ++= Seq(
// "--enable-preview",
// "--add-modules", "jdk.incubator.concurrent"
//)
)
lazy val compilerPlugin = project.in(file("compiler-plugin"))
.dependsOn(cps.jvm, cps.js)
.settings(sharedSettings)
.disablePlugins(SitePreviewPlugin)
.settings(
name := "dotty-cps-async-compiler-plugin",
libraryDependencies ++= Seq(
"org.scala-lang" %% "scala3-compiler" % scalaVersion.value % "provided",
"com.github.sbt" % "junit-interface" % "0.13.3" % "test",
("org.scala-js" %% "scalajs-linker" % "1.17.0").cross(CrossVersion.for3Use2_13) % "test",
//("org.scala-js" %% "scalajs-ir" % "1.16.0").cross(CrossVersion.for3Use2_13) % "test",
//("org.scala-js" %% "scalajs-library" % "1.16.0").cross(CrossVersion.for3Use2_13) % "test",
("org.scala-js" %% "scalajs-env-nodejs" % "1.4.0").cross(CrossVersion.for3Use2_13) % "test",
),
// TODO: split test into subdirectories.
//Test/scalacOptions ++= {
// val jar = (Compile / packageBin).value
// Seq(s"-Xplugin:${jar.getAbsolutePath}", s"-Jdummy=${jar.lastModified}",
// "-color:never",
// "-explain"
// )
//},
Test/fork := true
)
lazy val compilerPluginTests = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("compiler-plugin-tests"))
.dependsOn(cps)
.jvmConfigure(_.dependsOn(compilerPlugin))
.jsConfigure(_.dependsOn(compilerPlugin))
.nativeConfigure(_.dependsOn(compilerPlugin))
.disablePlugins(SitePreviewPlugin)
.settings(sharedSettings)
.settings(
name := "dotty-cps-compiler-plugin-tests",
libraryDependencies ++= Seq(
"org.scala-lang" %% "scala3-compiler" % scalaVersion.value % "provided",
"com.github.sbt" % "junit-interface" % "0.13.3" % "test",
),
Compile / unmanagedSourceDirectories := Seq(),
Test / unmanagedSourceDirectories ++= Seq(
baseDirectory.value / ".." / ".." / "shared" / "src" / "test" / "scala",
),
Test / scalacOptions ++= {
val jar = (compilerPlugin / Compile / packageBin).value
Seq(s"-Xplugin:${jar.getAbsolutePath}", s"-Jdummy=${jar.lastModified}",
"-color:never",
"-explain",
)
}
).jvmSettings(
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % "test",
Test / unmanagedSourceDirectories ++= Seq(
baseDirectory.value / ".." / ".." / "jvm" / "src" / "test" / "scala",
),
Test / unmanagedSources / excludeFilter := "TestSF1W1.scala" || "TestSL3.scala" || "TestSF4.scala"
).jsSettings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies += ("org.scala-js" %% "scalajs-junit-test-runtime" % "1.8.0" % Test).cross(CrossVersion.for3Use2_13),
mimaFailOnNoPrevious := false,
Test / unmanagedSourceDirectories ++= Seq(
baseDirectory.value / ".." / ".." / "js" / "src" / "test" / "scala",
),
Test / unmanagedSources / excludeFilter := "TestSF1W1.scala" || "TestSL3.scala" || "TestSF4.scala"
).nativeSettings(
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test,
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full),
Test / unmanagedSourceDirectories ++= Seq(
baseDirectory.value / ".." / ".." / "native" / "src" / "test" / "scala"
),
Test / unmanagedSources / excludeFilter := "TestSF1W1.scala" || "TestSL3.scala" || "TestSF4.scala"
)
lazy val logic = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("logic"))
.dependsOn(cps)
.settings(sharedSettings)
.disablePlugins(SitePreviewPlugin)
.settings(
name := "dotty-cps-async-logic",
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % "test",
).jsSettings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies += ("org.scala-js" %% "scalajs-junit-test-runtime" % "1.8.0" % Test).cross(CrossVersion.for3Use2_13),
).nativeSettings(
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test,
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full)
)