diff --git a/.gitignore b/.gitignore index 2f7896d..d102803 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ target/ +.js +.native +lowered.hnir diff --git a/.travis.yml b/.travis.yml index d58183d..2052eca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,37 +1,49 @@ sudo: false language: scala script: - - sbt ++$TRAVIS_SCALA_VERSION root/scalastyle testSuiteJVM/scalastyle testSuiteJVM/test:scalastyle testSuiteJS/scalastyle testSuiteJS/test:scalastyle + - sbt ++$TRAVIS_SCALA_VERSION rootJS/scalastyle testSuiteJVM/scalastyle testSuiteJVM/test:scalastyle testSuiteJS/scalastyle testSuiteJS/test:scalastyle - sbt ++$TRAVIS_SCALA_VERSION testSuiteJVM/test - sbt ++$TRAVIS_SCALA_VERSION testSuiteJS/test - sbt ++$TRAVIS_SCALA_VERSION 'set scalaJSStage in Global := FullOptStage' testSuiteJS/test - - sbt ++$TRAVIS_SCALA_VERSION publishLocal + - sbt ++$TRAVIS_SCALA_VERSION rootJS/publishLocal scala: - 2.10.7 - 2.11.12 - - 2.12.6 - - 2.13.0-M3 - - 2.13.0-M4 + - 2.12.10 + - 2.13.1 jdk: - - oraclejdk8 + - openjdk8 env: - - SCALAJS_VERSION=0.6.23 - - SCALAJS_VERSION=1.0.0-M3 - - SCALAJS_VERSION=1.0.0-M5 + - SCALAJS_VERSION=0.6.29 + - SCALAJS_VERSION=1.0.0-M8 matrix: exclude: - scala: 2.10.7 - env: SCALAJS_VERSION=1.0.0-M3 - - scala: 2.13.0-M4 - env: SCALAJS_VERSION=1.0.0-M3 - - scala: 2.10.7 - env: SCALAJS_VERSION=1.0.0-M5 - -cache: + env: SCALAJS_VERSION=1.0.0-M8 + include: + - scala: 2.11.12 + jdk: openjdk8 + env: + - SCALA_NATIVE_VERSION="0.3.9" + sudo: required + before_install: + - curl https://raw.githubusercontent.com/scala-native/scala-native/master/scripts/travis_setup.sh | bash - + script: + - sbt "++$TRAVIS_SCALA_VERSION!" nativeTestSuite/test rootNative/publishLocal + - scala: 2.11.12 + jdk: openjdk8 + env: + - SCALA_NATIVE_VERSION="0.4.0-M2" + sudo: required + before_install: + - curl https://raw.githubusercontent.com/scala-native/scala-native/master/scripts/travis_setup.sh | bash - + script: + - sbt "++$TRAVIS_SCALA_VERSION!" nativeTestSuite/test rootNative/publishLocal + cache: directories: - - "$HOME/.ivy2/cache" + - "$HOME/.cache/coursier/v1" - "$HOME/.sbt" before_cache: # Cleanup the cached directories to avoid unnecessary cache updates - - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete + - find $HOME/.coursier -name "*.lock" | xargs rm - find $HOME/.sbt -name "*.lock" -print -delete diff --git a/build.sbt b/build.sbt index b5c15fd..9645cf4 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,18 @@ -import sbtcrossproject.crossProject +import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} + +val scala210 = "2.10.7" +val scala211 = "2.11.12" +val scala212 = "2.12.10" +val scala213 = "2.13.1" crossScalaVersions in ThisBuild := { - val allVersions = Seq("2.12.6", "2.11.12", "2.10.7", "2.13.0-M3", "2.13.0-M4") + val allVersions = Seq(scala210, scala211, scala212, scala213) if (scalaJSVersion.startsWith("0.6.")) allVersions - else if (scalaJSVersion == "1.0.0-M3") - allVersions.filter(v => !v.startsWith("2.10.") && v != "2.13.0-M4") else - allVersions.filter(!_.startsWith("2.10.")) + allVersions.filter(_ != scala210) } -scalaVersion in ThisBuild := (crossScalaVersions in ThisBuild).value.head +scalaVersion in ThisBuild := scala212 val commonSettings: Seq[Setting[_]] = Seq( version := "0.1.6-SNAPSHOT", @@ -25,8 +28,15 @@ val commonSettings: Seq[Setting[_]] = Seq( Some("scm:git:git@github.com:scala-js/scala-js-java-logging.git"))) ) -lazy val root: Project = project.in(file(".")). - enablePlugins(ScalaJSPlugin). +val nativeSettings = Seq( + scalaVersion := scala211, + crossScalaVersions := Seq(scala211), + sources in (Compile,doc) := Seq.empty +) + +lazy val root = crossProject(JSPlatform, NativePlatform). + crossType(CrossType.Pure). + in(file(".")). settings(commonSettings). settings( name := "scalajs-java-logging", @@ -64,7 +74,11 @@ lazy val root: Project = project.in(file(".")). </developers> ), pomIncludeRepository := { _ => false } - ) + ). + nativeSettings(nativeSettings) + +lazy val rootJS = root.js +lazy val rootNative = root.native lazy val testSuite = crossProject(JSPlatform, JVMPlatform). jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)). @@ -76,12 +90,17 @@ lazy val testSuite = crossProject(JSPlatform, JVMPlatform). jsSettings( name := "java.logging testSuite on JS" ). - jsConfigure(_.dependsOn(root)). + jsConfigure(_.dependsOn(rootJS)). jvmSettings( name := "java.logging testSuite on JVM", libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test" ) -lazy val testSuiteJS = testSuite.js -lazy val testSuiteJVM = testSuite.jvm +lazy val nativeTestSuite = project. + settings( + name := "java.logging testSuite on Native", + nativeSettings + ). + dependsOn(rootNative). + enablePlugins(ScalaNativePlugin) diff --git a/nativeTestSuite/src/test/scala/Main.scala b/nativeTestSuite/src/test/scala/Main.scala new file mode 100644 index 0000000..de36d98 --- /dev/null +++ b/nativeTestSuite/src/test/scala/Main.scala @@ -0,0 +1,11 @@ +import java.util.logging._ + +object Main { + def main(args: Array[String]): Unit = { + val f = new SimpleFormatter() + val r = new LogRecord(Level.INFO, "message") + r.setLoggerName("logger") + assert(f.format(r).contains("message")) + assert(f.format(r).contains("logger")) + } +} \ No newline at end of file diff --git a/project/build.properties b/project/build.properties index 133a8f1..6adcdc7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.17 +sbt.version=1.3.3 diff --git a/project/build.sbt b/project/build.sbt index 8a1e3fd..f1e66c2 100644 --- a/project/build.sbt +++ b/project/build.sbt @@ -1,7 +1,11 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.24") + Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.29") +val scalaNativeVersion = + Option(System.getenv("SCALANATIVE_VERSION")).getOrElse("0.3.9") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1") -addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "0.8.0") +addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0")