Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 18b0d45

Browse files
Re-add support for scala native
It was reverted in #135 because of build problems, but this is very easy to add now: we add a single 'jdk8 + scala 2.11.12' job to the build matrix, and also restrict publishing to those versions to be sure. Locally, the native subproject can be run with any jdk > 6 and works normally. fixes #141.
1 parent 70e37b6 commit 18b0d45

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

‎.travis.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ matrix:
5757
jdk: openjdk6
5858
- scala: 2.13.0-M5
5959
jdk: openjdk6
60+
include:
61+
- env: SCALANATIVE_VERSION=0.3.8
62+
jdk: oraclejdk8
6063

6164
notifications:
6265
email:

‎admin/build.sh‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,21 @@ set -e
1717
# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`.
1818
# Everything after the `#` in the tag name is ignored.
1919

20-
if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \
20+
if [[ "$SCALANATIVE_VERSION" != "" ]]; then
21+
if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* ]]; then
22+
RELEASE_COMBO=true;
23+
fi
24+
elif [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \
2125
|| "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then
2226
RELEASE_COMBO=true;
2327
fi
2428

25-
if [ "$SCALAJS_VERSION" = "" ]; then
26-
projectPrefix="scala-parser-combinators"
27-
else
29+
if ! [ "$SCALAJS_VERSION" == "" ]; then
2830
projectPrefix="scala-parser-combinatorsJS"
31+
elif ! [ "$SCALANATIVE_VERSION" == "" ]; then
32+
projectPrefix="scala-parser-combinatorsNative"
33+
else
34+
projectPrefix="scala-parser-combinators"
2935
fi
3036

3137
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"

‎build.sbt‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import sbtcrossproject.crossProject
44
crossScalaVersions in ThisBuild := List("2.12.7", "2.11.12", "2.13.0-M5")
55

66
lazy val root = project.in(file("."))
7-
.aggregate(`scala-parser-combinatorsJS`, `scala-parser-combinatorsJVM`)
7+
.aggregate(`scala-parser-combinatorsJS`, `scala-parser-combinatorsJVM`, `scala-parser-combinatorsNative`)
88
.settings(disablePublishing)
99

10-
lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform).
10+
lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, NativePlatform).
1111
withoutSuffixFor(JVMPlatform).in(file(".")).
1212
settings(scalaModuleSettings: _*).
1313
jvmSettings(scalaModuleSettingsJVM).
@@ -48,7 +48,17 @@ lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform).
4848
// Scala.js cannot run forked tests
4949
fork in Test := false
5050
).
51-
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
51+
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)).
52+
nativeSettings(
53+
skip in compile := System.getProperty("java.version").startsWith("1.6") || !scalaVersion.value.startsWith("2.11"),
54+
test := {},
55+
libraryDependencies := {
56+
if (!scalaVersion.value.startsWith("2.11"))
57+
libraryDependencies.value.filterNot(_.organization == "org.scala-native")
58+
else libraryDependencies.value
59+
}
60+
)
5261

5362
lazy val `scala-parser-combinatorsJVM` = `scala-parser-combinators`.jvm
5463
lazy val `scala-parser-combinatorsJS` = `scala-parser-combinators`.js
64+
lazy val `scala-parser-combinatorsNative` = `scala-parser-combinators`.native
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package scala.util.parsing.input
2+
3+
import java.lang.CharSequence
4+
import java.util.{AbstractMap, Collections}
5+
6+
private[input] trait PositionCache {
7+
private[input] lazy val indexCache: java.util.Map[CharSequence,Array[Int]] = new AbstractMap[CharSequence, Array[Int]] {
8+
9+
override def entrySet() = Collections.emptySet()
10+
11+
// the /dev/null of Maps
12+
override def put(ch: CharSequence, a: Array[Int]) = null
13+
}
14+
}

‎project/plugins.sbt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@ val scalaJSVersion =
1212

1313
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
1414

15+
val scalaNativeVersion =
16+
Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.3.8")
17+
18+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion)
19+
1520
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
21+
22+
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /