Skip to content
Permalink
Browse files

Cross build with Scala 2.13 (#121)

  • Loading branch information...
tmccarthy authored and alexarchambault committed Sep 27, 2019
1 parent 4713986 commit 6fefac11a2faa8f7a3e8ed92c062c07a4e5f70e3
@@ -19,5 +19,6 @@ stages:
jobs:
include:
- scala: 2.12.10
- scala: 2.13.1
- stage: release
script: ./sbt ci-release
@@ -88,16 +88,11 @@ object Settings {
)

private val scala212 = "2.12.10"
private val scala213 = "2.13.1"

lazy val shared = Seq(
crossScalaVersions := Seq(scala212),
scalaVersion := scala212,
scalacOptions ++= {
if (scalaBinaryVersion.value == "2.12")
Seq()
else
Seq("-target:jvm-1.7")
},
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scala213,
resolvers ++= Seq(
"Webjars Bintray" at "https://dl.bintray.com/webjars/maven/",
Resolver.sonatypeRepo("releases"),
@@ -0,0 +1,19 @@
package plotly.doc;

import org.mozilla.javascript.NativeArray;

// This class is to override NativeArray#getDefaultValue. Ideally we would just do this in an anonymous class in Scala
// code, but https://github.com/scala/bug/issues/11575 makes this impossible.
class NativeArrayWithDefault extends NativeArray {
private final Object defaultValue;

public NativeArrayWithDefault(Object[] array, Object defaultValue) {
super(array);
this.defaultValue = defaultValue;
}

@Override
public Object getDefaultValue(Class<?> hint) {
return defaultValue;
}
}
@@ -113,10 +113,7 @@ object DocumentationTests {
private object Numeric {
def linspace(from: Int, to: Int, count: Int) = {
val step = (to - from).toDouble / (count - 1)
new NativeArray((0 until count).map(n => from + n * step: JDouble).toArray[AnyRef]) {
override def getDefaultValue(hint: Class[_]) =
0.0: JDouble
}
new NativeArrayWithDefault((0 until count).map(n => from + n * step: JDouble).toArray[AnyRef], 0.0: JDouble)
}
}

0 comments on commit 6fefac1

Please sign in to comment.
You can’t perform that action at this time.