Skip to content

Commit f3a156c

Browse files
committed
Import the JS Envs projects from the Scala.js core repository.
This is the initial import of the JS Envs projects (scalajs-js-envs, scalajs-js-envs-test-kit and scalajs-env-nodejs) 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 9e0a9c0 commit f3a156c

File tree

28 files changed

+207
-29
lines changed

28 files changed

+207
-29
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

.travis.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
sudo: false
2+
language: scala
3+
script:
4+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/test
5+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/doc
6+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/mimaReportBinaryIssues
7+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/headerCheck scalajs-js-envs/test:headerCheck
8+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/test
9+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/doc
10+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/mimaReportBinaryIssues
11+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/headerCheck scalajs-js-envs-test-kit/test:headerCheck
12+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/test
13+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/doc
14+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/mimaReportBinaryIssues
15+
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/headerCheck scalajs-env-nodejs/test:headerCheck
16+
scala:
17+
- 2.11.12
18+
- 2.12.11
19+
- 2.13.2
20+
jdk:
21+
- openjdk8
22+
23+
cache:
24+
directories:
25+
- "$HOME/.cache/coursier"
26+
- "$HOME/.ivy2/cache"
27+
- "$HOME/.sbt"
28+
before_cache:
29+
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
30+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
31+
- find $HOME/.sbt -name "*.lock" -print -delete

build.sbt

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
val previousVersion: Option[String] = Some("1.1.0")
2+
val newScalaBinaryVersionsInThisRelease: Set[String] = Set()
3+
4+
inThisBuild(Def.settings(
5+
version := "1.1.1-SNAPSHOT",
6+
organization := "org.scala-js",
7+
scalaVersion := "2.12.11",
8+
crossScalaVersions := Seq("2.11.12", "2.12.11", "2.13.2"),
9+
scalacOptions ++= Seq(
10+
"-deprecation",
11+
"-feature",
12+
"-Xfatal-warnings",
13+
"-encoding", "utf-8",
14+
),
15+
16+
// Licensing
17+
homepage := Some(url("https://github.com/scala-js/scala-js-js-envs")),
18+
startYear := Some(2013),
19+
licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))),
20+
scmInfo := Some(ScmInfo(
21+
url("https://github.com/scala-js/scala-js-js-envs"),
22+
"scm:git:[email protected]:scala-js/scala-js-js-envs.git",
23+
Some("scm:git:[email protected]:scala-js/scala-js-js-envs.git"))),
24+
25+
// Publishing
26+
publishMavenStyle := true,
27+
publishTo := {
28+
val nexus = "https://oss.sonatype.org/"
29+
if (version.value.endsWith("-SNAPSHOT"))
30+
Some("snapshots" at nexus + "content/repositories/snapshots")
31+
else
32+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
33+
},
34+
pomExtra := (
35+
<developers>
36+
<developer>
37+
<id>sjrd</id>
38+
<name>Sébastien Doeraene</name>
39+
<url>https://github.com/sjrd/</url>
40+
</developer>
41+
<developer>
42+
<id>gzm0</id>
43+
<name>Tobias Schlatter</name>
44+
<url>https://github.com/gzm0/</url>
45+
</developer>
46+
<developer>
47+
<id>nicolasstucki</id>
48+
<name>Nicolas Stucki</name>
49+
<url>https://github.com/nicolasstucki/</url>
50+
</developer>
51+
</developers>
52+
),
53+
pomIncludeRepository := { _ => false },
54+
))
55+
56+
val commonSettings = Def.settings(
57+
// Links to the JavaDoc do not work
58+
Compile / doc / scalacOptions -= "-Xfatal-warnings",
59+
60+
// Scaladoc linking
61+
apiURL := {
62+
val name = moduleName.value
63+
val scalaBinVer = scalaBinaryVersion.value
64+
val ver = version.value
65+
Some(url(s"https://javadoc.io/doc/org.scala-js/${name}_$scalaBinVer/$ver/"))
66+
},
67+
autoAPIMappings := true,
68+
69+
// sbt-header configuration
70+
headerLicense := Some(HeaderLicense.Custom(
71+
s"""Scala.js JS Envs (${homepage.value.get})
72+
|
73+
|Copyright EPFL.
74+
|
75+
|Licensed under Apache License 2.0
76+
|(https://www.apache.org/licenses/LICENSE-2.0).
77+
|
78+
|See the NOTICE file distributed with this work for
79+
|additional information regarding copyright ownership.
80+
|""".stripMargin
81+
)),
82+
83+
// MiMa auto-configuration
84+
mimaPreviousArtifacts ++= {
85+
val scalaV = scalaVersion.value
86+
val scalaBinaryV = scalaBinaryVersion.value
87+
val thisProjectID = projectID.value
88+
previousVersion match {
89+
case None =>
90+
Set.empty
91+
case _ if newScalaBinaryVersionsInThisRelease.contains(scalaBinaryV) =>
92+
// New in this release, no binary compatibility to comply to
93+
Set.empty
94+
case Some(prevVersion) =>
95+
/* Filter out e:info.apiURL as it expects 1.1.1-SNAPSHOT, whereas the
96+
* artifact we're looking for has 1.1.0 (for example).
97+
*/
98+
val prevExtraAttributes =
99+
thisProjectID.extraAttributes.filterKeys(_ != "e:info.apiURL")
100+
val prevProjectID =
101+
(thisProjectID.organization % thisProjectID.name % prevVersion)
102+
.cross(thisProjectID.crossVersion)
103+
.extra(prevExtraAttributes.toSeq: _*)
104+
Set(prevProjectID)
105+
}
106+
},
107+
)
108+
109+
lazy val root = project
110+
.in(file("."))
111+
112+
lazy val `scalajs-js-envs` = project
113+
.in(file("js-envs"))
114+
.settings(
115+
commonSettings,
116+
libraryDependencies ++= Seq(
117+
"org.scala-js" %% "scalajs-logging" % "1.1.1",
118+
"com.novocode" % "junit-interface" % "0.11" % "test",
119+
),
120+
)
121+
122+
lazy val `scalajs-js-envs-test-kit` = project
123+
.in(file("js-envs-test-kit"))
124+
.settings(
125+
commonSettings,
126+
libraryDependencies ++= Seq(
127+
"com.google.jimfs" % "jimfs" % "1.1",
128+
"junit" % "junit" % "4.12",
129+
"com.novocode" % "junit-interface" % "0.11" % "test"
130+
),
131+
)
132+
.dependsOn(`scalajs-js-envs`)
133+
134+
lazy val `scalajs-env-nodejs` = project
135+
.in(file("nodejs-env"))
136+
.settings(
137+
commonSettings,
138+
libraryDependencies ++= Seq(
139+
"com.google.jimfs" % "jimfs" % "1.1",
140+
"com.novocode" % "junit-interface" % "0.11" % "test"
141+
),
142+
)
143+
.dependsOn(`scalajs-js-envs`, `scalajs-js-envs-test-kit` % "test")

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/ComTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/JSEnvSuite.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/JSEnvSuiteConfig.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/RunTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/TimeoutComTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/TimeoutRunTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/kit/ComRun.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/kit/IOReader.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/kit/MsgHandler.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/kit/Run.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/kit/TestKit.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs-test-kit/src/test/scala/org/scalajs/jsenv/test/kit/TestEnv.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*
@@ -12,7 +12,7 @@
1212

1313
package org.scalajs.jsenv.test.kit
1414

15-
import scala.concurrent.Future
15+
import scala.concurrent.{Future, Promise}
1616

1717
import java.io._
1818
import java.nio.charset.StandardCharsets
@@ -27,11 +27,11 @@ private[kit] class TestEnv private (
2727

2828
// Interface for testing.
2929

30-
def withSuccess(): TestEnv = copy(result = Future.unit)
30+
def withSuccess(): TestEnv = copy(result = Future.successful(()))
3131

3232
def withFailure(t: Throwable): TestEnv = copy(result = Future.failed(t))
3333

34-
def withHang(): TestEnv = copy(result = Future.never)
34+
def withHang(): TestEnv = copy(result = Promise[Unit]().future)
3535

3636
def withOutErr(s: String): TestEnv = {
3737
val bytes = s.getBytes(StandardCharsets.UTF_8)
@@ -52,7 +52,7 @@ private[kit] class TestEnv private (
5252

5353
def withMsgs(msgs: String*): TestEnv = copy(msgs = msgs.toList)
5454

55-
private def this() = this(Future.unit, None, Nil)
55+
private def this() = this(Future.successful(()), None, Nil)
5656

5757
private def copy(
5858
result: Future[Unit] = result,
@@ -63,13 +63,13 @@ private[kit] class TestEnv private (
6363

6464
val name: String = "TestEnv"
6565

66-
def start(input: Input, config: RunConfig): JSRun = {
66+
def start(input: Seq[Input], config: RunConfig): JSRun = {
6767
require(msgs.isEmpty)
6868
callOnOutputStream(config)
6969
new TestRun
7070
}
7171

72-
def startWithCom(input: Input, config: RunConfig, onMessage: String => Unit): JSComRun = {
72+
def startWithCom(input: Seq[Input], config: RunConfig, onMessage: String => Unit): JSComRun = {
7373
callOnOutputStream(config)
7474
msgs.foreach(onMessage)
7575
new TestRun with JSComRun {

js-envs-test-kit/src/test/scala/org/scalajs/jsenv/test/kit/TestKitTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/ExternalJSRun.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/Input.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/JSEnv.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/JSRuns.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/JSUtils.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/main/scala/org/scalajs/jsenv/RunConfig.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

js-envs/src/test/scala/org/scalajs/jsenv/RunConfigTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

nodejs-env/src/main/scala/org/scalajs/jsenv/nodejs/ComSupport.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

nodejs-env/src/main/scala/org/scalajs/jsenv/nodejs/NodeJSEnv.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

nodejs-env/src/test/scala/org/scalajs/jsenv/nodejs/NodeJSSuite.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Scala.js (https://www.scala-js.org/)
2+
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs)
33
*
44
* Copyright EPFL.
55
*

project/build.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.3.12

project/plugins.sbt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
2+
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.7.0")

0 commit comments

Comments
 (0)