Skip to content

Commit

Permalink
Cross-build for 3.0.0-M1 (JVM only) (#57)
Browse files Browse the repository at this point in the history
* WIP: Dotty support

* getLogger is down to some local class name munging

* Tests pass!

* Remove redundant conditional

* Drop 0.27.0-RC1, focus on 3.0.0-M1

* Opt out of DottyJS until we can test it

* The site only works on Scala 2

* Clean up deprecation since 0.27

* Copy Logger into scala-2 and scala-3, abandon LoggerCompat

* Disable dottydoc for now

* Fix the release steps for missing Dotty build?

* When I grow up I want to write bash in yaml

* More aggressively filter scalatest on dottyJS

* Release notes, while we're here
  • Loading branch information
rossabaker committed Nov 16, 2020
1 parent 4e7e925 commit ca87082
Show file tree
Hide file tree
Showing 21 changed files with 339 additions and 169 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ scala:
- 2.11.12
- 2.12.12
- 2.13.3
- 3.0.0-M1
script:
- 'sbt -Dsbt.log.noformat=true ++$TRAVIS_SCALA_VERSION test mimaReportBinaryIssues makeSite'
- 'sbt -Dsbt.log.noformat=true ++$TRAVIS_SCALA_VERSION testIfRelevant mimaReportBinaryIssues'
- 'if [[ "${TRAVIS_SCALA_VERSION}" == 2.* ]]; then sbt -Dsbt.log.noformat=true ++$TRAVIS_SCALA_VERSION makeSite; fi'
- 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then sbt ++$TRAVIS_SCALA_VERSION publish; fi'
jdk:
- openjdk8
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ changes to how it's coded or built, see the Git history.
* Drops support for Scala 2.10
* Drops support for Scala.js 0.6
* Built against Scala 2.13.3 and 2.12.12

### 1.10.0-M1

* **Experimental** support for Scala 3.0.0-M1. Currently JVM only.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,3 +683,4 @@ Here are all other contributors, listed chronologically. Thanks to all!
- [Sean Sullivan](https://github.com/sullis)
- [Olli Helenius](https://github.com/liff)
- [Raúl Piaggio](https://github.com/rpiaggio)
- [Sergey Torgashov](https://github.com/satorg)
61 changes: 42 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
* work if you were to dynamically modify the cross-build settings. The key is
* autoimported and named `mimaReportBinaryIssues`. */
lazy val binaryCompatStep = releaseStepCommandAndRemaining("+mimaReportBinaryIssues")

// Workarounds for Dotty being incomplete
lazy val testIfRelevantStep = releaseStepCommandAndRemaining("+testIfRelevant")
lazy val publishIfRelevantStep = releaseStepCommandAndRemaining("+publishSignedIfRelevant")

/* This is the standard release process plus a binary compat check after tests */
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
testIfRelevantStep,
binaryCompatStep,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
publishIfRelevantStep,
setNextVersion,
commitNextVersion,
pushChanges
Expand All @@ -29,7 +34,8 @@ val prevArtifacts = Def.derive {
}

def jsOpts = new Def.SettingList(Seq(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
crossScalaVersions := crossScalaVersions.value.filter(_.startsWith("2."))
))

lazy val root: Project = (project in file ("."))
Expand Down Expand Up @@ -93,23 +99,24 @@ lazy val core = (crossProject(JSPlatform, JVMPlatform) in file ("core"))
slf4j,
logback % "test",
"org.scalacheck" %%% "scalacheck" % scalacheckVersion % "test",
"org.scalatest" %%% "scalatest" % scalatestVersion % "test",
"org.scalatestplus" %%% "scalacheck-1-15" % scalatestPlusScalacheckVersion % "test",
reflect.value % "provided"
),
libraryDependencies ++= {
if (isDotty.value) Seq.empty
else Seq(reflect.value)
},

unmanagedSourceDirectories in Compile ++= {
scalaBinaryVersion.value match {
case "2.10" | "2.11" =>
Seq.empty
case _ =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2.11")
case s if s.startsWith("2.") =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2")
case s if s.startsWith("3.") =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-3")
}
},

unmanagedSourceDirectories in Compile ++= {
scalaBinaryVersion.value match {
case "2.10" | "2.11" | "2.12" =>
case "2.11" | "2.12" =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-oldcoll")
case _ =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-newcoll")
Expand All @@ -118,7 +125,11 @@ lazy val core = (crossProject(JSPlatform, JVMPlatform) in file ("core"))

)
.jvmSettings(
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalajsStubsVersion % "provided",
libraryDependencies += ("org.scala-js" %% "scalajs-stubs" % scalajsStubsVersion % "provided").withDottyCompat(scalaVersion.value),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % scalatestVersion,
"org.scalatestplus" %%% "scalacheck-1-15" % scalatestPlusScalacheckVersion
),
prevVersions := {
/* I'm using the first & last version of each minor release rather than
* including every single patch-level update. */
Expand All @@ -137,19 +148,29 @@ lazy val core = (crossProject(JSPlatform, JVMPlatform) in file ("core"))
def `2.13Versions` =
Set("1.8.2",
"1.9.0")
def DottyVersions =
Set.empty[String]
scalaBinaryVersion.value match {
case "2.11" => `2.11Versions` ++ `2.12Versions` ++ `2.13Versions`
case "2.12" => `2.12Versions` ++ `2.13Versions`
case "2.13" => `2.13Versions`
case other =>
case "2.11" => `2.11Versions` ++ `2.12Versions` ++ `2.13Versions` ++ DottyVersions
case "2.12" => `2.12Versions` ++ `2.13Versions` ++ DottyVersions
case "2.13" => `2.13Versions` ++ DottyVersions
case "3.0.0-M1" => DottyVersions
case other =>
sLog.value.info(s"No known MIMA artifacts for: $other")
Set.empty
}
}
)
.jsSettings(jsOpts)
.jsSettings(
prevVersions := jsPrevVersions
prevVersions := jsPrevVersions,
libraryDependencies ++= {
if (!isDotty.value) Seq(
"org.scalatest" %%% "scalatest" % scalatestVersion,
"org.scalatestplus" %%% "scalacheck-1-15" % scalatestPlusScalacheckVersion
)
else Seq.empty
}
)

lazy val coreJS = core.js
Expand All @@ -172,9 +193,11 @@ lazy val testing = (crossProject(JSPlatform, JVMPlatform) in file ("testing"))
prevVersions := {
val `2.12Versions` = Set("1.5.0", "1.6.0", "1.6.1", "1.7.0", "1.8.0", "1.8.1")
val `2.13Versions` = Set("1.8.2")
val DottyVersions = Set.empty[String]
scalaBinaryVersion.value match {
case "2.10" | "2.11" | "2.12" => `2.12Versions` ++ `2.13Versions`
case "2.13" => `2.13Versions`
case "2.11" | "2.12" => `2.12Versions` ++ `2.13Versions` ++ DottyVersions
case "2.13" => `2.13Versions` ++ DottyVersions
case "3.0.0-M1" => DottyVersions
case other =>
Set.empty
}
Expand Down
131 changes: 0 additions & 131 deletions core/shared/src/main/scala-2.10/org/log4s/LoggerMacros.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,4 @@ final class Logger(val logger: JLogger) extends AnyVal {

def error(t: Throwable)(msg: String): Unit = macro errorTM
def error(msg: String): Unit = macro errorM

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org

import language.experimental.macros
import scala.language.experimental.macros

package object log4s extends log4s.`package-platform` {
def getLogger: org.log4s.Logger = macro LoggerMacros.getLoggerImpl
def getLogger: Logger = macro LoggerMacros.getLoggerImpl
def getLogger(name: String) = new Logger(org.slf4j.LoggerFactory.getLogger(name))
def getLogger(clazz: Class[_]) = new Logger(org.slf4j.LoggerFactory.getLogger(clazz))
}
Loading

0 comments on commit ca87082

Please sign in to comment.