Skip to content

Commit b9cf7f2

Browse files
authored
Merge pull request #471 from scala-js/topic/mima
Poor Man's MiMa
2 parents 014eedd + 69df48c commit b9cf7f2

File tree

15 files changed

+49318
-3
lines changed

15 files changed

+49318
-3
lines changed

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Hi there!
2+
3+
Before submitting a PR containing any Scala changes, please make sure you...
4+
5+
* run `sbt prePR`
6+
* commit changes to `api-reports`
7+
8+
Thanks for contributing!

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,33 @@ jobs:
2121
env:
2222
SCALAJS_VERSION: "${{ matrix.scalajsversion == '0.6.x' && '0.6.28' || '' }}"
2323
steps:
24+
2425
- uses: actions/checkout@v2
2526
- uses: olafurpg/setup-scala@v13
2627
with:
2728
java-version: "[email protected]"
2829
- uses: coursier/cache-action@v6
30+
31+
- name: Hacks for Scala 2.10
32+
if: matrix.scalaversion == '2.10.7'
33+
run: ./prepareForScala210.sh
34+
2935
- name: Build
3036
run: sbt "++${{ matrix.scalaversion }}" package
37+
3138
- name: Test generate documentation
3239
run: sbt "++${{ matrix.scalaversion }}" doc
40+
3341
- name: Build examples
3442
run: sbt "++${{ matrix.scalaversion }}" example/compile
35-
- name: scalafmt
43+
44+
- name: Validate formatting
3645
run: sbt "++${{ matrix.scalaversion }}" scalafmtCheck
3746

47+
- name: Validate api report
48+
if: matrix.scalajsversion == '1.x' && matrix.scalaversion != '2.11.12'
49+
run: ./api-reports/validate "${{ matrix.scalaversion }}"
50+
3851
readme:
3952
runs-on: ubuntu-latest
4053
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.idea_modules
77
.metals
88
.project
9+
.sbtboot
910
.settings/
1011
.vscode
1112
metals.sbt

.scalafix.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rules = [
2+
GenerateApiReport,
3+
]

api-reports/2_12.txt

Lines changed: 24453 additions & 0 deletions
Large diffs are not rendered by default.

api-reports/2_13.txt

Lines changed: 24453 additions & 0 deletions
Large diffs are not rendered by default.

api-reports/validate

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
cd "$(dirname "$0")"
4+
5+
[ $# -ne 1 ] && echo "Usage: $0 <scala version>" && exit 1
6+
7+
series="${1%.*}"
8+
file="${series/./_}.txt"
9+
echo -n "Validating $file ... "
10+
11+
help='Run `sbt +compile` and check in the differences to the '"$(basename "$0") directory"
12+
13+
if [ ! -e "$file" ]; then
14+
echo "file not found. $help"
15+
exit 2
16+
elif [ -n "$(git status --porcelain -- "$file")" ]; then
17+
echo "out-of-date. $help"
18+
exit 3
19+
else
20+
echo "ok"
21+
fi

build.sbt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
import _root_.scalafix.sbt.BuildInfo.scalafixVersion // delete if Scala 2.10
12
import scalatex.ScalatexReadme
23

3-
lazy val root = project.in(file(".")).
4-
enablePlugins(ScalaJSPlugin)
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, // delete if Scala 2.10
10+
)
11+
12+
lazy val root = project
13+
.in(file("."))
14+
.enablePlugins(ScalaJSPlugin)
15+
.enablePlugins(ScalafixPlugin) // delete if Scala 2.10
16+
.dependsOn(scalafixRules % ScalafixConfig) // delete if Scala 2.10
517

618
name := "Scala.js DOM"
719

@@ -110,3 +122,15 @@ lazy val example = project.
110122
settings(commonSettings: _*).
111123
settings(noPublishSettings: _*).
112124
dependsOn(root)
125+
126+
addCommandAlias("prePR", "+prePR_nonCross")
127+
128+
val prePR_nonCross = taskKey[Unit]("Performs all necessary work required before submitting a PR, for a single version of Scala.")
129+
130+
ThisBuild / prePR_nonCross := Def.sequential(
131+
root / clean,
132+
root / Compile / scalafmt,
133+
root / Compile / compile,
134+
(root / Compile / scalafix).toTask(""), // delete if Scala 2.10
135+
example / Compile / compile,
136+
).value

prepareForScala210.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
cd "$(dirname "$0")"
4+
5+
sed -i -e '/delete if Scala 2.10/d' *.sbt project/*.sbt
6+
rm scalafix.sbt

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.11")
88
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0")
99

1010
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
11+
12+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.29") // delete if Scala 2.10

0 commit comments

Comments
 (0)