Skip to content

Commit 4a6d902

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 4a6d902

File tree

7 files changed

+137
-3
lines changed

7 files changed

+137
-3
lines changed

.travis.yml

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