-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
30 lines (22 loc) · 871 Bytes
/
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
name := "kwin-popups-behaviour"
scalaVersion := "3.4.2"
enablePlugins(ScalaJSPlugin)
scalaJSUseMainModuleInitializer := true
semanticdbEnabled := true
scalacOptions ++= Seq("-rewrite", "-source", "3.4-migration")
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.8.0",
)
lazy val prepareKwinScript = taskKey[Unit]("prepares the script for kwin")
prepareKwinScript := {
import java.nio.file._
import scala.collection.JavaConverters._
val srcFile = (Compile / fastOptJS).value.data
val methodsToInhibit = Seq("freeze", "isSealed")
val scriptLines = Files.readAllLines(srcFile.toPath, IO.utf8).asScala.map {
case l if methodsToInhibit.exists(m => l.contains(s"""["$m"]""")) => "// " + l
case other => other
}
val dstFile = srcFile.getParentFile / "kwin-script.js"
Files.write(dstFile.toPath, scriptLines.asJava, IO.utf8)
}