Skip to content

Commit 62df6b6

Browse files
committed
Import the Node.js with jsdom env from the Scala.js core repository.
This is the initial import of the Node.js with jsdom env from the Scala.js core repository. The history of this commit reflects the entire history of relevant files from the core repo, filter-branch'ed to appear as if they had always been in this repo. This commit adds the specific setup of the build and tests.
1 parent 1c8cede commit 62df6b6

File tree

7 files changed

+139
-3
lines changed

7 files changed

+139
-3
lines changed

.travis.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
sudo: false
2+
language: scala
3+
scala:
4+
- 2.10.6
5+
- 2.11.11
6+
- 2.12.2
7+
jdk:
8+
- oraclejdk8
9+
env:
10+
- JSDOM_VERSION=9.12.0
11+
- JSDOM_VERSION=10.0.0
12+
install:
13+
# The default ivy resolution takes way too much time, and times out Travis builds.
14+
# We use coursier instead.
15+
- mkdir -p $HOME/.sbt/0.13/plugins/
16+
- echo 'addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC3")' > $HOME/.sbt/0.13/plugins/coursier.sbt
17+
# We need a recent version of Node.js for jsdom
18+
- nvm install 6
19+
- nvm use 6
20+
- node --version
21+
# Of course we need jsdom
22+
- npm install jsdom@$JSDOM_VERSION
23+
# While there is no published version of Scala.js 1.x, we have to locally build a snapshot.
24+
- git clone https://github.com/scala-js/scala-js.git
25+
- cd scala-js
26+
- git checkout d25fa8bba708977c68c093fdbc50958368f9602f
27+
- sbt ++$TRAVIS_SCALA_VERSION compiler/publishLocal jUnitPlugin/publishLocal library/publishLocal testInterface/publishLocal jUnitRuntime/publishLocal ir/publishLocal tools/publishLocal jsEnvs/publishLocal jsEnvsTestKit/publishLocal nodeJSEnv/publishLocal
28+
- sbt ++2.10.6 ir/publishLocal tools/publishLocal jsEnvs/publishLocal nodeJSEnv/publishLocal testAdapter/publishLocal sbtPlugin/publishLocal
29+
- cd ..
30+
script:
31+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-jsdom-nodejs/test scalajs-env-jsdom-nodejs/doc
32+
- sbt ++$TRAVIS_SCALA_VERSION test-project/run test-project/test
33+
cache:
34+
directories:
35+
- $HOME/.ivy2/cache
36+
- $HOME/.sbt
37+
- $HOME/.coursier/cache
38+
before_cache:
39+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
40+
- find $HOME/.sbt -name "*.lock" -print -delete
41+
- rm $HOME/.sbt/0.13/plugins/coursier.sbt

build.sbt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
inThisBuild(Seq(
2+
version := "0.1.0-SNAPSHOT",
3+
organization := "org.scala-js",
4+
5+
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.2"),
6+
scalaVersion := "2.11.11",
7+
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
8+
9+
homepage := Some(url("https://www.scala-js.org/")),
10+
licenses += ("BSD New",
11+
url("https://github.com/scala-js/scala-js-env-jsdom-nodejs/blob/master/LICENSE")),
12+
scmInfo := Some(ScmInfo(
13+
url("https://github.com/scala-js/scala-js-env-jsdom-nodejs"),
14+
"scm:git:git@github.com:scala-js/scala-js-env-jsdom-nodejs.git",
15+
Some("scm:git:git@github.com:scala-js/scala-js-env-jsdom-nodejs.git")))
16+
))
17+
18+
val commonSettings = Def.settings(
19+
// Scaladoc linking
20+
apiURL := {
21+
val name = moduleName.value
22+
val v = version.value
23+
Some(url(s"https://www.scala-js.org/api/$name/$v/"))
24+
},
25+
autoAPIMappings := true,
26+
27+
publishMavenStyle := true,
28+
publishTo := {
29+
val nexus = "https://oss.sonatype.org/"
30+
if (isSnapshot.value)
31+
Some("snapshots" at nexus + "content/repositories/snapshots")
32+
else
33+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
34+
},
35+
pomExtra := (
36+
<developers>
37+
<developer>
38+
<id>sjrd</id>
39+
<name>Sébastien Doeraene</name>
40+
<url>https://github.com/sjrd/</url>
41+
</developer>
42+
<developer>
43+
<id>gzm0</id>
44+
<name>Tobias Schlatter</name>
45+
<url>https://github.com/gzm0/</url>
46+
</developer>
47+
<developer>
48+
<id>nicolasstucki</id>
49+
<name>Nicolas Stucki</name>
50+
<url>https://github.com/nicolasstucki/</url>
51+
</developer>
52+
</developers>
53+
),
54+
pomIncludeRepository := { _ => false }
55+
)
56+
57+
lazy val root: Project = project.in(file(".")).
58+
settings(
59+
publishArtifact in Compile := false,
60+
publish := {},
61+
publishLocal := {},
62+
63+
clean := clean.dependsOn(
64+
clean in `scalajs-env-jsdom-nodejs`,
65+
clean in `test-project`
66+
).value
67+
)
68+
69+
lazy val `scalajs-env-jsdom-nodejs`: Project = project.in(file("jsdom-nodejs-env")).
70+
settings(
71+
commonSettings,
72+
73+
libraryDependencies ++= Seq(
74+
"org.scala-js" %% "scalajs-js-envs" % scalaJSVersion,
75+
"org.scala-js" %% "scalajs-nodejs-env" % scalaJSVersion,
76+
77+
"com.novocode" % "junit-interface" % "0.11" % "test",
78+
"org.scala-js" %% "scalajs-js-envs-test-kit" % scalaJSVersion % "test"
79+
)
80+
)
81+
82+
lazy val `test-project`: Project = project.
83+
enablePlugins(ScalaJSPlugin).
84+
enablePlugins(ScalaJSJUnitPlugin).
85+
settings(
86+
scalaJSUseMainModuleInitializer := true,
87+
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()
88+
)

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=0.13.15

project/plugins.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0-SNAPSHOT")
2+
3+
libraryDependencies += "org.scala-js" %% "scalajs-nodejs-env" % "1.0.0-SNAPSHOT"
4+
5+
unmanagedSourceDirectories in Compile +=
6+
baseDirectory.value.getParentFile / "jsdom-nodejs-env/src/main/scala"

sbt-plugin-test/withDOM/src/main/scala/sbttest/withDOM/Lib.scala renamed to test-project/src/main/scala/testproject/Lib.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sbttest.withDOM
1+
package testproject
22

33
import scala.scalajs.js
44

sbt-plugin-test/withDOM/src/main/scala/sbttest/withDOM/TestApp.scala renamed to test-project/src/main/scala/testproject/TestApp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sbttest.withDOM
1+
package testproject
22

33
object TestApp {
44

sbt-plugin-test/withDOM/src/test/scala/sbttest/withDOM/LibTest.scala renamed to test-project/src/test/scala/testproject/LibTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sbttest.withDOM
1+
package testproject
22

33
import scala.scalajs.js
44

0 commit comments

Comments
 (0)