-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
117 lines (99 loc) · 4.25 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
import Dependencies.*
import JSEnv.{Chrome, Firefox, NodeJS}
import org.scalajs.linker.interface.ModuleKind.ESModule
import org.scalajs.linker.interface.OutputPatterns
import sbt.Keys.description
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
import org.scalajs.jsenv.nodejs.NodeJSEnv
import sbt.ThisBuild
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.{ChromeDriver, ChromeOptions}
import org.openqa.selenium.firefox.{FirefoxOptions, FirefoxProfile}
import org.openqa.selenium.remote.server.{DriverFactory, DriverProvider}
import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "rdf.model.js"
ThisBuild / tlBaseVersion := "0.2"
ThisBuild / tlUntaggedAreSnapshots := true
ThisBuild / organization := "net.bblfish.rdf"
ThisBuild / organizationName := "Henry Story"
ThisBuild / startYear := Some(2021)
ThisBuild / developers := List(
tlGitHubDev("bblfish", "Henry Story")
)
enablePlugins(TypelevelCiReleasePlugin)
enablePlugins(TypelevelSonatypePlugin)
ThisBuild / tlCiReleaseBranches := Seq()
ThisBuild / tlCiReleaseTags := false // don't publish artifacts on github
ThisBuild / crossScalaVersions := Seq("3.1.1")
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
tlReplaceCommandAlias("ciJS", List(CI.NodeJS, CI.Firefox, CI.Chrome).mkString)
addCommandAlias("ciNodeJS", CI.NodeJS.toString)
addCommandAlias("ciFirefox", CI.Firefox.toString)
addCommandAlias("ciChrome", CI.Chrome.toString)
addCommandAlias("prePR", "; root/clean; scalafmtSbt; +root/scalafmtAll; +root/headerCreate")
lazy val useJSEnv =
settingKey[JSEnv]("Use Node.js or a headless browser for running Scala.js tests")
Global / useJSEnv := NodeJS
ThisBuild / Test / jsEnv := {
val old = (Test / jsEnv).value
useJSEnv.value match {
case NodeJS => old
case Firefox =>
val options = new FirefoxOptions()
options.setHeadless(true)
new SeleniumJSEnv(options)
case Chrome =>
val options = new ChromeOptions()
options.setHeadless(true)
new SeleniumJSEnv(options)
}
}
//ThisBuild / githubWorkflowBuildPreamble ++= Seq(
// WorkflowStep.Use(
// UseRef.Public("actions", "setup-node", "v2.4.0"),
// name = Some("Setup NodeJS v14 LTS"),
// params = Map("node-version" -> "14"),
// cond = Some("matrix.ci == 'ciJS'")
// )
//)
ThisBuild / homepage := Some(url("https://github.com/bblfish/rdf.scala.js"))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/bblfish/rdf.scala.js"), "git@github.com:bblfish/rdf.scala.js.git")
)
tlReplaceCommandAlias("ciJS", List(CI.Chrome, CI.Firefox).mkString)
addCommandAlias("ciFirefox", CI.Firefox.toString)
ThisBuild / scalaVersion := Ver.scala3
ThisBuild / organization := "net.bblfish.rdf"
headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax
lazy val commonSettings = Seq(
description := "rdf models for JS from https://rdf.js.org",
startYear := Some(2021),
updateOptions := updateOptions.value.withCachedResolution(
true
) // to speed up dependency resolution
)
lazy val rdfModelJS = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
// documentation here: https://scalablytyped.org/docs/library-developer
// call stImport in sbt to generate new sources
.settings(commonSettings*)
.settings(
scalacOptions ++= scala3jsOptions,
scalaJSUseMainModuleInitializer := true,
// https://github.com/com-lihaoyi/utest
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.7.10" % "test",
testFrameworks += new TestFramework("utest.runner.Framework"),
// see module doc https://www.scala-js.org/doc/project/module.html
scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.ESModule)
// nodjs needs .mjs extension. See https://www.scala-js.org/doc/project/module.html
.withOutputPatterns(OutputPatterns.fromJSFile("%s.mjs"))
}
// scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
val scala3jsOptions = Seq(
"-indent", // Together with -rewrite, remove {...} syntax when possible due to significant indentation.
"-new-syntax", // Require `then` and `do` in control expressions.
"-source:future", // Choices: future and future-migration. I use this to force future deprecation warnings, etc.
"-Yexplicit-nulls" // For explicit nulls behavior.
)