Skip to content

Commit f148967

Browse files
committed
Import the PhantomJS env from the Scala.js core repository.
This is the initial import of the PhantomJS env and its sbt plugin 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 cee226a commit f148967

File tree

8 files changed

+157
-279
lines changed

8 files changed

+157
-279
lines changed

.travis.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
install:
10+
- mkdir -p $HOME/.sbt/0.13/plugins/
11+
- echo 'addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC3")' > $HOME/.sbt/0.13/plugins/coursier.sbt
12+
- if [[ "${TRAVIS_SCALA_VERSION}" == "2.10.6" ]]; then TEST_SBT_PLUGIN=true; else TEST_SBT_PLUGIN=false; fi
13+
- git clone https://github.com/scala-js/scala-js.git
14+
- cd scala-js
15+
- git checkout f21e7f5ea652fe4a186f1ecd8c0070fbb80edc80
16+
- sbt ++$TRAVIS_SCALA_VERSION ir/publishLocal tools/publishLocal jsEnvs/publishLocal jsEnvsTestKit/publishLocal
17+
- |
18+
if [[ "${TEST_SBT_PLUGIN}" == "true" ]]; then
19+
sbt ++$TRAVIS_SCALA_VERSION testAdapter/publishLocal sbtPlugin/publishLocal &&
20+
sbt ++2.11.11 compiler/publishLocal library/publishLocal testInterface/publishLocal
21+
fi
22+
- cd ..
23+
script:
24+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-phantomjs-env/test scalajs-phantomjs-env/doc
25+
- |
26+
if [[ "${TEST_SBT_PLUGIN}" == "true" ]]; then
27+
sbt scalajs-phantomjs-env/publishLocal sbt-scalajs-env-phantomjs/publishLocal && \
28+
cd sbt-plugin-test && \
29+
sbt jetty9/run && \
30+
cd ..
31+
fi
32+
cache:
33+
directories:
34+
- $HOME/.ivy2/cache
35+
- $HOME/.sbt
36+
- $HOME/.coursier/cache
37+
before_cache:
38+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
39+
- find $HOME/.sbt -name "*.lock" -print -delete
40+
- rm $HOME/.sbt/0.13/plugins/coursier.sbt

build.sbt

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
val scalaJSVersion = "1.0.0-SNAPSHOT"
2+
3+
inThisBuild(Seq(
4+
version := "0.1.0-SNAPSHOT",
5+
organization := "org.scala-js",
6+
7+
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.2"),
8+
scalaVersion := "2.10.6",
9+
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
10+
11+
homepage := Some(url("https://www.scala-js.org/")),
12+
licenses += ("BSD New",
13+
url("https://github.com/scala-js/scala-js-env-phantomjs/blob/master/LICENSE")),
14+
scmInfo := Some(ScmInfo(
15+
url("https://github.com/scala-js/scala-js-env-phantomjs"),
16+
"scm:git:git@github.com:scala-js/scala-js-env-phantomjs.git",
17+
Some("scm:git:git@github.com:scala-js/scala-js-env-phantomjs.git")))
18+
))
19+
20+
val commonSettings = Def.settings(
21+
// Scaladoc linking
22+
apiURL := {
23+
val name = moduleName.value
24+
val v = version.value
25+
Some(url(s"https://www.scala-js.org/api/$name/$v/"))
26+
},
27+
autoAPIMappings := true,
28+
29+
publishMavenStyle := true,
30+
publishTo := {
31+
val nexus = "https://oss.sonatype.org/"
32+
if (isSnapshot.value)
33+
Some("snapshots" at nexus + "content/repositories/snapshots")
34+
else
35+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
36+
},
37+
pomExtra := (
38+
<developers>
39+
<developer>
40+
<id>sjrd</id>
41+
<name>Sébastien Doeraene</name>
42+
<url>https://github.com/sjrd/</url>
43+
</developer>
44+
<developer>
45+
<id>gzm0</id>
46+
<name>Tobias Schlatter</name>
47+
<url>https://github.com/gzm0/</url>
48+
</developer>
49+
<developer>
50+
<id>nicolasstucki</id>
51+
<name>Nicolas Stucki</name>
52+
<url>https://github.com/nicolasstucki/</url>
53+
</developer>
54+
</developers>
55+
),
56+
pomIncludeRepository := { _ => false }
57+
)
58+
59+
lazy val root: Project = project.in(file(".")).
60+
settings(
61+
publishArtifact in Compile := false,
62+
publish := {},
63+
publishLocal := {},
64+
65+
clean := clean.dependsOn(
66+
clean in `scalajs-phantomjs-env`,
67+
clean in `sbt-scalajs-env-phantomjs`
68+
).value
69+
)
70+
71+
lazy val `scalajs-phantomjs-env`: Project = project.in(file("phantomjs-env")).
72+
settings(
73+
commonSettings,
74+
75+
libraryDependencies ++= Seq(
76+
"org.scala-js" %% "scalajs-js-envs" % scalaJSVersion,
77+
"org.eclipse.jetty" % "jetty-websocket" % "8.1.16.v20140903" % "provided",
78+
"org.eclipse.jetty" % "jetty-server" % "8.1.16.v20140903" % "provided",
79+
80+
"com.novocode" % "junit-interface" % "0.11" % "test",
81+
"org.scala-js" %% "scalajs-js-envs-test-kit" % scalaJSVersion % "test"
82+
)
83+
)
84+
85+
lazy val `sbt-scalajs-env-phantomjs`: Project = project.in(file("phantomjs-sbt-plugin")).
86+
settings(
87+
commonSettings,
88+
89+
sbtPlugin := true,
90+
scalaBinaryVersion :=
91+
CrossVersion.binaryScalaVersion(scalaVersion.value),
92+
93+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion),
94+
95+
// Add API mappings for sbt (seems they don't export their API URL)
96+
apiMappings ++= {
97+
val deps = (externalDependencyClasspath in Compile).value
98+
val sbtJars = deps filter { attributed =>
99+
val p = attributed.data.getPath
100+
p.contains("/org.scala-sbt/") && p.endsWith(".jar")
101+
}
102+
val docUrl =
103+
url(s"http://www.scala-sbt.org/${sbtVersion.value}/api/")
104+
sbtJars.map(_.data -> docUrl).toMap
105+
}
106+
).
107+
dependsOn(`scalajs-phantomjs-env`)

phantomjs-env/src/main/scala/org/scalajs/jsenv/phantomjs/PhantomJettyClassLoader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package org.scalajs.jsenv.phantomjs
1010

1111
import org.scalajs.core.tools.io.IO
1212

13-
/** A special [[java.lang.ClassLoader]] to load the Jetty 8 dependency of
13+
/** A special `java.lang.ClassLoader` to load the Jetty 8 dependency of
1414
* [[PhantomJSEnv]] in a private space.
1515
*
1616
* It loads everything that belongs to `JettyWebsocketManager` itself (while

phantomjs-sbt-plugin/src/main/scala/org/scalajs/jsenv/phantomjs/sbtplugin/PhantomJSEnvPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
1919
import org.scalajs.jsenv._
2020
import org.scalajs.jsenv.phantomjs._
2121

22-
/** An sbt plugin that simplifies the setup of [[PhantomJSEnv]]s.
22+
/** An sbt plugin that simplifies the setup of `PhantomJSEnv`s.
2323
*
2424
* There is no need to use `enablePlugins(PhantomJSEnvPlugin)`, as this plugin
2525
* is automatically triggered by Scala.js projects.

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

0 commit comments

Comments
 (0)