Skip to content
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

Cross compile to Scala Native #337

Closed
wants to merge 6 commits into from
Closed
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
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: scala
dist: trusty
script: ./tools/travis-script.sh
after_success: ./tools/travis-deploy.sh
branches:
Expand Down Expand Up @@ -27,4 +28,11 @@ env:
- PLATFORM=jvm SBT_PARALLEL=true WORKERS=4 DEPLOY=false
- PLATFORM=jvm SBT_PARALLEL=false WORKERS=4 DEPLOY=false
- PLATFORM=js SBT_PARALLEL=true WORKERS=1 DEPLOY=true
sudo: false

matrix:
include:
- scala: 2.11.11
before_script:
- curl https://raw.githubusercontent.com/scala-native/scala-native/v0.3.0/bin/travis_setup.sh | bash -x
sudo: required
env: PLATFORM=native SBT_PARALLEL=true WORKERS=1 DEPLOY=true
11 changes: 11 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,14 @@ lazy val jvm = project.in(file("jvm"))
.settings(
libraryDependencies += "org.scala-sbt" % "test-interface" % "1.0"
)

lazy val native = project.in(file("native"))
.settings(sharedSettings: _*)
.settings(
doc in Compile := (doc in Compile in jvm).value,
scalaVersion := "2.11.11",
libraryDependencies ++= Seq(
"org.scala-native" %% "test-interface_native0.3" % "0.3.1"
)
)
.enablePlugins(ScalaNativePlugin)
35 changes: 35 additions & 0 deletions native/src/main/scala/org/scalacheck/Platform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*-------------------------------------------------------------------------*\
** ScalaCheck **
** Copyright (c) 2007-2017 Rickard Nilsson. All rights reserved. **
** http://www.scalacheck.org **
** **
** This software is released under the terms of the Revised BSD License. **
** There is NO WARRANTY. See the file LICENSE for the full text. **
\*------------------------------------------------------------------------ */

package org.scalacheck

import Test._

private[scalacheck] object Platform {

def runWorkers(
params: Parameters,
workerFun: Int => Result,
stop: () => Unit
): Result = {
workerFun(0)
}

def loadModule(name: String, loader: ClassLoader): AnyRef =
org.scalajs.testinterface.TestUtils.loadModule(name, loader)

def newInstance(name: String, loader: ClassLoader)(args: Seq[AnyRef]): AnyRef =
org.scalajs.testinterface.TestUtils.newInstance(name, loader)(args)

// We don't need those annotation in Native, and they have been deprecated.
// We use `String` instead of the definition in Native because `-Xfatal-warnings`
// is set.
type JSExportDescendentObjects = String
type JSExportDescendentClasses = String
}
2 changes: 2 additions & 0 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.1")

scalacOptions += "-deprecation"
4 changes: 2 additions & 2 deletions src/test/scala/org/scalacheck/PropSpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ object PropSpecification extends Properties("Prop") {
}

property("throws") = throws(classOf[java.lang.Exception]) {
val s: String = null
s.length
val it: Iterator[Int] = Iterator.empty
it.next()
}

property("sizedProp") = {
Expand Down