Skip to content

Commit 038c52c

Browse files
committed
Merge branch 'master' into cleanups
2 parents 9e3049b + f005384 commit 038c52c

File tree

19 files changed

+649
-174
lines changed

19 files changed

+649
-174
lines changed

.github/workflows/ci.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,19 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
scalaversion: ["2.11.12", "2.12.12", "2.13.4", "3.0.1"]
16+
scalaversion: ["2.11.12", "2.12.14", "2.13.6", "3.0.1"]
1717
steps:
1818

1919
- uses: actions/checkout@v2
2020

2121
- name: Setup Scala
2222
uses: japgolly/[email protected]
2323

24-
- name: Build
25-
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" package
26-
27-
- name: Test generate documentation
28-
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" doc
29-
30-
- name: Build examples
31-
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" example/compile
24+
- name: Build and test
25+
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" test package doc
3226

3327
- name: Validate formatting
34-
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" scalafmtCheck
28+
run: sbt -DCI=1 "++${{ matrix.scalaversion }}" dom/scalafmtCheck
3529

3630
- name: Validate api report
3731
if: matrix.scalaversion != '2.11.12' && matrix.scalaversion != '3.0.1'

.scala-steward.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
updates.ignore = [
2+
{ groupId = "org.scala-lang", artifactId = "scala-library" }
3+
]

RELEASING.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
How to Perform a Release
2+
========================
3+
4+
1. The first step is to create a tag, push it, and let GitHub Actions do the release.
5+
6+
```sh
7+
# For v1.x.y
8+
ver=1.2.0 # change this to new version
9+
git checkout series/1.x
10+
git checkout -b topic/v$ver
11+
echo "ThisBuild / version := \"$ver\" // Workaround for #504" > version.sbt
12+
git add version.sbt
13+
git commit -m "Setting version to v$ver"
14+
git tag -s v$ver
15+
git push --tags
16+
17+
# For v2.x onwards
18+
ver=2.0.0 # change this to new version
19+
git checkout master
20+
git tag -s v$ver
21+
git push --tags
22+
```
23+
24+
25+
2. Wait for the release to complete.
26+
https://github.com/scala-js/scala-js-dom/actions/workflows/release.yml
27+
28+
3. Go to GitHub releases (https://github.com/scala-js/scala-js-dom/releases),
29+
edit the auto-generated draft release,
30+
revise,
31+
and click Publish.
32+
33+
4. Advertise the new release in the following places:
34+
35+
* Reddit
36+
Example: https://old.reddit.com/r/scala/comments/pc9k5y/scalajsdom_120_released_this_is_the_first_release
37+
38+
* Scala.js Discord
39+
Example: https://discord.com/channels/632150470000902164/635668814956068864/880575154516819978
40+
41+
* Scala.js gitter
42+
Example: https://gitter.im/scala-js/scala-js?at=612811ec1179346966e36def
43+
44+
* scala-users
45+
Example: https://users.scala-lang.org/t/scala-js-dom-v1-2-0-released/7745
46+
47+
* Twitter
48+
Example: https://twitter.com/japgolly/status/1431011200771379200?s=20

build.sbt

+19-154
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,19 @@
1-
import _root_.scalafix.sbt.BuildInfo.scalafixVersion
2-
import scalatex.ScalatexReadme
3-
4-
ThisBuild / shellPrompt := ((s: State) => Project.extract(s).currentRef.project + "> ")
5-
6-
lazy val scalafixRules = project
7-
.in(file("scalafix"))
8-
.settings(
9-
libraryDependencies += ("ch.epfl.scala" %% "scalafix-core" % scalafixVersion).cross(CrossVersion.for3Use2_13),
10-
)
11-
12-
def sourceMapsToGithub: Project => Project =
13-
p => p.settings(
14-
scalacOptions ++= {
15-
val isDotty = scalaVersion.value startsWith "3"
16-
val ver = version.value
17-
if (isSnapshot.value)
18-
Nil
19-
else {
20-
val a = p.base.toURI.toString.replaceFirst("[^/]+/?$", "")
21-
val g = s"https://raw.githubusercontent.com/scala-js/scala-js-dom"
22-
val flag = if (isDotty) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI"
23-
s"$flag:$a->$g/v$ver/" :: Nil
24-
}
25-
}
26-
)
27-
28-
lazy val root = project
29-
.in(file("."))
30-
.enablePlugins(ScalaJSPlugin)
31-
.enablePlugins(ScalafixPlugin)
32-
.dependsOn(scalafixRules % ScalafixConfig)
33-
.configure(sourceMapsToGithub)
34-
35-
name := "Scala.js DOM"
36-
37-
ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.12", "2.13.4", "3.0.1")
38-
ThisBuild / scalaVersion := crossScalaVersions.value.find(_.startsWith("2.13.")).get
39-
40-
val inCI = Option(System.getenv("CI")).exists(_.contains("1"))
41-
42-
val commonSettings = Seq(
43-
organization := "org.scala-js",
44-
scalacOptions ++= Seq(
45-
"-deprecation",
46-
"-feature",
47-
),
48-
scalacOptions ++= (if (!inCI) Seq.empty else Seq(
49-
"-Xfatal-warnings",
50-
)),
51-
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
52-
case Some((2, 11)) => "-Ywarn-unused-import" :: Nil
53-
case Some((2, 12)) => "-Ywarn-unused:imports,patvars,locals,implicits" :: Nil
54-
case Some((2, 13)) => "-Wunused:imports,patvars,locals,implicits" :: Nil
55-
case _ => Nil
56-
}),
57-
)
58-
59-
val noPublishSettings = Seq(
60-
publish / skip := true
61-
)
62-
63-
normalizedName := "scalajs-dom"
64-
65-
commonSettings
66-
67-
homepage := Some(url("http://scala-js.org/"))
68-
69-
licenses += ("MIT", url("http://opensource.org/licenses/mit-license.php"))
70-
71-
def hasNewCollections(version: String): Boolean = {
72-
!version.startsWith("2.11.") &&
73-
!version.startsWith("2.12.")
74-
}
75-
76-
/** Returns the appropriate subdirectory of `sourceDir` depending on whether
77-
* the `scalaV` uses the new collections (introduced in 2.13) or not.
78-
*/
79-
def collectionsEraDependentDirectory(scalaV: String, sourceDir: File): File =
80-
if (hasNewCollections(scalaV)) sourceDir / "scala-new-collections"
81-
else sourceDir / "scala-old-collections"
82-
83-
inConfig(Compile)(Def.settings(
84-
unmanagedSourceDirectories +=
85-
collectionsEraDependentDirectory(scalaVersion.value, sourceDirectory.value)
86-
))
87-
88-
versionScheme := Some("early-semver")
89-
90-
pomExtra := (
91-
<developers>
92-
<developer>
93-
<id>japgolly</id>
94-
<name>David Barri</name>
95-
<url>https://github.com/japgolly</url>
96-
</developer>
97-
<developer>
98-
<id>lihaoyi</id>
99-
<name>Li Haoyi</name>
100-
<url>https://github.com/lihaoyi/</url>
101-
</developer>
102-
<developer>
103-
<id>armanbilge</id>
104-
<name>Arman Bilge</name>
105-
<url>https://github.com/armanbilge</url>
106-
</developer>
107-
<developer>
108-
<id>sjrd</id>
109-
<name>Sébastien Doeraene</name>
110-
<url>https://github.com/sjrd/</url>
111-
</developer>
112-
<developer>
113-
<id>gzm0</id>
114-
<name>Tobias Schlatter</name>
115-
<url>https://github.com/gzm0/</url>
116-
</developer>
117-
</developers>
118-
)
119-
120-
pomIncludeRepository := { _ => false }
121-
122-
lazy val readme = ScalatexReadme(
123-
projectId = "readme",
124-
wd = file(""),
125-
url = "https://github.com/scala-js/scala-js-dom/tree/master",
126-
source = "Index",
127-
autoResources = Seq("example-opt.js")
128-
).settings(
129-
scalaVersion := "2.12.10",
130-
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
131-
(Compile / resources) += (example / Compile / fullOptJS).value.data
132-
).settings(noPublishSettings: _*)
133-
134-
lazy val example = project.
135-
enablePlugins(ScalaJSPlugin).
136-
settings(commonSettings: _*).
137-
settings(noPublishSettings: _*).
138-
dependsOn(root)
139-
140-
addCommandAlias("prePR", "+prePR_nonCross")
141-
142-
val prePR_nonCross = taskKey[Unit]("Performs all necessary work required before submitting a PR, for a single version of Scala.")
143-
144-
ThisBuild / prePR_nonCross := Def.sequential(
145-
root / clean,
146-
root / Compile / scalafmt,
147-
Def.taskDyn {
148-
if (scalaVersion.value.startsWith("2."))
149-
(root / Compile / scalafix).toTask("")
150-
else
151-
Def.task[Unit]((root / Compile / compile).value)
152-
},
153-
example / Compile / compile,
154-
).value
1+
ThisBuild / homepage := Some(url("https://scala-js.org"))
2+
ThisBuild / licenses += ("MIT", url("https://opensource.org/licenses/mit-license.php"))
3+
ThisBuild / organization := "org.scala-js"
4+
ThisBuild / shellPrompt := ((s: State) => Project.extract(s).currentRef.project + "> ")
5+
ThisBuild / versionScheme := Some("early-semver")
6+
7+
val root = Build.root
8+
val scalafixRules = Build.scalafixRules
9+
val dom = Build.dom
10+
val testsShared = Build.testsShared
11+
val testsWebworker = Build.testsWebworker
12+
val testsChrome = Build.testsChrome
13+
val testsFirefox = Build.testsFirefox
14+
val testsNodeJsdom = Build.testsNodeJsdom
15+
val example = Build.example
16+
val readme = Build.readme
17+
18+
// TODO: Remove after dom project get it's own directory
19+
Global / onLoad ~= (_.andThen("project root" :: _))

prePR.sbt

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import Build._
2+
3+
addCommandAlias("prePR", "+prePR_nonCross")
4+
5+
val prePR_nonCross = taskKey[Unit]("Performs all necessary work required before submitting a PR, for a single version of Scala.")
6+
7+
// Unfortunately we can't just call `root/Test/compile` because it doesn't take aggregation into account :(
8+
ThisBuild / prePR_nonCross := Def.sequential(
9+
10+
Def.task {
11+
(root / clean).value
12+
(scalafixRules / clean).value
13+
(dom / clean).value
14+
(testsShared / clean).value
15+
(testsWebworker / clean).value
16+
(testsChrome / clean).value
17+
(testsFirefox / clean).value
18+
(testsNodeJsdom / clean).value
19+
(example / clean).value
20+
},
21+
22+
dom / Compile / scalafmt,
23+
Def.taskDyn {
24+
if (scalaVersion.value.startsWith("2."))
25+
(dom / Compile / scalafix).toTask("")
26+
else
27+
Def.task[Unit]((dom / Compile / compile).value)
28+
},
29+
30+
Def.task {
31+
(testsShared / Test / compile).value
32+
(testsWebworker / Test / compile).value
33+
(testsChrome / Test / compile).value
34+
(testsFirefox / Test / compile).value
35+
(testsNodeJsdom / Test / compile).value
36+
(example / Test / compile).value
37+
},
38+
39+
Def.taskDyn {
40+
if (scalaVersion.value.startsWith("2.12."))
41+
Def.task[Unit]((readme / Compile / compile).value)
42+
else
43+
Def.task(())
44+
},
45+
46+
).value

0 commit comments

Comments
 (0)