Skip to content

Cross build with Scala 2.13 #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ stages:
jobs:
include:
- scala: 2.12.10
- scala: 2.13.1
- stage: release
script: ./sbt ci-release
11 changes: 3 additions & 8 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
19 changes: 19 additions & 0 deletions tests/src/test/java/plotly/doc/NativeArrayWithDefault.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
5 changes: 1 addition & 4 deletions tests/src/test/scala/plotly/doc/DocumentationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down