Skip to content

Commit

Permalink
Merge pull request #72 from sparsetech/feat/deps
Browse files Browse the repository at this point in the history
Build: Update dependencies
  • Loading branch information
tindzk authored Oct 4, 2020
2 parents 19a1b0d + 9e491c6 commit 64fc19f
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 113 deletions.
4 changes: 3 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ steps:
commands:
- apk add --no-cache yarn
- yarn add jsdom object-sizeof
# Patch Bloop version to support Scala.js 1.0
- apk add --no-cache curl && curl -L https://github.com/scalacenter/bloop/releases/download/v1.4.0-RC1/install.py | python - -d /usr/bin/ -v 1.4.0-RC1-229-b7c15aa9 || true
- blp-server &
- seed --build=build211.toml bloop
- bloop compile pine-native
- bloop test pine-jvm pine-js
- bloop test pine-jvm
- sleep 5 # Synchronise analysis.bin files, otherwise rm might fail
- rm -rf .bloop build
- seed --build=build212.toml bloop
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:

# See https://github.com/scala-js/scala-js/issues/2642
script:
sbt 'set parallelExecution in ThisBuild := false' pineJS2_11/test pineJVM2_11/test pineNative2_11/test pineJS2_12/test pineJVM2_12/test pineJS2_13/test pineJVM2_13/test
sbt 'set parallelExecution in ThisBuild := false' pineJVM2_11/test pineNative2_11/test pineJS2_12/test pineJVM2_12/test pineJS2_13/test pineJVM2_13/test

# From http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html
# Use container-based infrastructure
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ Pine is a functional HTML5 and XML library for the Scala platform. It supports p
* DSL for attaching/detaching events

## Compatibility
| Back end | Scala versions |
|:---------------|:-----------------|
| JVM | 2.11, 2.12, 2.13 |
| JavaScript (1) | 2.11, 2.12, 2.13 |
| Native | 2.11 |
| Platform | Platform version | Scala versions |
|:-------------|:-----------------|:-----------------------------|
| JVM | | 2.11 (T), 2.12 (T), 2.13 (L) |
| Scala.js | 1.0 | 2.12 (T), 2.13 (L) |
| Scala Native | 0.4.0-M2 | 2.11 (T) |

* (1) Adds support for browser DOM
* (T): Typelevel Scala
* (L): Lightbend Scala

## Examples
```scala
Expand All @@ -52,7 +53,7 @@ Pine makes use of a language extension called *literal types*, see [SIP-23](http

### 2.13 onwards
```scala
scalaVersion := "2.13.0"
scalaVersion := "2.<version>"
libraryDependencies += scalaOrganization.value % "scala-reflect" % scalaVersion.value
```

Expand All @@ -79,8 +80,8 @@ addCompilerPlugin("org.scala-native" % "nscplugin" % nativeVersion cross CrossVe

### Dependencies
```scala
libraryDependencies += "tech.sparse" %% "pine" % "0.1.3" // JVM
libraryDependencies += "tech.sparse" %%% "pine" % "0.1.3" // JavaScript, Native
libraryDependencies += "tech.sparse" %% "pine" % "<version>" // JVM
libraryDependencies += "tech.sparse" %%% "pine" % "<version>" // JavaScript, Native
```

## Links
Expand Down
35 changes: 11 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ val V = new {
val paradise = "2.1.1"
val scala2_11 = "2.11.11-bin-typelevel-4"
val scala2_12 = "2.12.4-bin-typelevel-4"
val scala2_13 = "2.13.1"
val scalaTest = "3.0.8"
val scalaTestNative = "3.2.0-SNAP10"
val scalaCheck = "1.14.0"
val scalaCheckNative = "1.14.1"
val scalaJsDom = "0.9.7"
val scala2_13 = "2.13.3"
val scalaTest = "3.2.2"
val scalaCheck = "1.14.3"
val scalaJsDom = "1.1.0"
}

ThisBuild / scalaVersion := V.scala2_13
Expand All @@ -25,6 +23,9 @@ val commonSettings = nocomma {
libraryDependencies ++= Seq(
scalaOrganization.value % "scala-reflect" % scalaVersion.value % "provided",
scalaOrganization.value % "scala-compiler" % scalaVersion.value % "provided",

"org.scalatest" %%% "scalatest" % V.scalaTest % "test",
"org.scalacheck" %%% "scalacheck" % V.scalaCheck % "test"
)

scalacOptions ++= Seq(
Expand All @@ -44,7 +45,6 @@ val commonSettings = nocomma {
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
Expand All @@ -59,7 +59,7 @@ val commonSettings = nocomma {

val Pre13Settings = nocomma {
scalaOrganization := "org.typelevel"

scalacOptions ++= Seq(
"-Xfuture", // Turn on future language features.
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
Expand All @@ -72,7 +72,7 @@ val Pre13Settings = nocomma {
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
)

addCompilerPlugin("org.scalamacros" %% "paradise" % V.paradise cross CrossVersion.patch)
}

Expand All @@ -98,18 +98,11 @@ val Scala13Settings = Post11Settings ++ nocomma {
scalacOptions += "-Ymacro-annotations"
}

val JvmSettings = nocomma {
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % V.scalaTest % "test",
"org.scalacheck" %% "scalacheck" % V.scalaCheck % "test",
)
}
val JvmSettings = Seq()

val JsSettings = nocomma {
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % V.scalaTest % "test",
"org.scalacheck" %%% "scalacheck" % V.scalaCheck % "test",
"org.scala-js" %%% "scalajs-dom" % V.scalaJsDom,
"org.scala-js" %%% "scalajs-dom" % V.scalaJsDom
)

// We need to remove and re-add this if working under the typelevel compiler
Expand All @@ -123,11 +116,6 @@ val JsSettings = nocomma {
}

val NativeSettings = nocomma {
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % V.scalaTestNative % "test",
"com.github.lolgab" %%% "scalacheck" % V.scalaCheckNative % "test"
)

libraryDependencies ~= (_.filterNot(_.name == "nscplugin"))
addCompilerPlugin("org.scala-native" % "nscplugin" % nativeVersion cross CrossVersion.patch)

Expand All @@ -145,7 +133,6 @@ lazy val pine = (projectMatrix in file("."))
.jvmPlatform( Seq(V.scala2_11), JvmSettings ++ Scala11Settings)
.jsPlatform( Seq(V.scala2_13), JsSettings ++ Scala13Settings)
.jsPlatform( Seq(V.scala2_12), JsSettings ++ Scala12Settings)
.jsPlatform( Seq(V.scala2_11), JsSettings ++ Scala11Settings)
.nativePlatform( Seq(V.scala2_11), NativeSettings ++ Pre13Settings)

// root settings. src/ is handled by sbt-projectmatrix
Expand Down
30 changes: 6 additions & 24 deletions build211.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[project]
scalaVersion = "2.11.11-bin-typelevel-4"
scalaJsVersion = "0.6.28"
scalaNativeVersion = "0.3.7"
scalaNativeVersion = "0.4.0-M2"
scalaOptions = [
"-deprecation", # Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", # Specify character encoding used by source files.
Expand Down Expand Up @@ -31,7 +30,7 @@ scalaOptions = [
"-Ywarn-numeric-widen", # Warn when numerics are widened.

### pre-13 options ###

"-Xfuture", # Turn on future language features.
"-Xlint:by-name-right-associative", # By-name parameter of right associative operator.
"-Xlint:unsound-match", # Pattern match may not be typesafe.
Expand All @@ -52,45 +51,28 @@ testFrameworks = [
[module.pine]
root = "src/main/scala"
sources = ["src/main/scala"]
targets = ["js", "jvm", "native"]
targets = ["jvm", "native"]

[module.pine.test]
sources = ["src/test/scala"]
targets = ["js", "jvm"]
targets = ["jvm"]
scalaDeps = [
["org.scalatest" , "scalatest" , "3.0.8" ],
["org.scalacheck", "scalacheck", "1.14.0"]
["org.scalatest" , "scalatest" , "3.2.2" ],
["org.scalacheck", "scalacheck", "1.14.3"]
]

[module.pine.jvm]
root = "src/main/scala-jvm"
sources = ["src/main/scala-jvm"]

[module.pine.js]
root = "src/main/scala-js"
sources = ["src/main/scala-js"]
scalaDeps = [
["org.scala-js", "scalajs-dom", "0.9.7"]
]

[module.pine.test.js]
jsdom = true
sources = ["src/test/scala-js"]

[module.pine-bench]
moduleDeps = ["pine"]
root = "src/bench"
sources = ["src/bench/shared"]
targets = ["js", "jvm"]

[module.pine-bench.jvm]
root = "src/bench/jvm"
sources = ["src/bench/jvm"]
javaDeps = [
["org.openjdk.jol", "jol-core", "0.13"]
]

[module.pine-bench.js]
root = "src/bench/js"
sources = ["src/bench/js"]
moduleKind = "commonjs"
10 changes: 5 additions & 5 deletions build212.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
scalaVersion = "2.12.4-bin-typelevel-4"
scalaJsVersion = "0.6.28"
scalaJsVersion = "1.0.1"
scalaOptions = [
"-deprecation", # Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", # Specify character encoding used by source files.
Expand Down Expand Up @@ -42,7 +42,7 @@ scalaOptions = [
# "-Ywarn-value-discard" # Warn when non-Unit expression results are unused.

### pre-13 options ###

"-Xfuture", # Turn on future language features.
"-Xlint:by-name-right-associative", # By-name parameter of right associative operator.
"-Xlint:unsound-match", # Pattern match may not be typesafe.
Expand All @@ -69,8 +69,8 @@ targets = ["js", "jvm"]
sources = ["src/test/scala"]
targets = ["js", "jvm"]
scalaDeps = [
["org.scalatest" , "scalatest" , "3.0.8" ],
["org.scalacheck", "scalacheck", "1.14.0"]
["org.scalatest" , "scalatest" , "3.1.1" ],
["org.scalacheck", "scalacheck", "1.14.3"]
]

[module.pine.jvm]
Expand All @@ -81,7 +81,7 @@ sources = ["src/main/scala-jvm"]
root = "src/main/scala-js"
sources = ["src/main/scala-js"]
scalaDeps = [
["org.scala-js", "scalajs-dom", "0.9.7"]
["org.scala-js", "scalajs-dom", "1.1.0"]
]

[module.pine.test.js]
Expand Down
11 changes: 5 additions & 6 deletions build213.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
scalaVersion = "2.13.0"
scalaJsVersion = "0.6.28"
scalaVersion = "2.13.2"
scalaJsVersion = "1.0.1"
scalaOptions = [
"-deprecation", # Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", # Specify character encoding used by source files.
Expand All @@ -18,7 +18,6 @@ scalaOptions = [
"-Xlint:inaccessible", # Warn about inaccessible types in method signatures.
"-Xlint:infer-any", # Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", # A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", # Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", # Warn when nullary methods return Unit.
"-Xlint:option-implicit", # Option.apply used implicit view.
"-Xlint:package-object-classes", # Class or object defined in package object.
Expand Down Expand Up @@ -55,8 +54,8 @@ targets = ["js", "jvm"]
sources = ["src/test/scala"]
targets = ["js", "jvm"]
scalaDeps = [
["org.scalatest" , "scalatest" , "3.0.8" ],
["org.scalacheck", "scalacheck", "1.14.0"]
["org.scalatest" , "scalatest" , "3.1.1" ],
["org.scalacheck", "scalacheck", "1.14.3"]
]

[module.pine.jvm]
Expand All @@ -67,7 +66,7 @@ sources = ["src/main/scala-jvm"]
root = "src/main/scala-js"
sources = ["src/main/scala-js"]
scalaDeps = [
["org.scala-js", "scalajs-dom", "0.9.7"]
["org.scala-js", "scalajs-dom", "1.1.0"]
]

[module.pine.test.js]
Expand Down
5 changes: 3 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logLevel := Level.Warn
// see http://eed3si9n.com/removing-commas-with-sbt-nocomma
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.3.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.7")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.2.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")

libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"
4 changes: 2 additions & 2 deletions src/bench/js/pine/bench/PlatformBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import pine.dom._
import pine.bench.BenchUtil._

class PlatformBench extends BenchmarkSuite with TreeBench {
val isNodeJs = js.isUndefined(org.scalajs.dom.window)
val isNodeJs = js.typeOf(js.Dynamic.global.window) == "undefined"

if (isNodeJs) println("[warn] Ignoring all tests requiring DOM access")
else {
Expand All @@ -17,7 +17,7 @@ class PlatformBench extends BenchmarkSuite with TreeBench {
org.scalajs.dom.document.body.appendChild(rendered)
DOM.render { implicit ctx => ref := "test" }
org.scalajs.dom.document.body.removeChild(rendered)
numberOfNodes(depth) -> ()
numberOfNodes(depth) -> (())
}

bench("Render as DOM node", depths, measureMemory = false) { depth =>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/js/pine/bench/PlatformUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object SizeOf extends js.Object {

object PlatformUtil {
def cliArgs(): List[String] =
if (js.isUndefined(js.Dynamic.global.process)) List()
if (js.typeOf(js.Dynamic.global.process) == "undefined") List()
else js.Dynamic.global.process.argv.asInstanceOf[js.Array[String]].toList.drop(2)
def format(value: Double): String = value.toFixed(1)
def measure(obj: Any): Long =
Expand Down
18 changes: 2 additions & 16 deletions src/main/scala-js/pine/dom/Js.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,20 @@ trait JsLowPrio {
object Js extends JsLowPrio {
implicit object JsA extends JsHtml[tag.A] { override type X = dom.html.Anchor }
implicit object JsB extends JsHtml[tag.B] { override type X = dom.html.Span }
@deprecated("Element is deprecated", since = "html5")
implicit object JsApplet extends JsHtml[tag.Applet] { override type X = dom.html.Applet }
implicit object JsArea extends JsHtml[tag.Area] { override type X = dom.html.Area }
implicit object JsAudio extends JsHtml[tag.Audio] { override type X = dom.html.Audio }
implicit object JsBR extends JsHtml[tag.Br] { override type X = dom.html.BR }
implicit object JsBase extends JsHtml[tag.Base] { override type X = dom.html.Base }
@deprecated("Element is deprecated", since = "html5")
implicit object JsBaseFont extends JsHtml[tag.Basefont] { override type X = dom.html.BaseFont }
implicit object JsBody extends JsHtml[tag.Body] { override type X = dom.html.Body }
implicit object JsButton extends JsHtml[tag.Button] { override type X = dom.html.Button }
implicit object JsCanvas extends JsHtml[tag.Canvas] { override type X = dom.html.Canvas }
// implicit object JsCollection extends JsHtml[tag.Col] { override type X = dom.html.Collection }
implicit object JsDD extends JsHtml[tag.Dd] { override type X = dom.html.DD }
implicit object JsDList extends JsHtml[tag.Dl] { override type X = dom.html.DList }
implicit object JsDT extends JsHtml[tag.Dt] { override type X = dom.html.DT }
implicit object JsDataList extends JsHtml[tag.Datalist] { override type X = dom.html.DataList }
@deprecated("Element is deprecated", since = "html5")
implicit object JsDirectory extends JsHtml[tag.Dir] { override type X = dom.html.Directory }
implicit object JsDiv extends JsHtml[tag.Div] { override type X = dom.html.Div }
implicit object JsEmbed extends JsHtml[tag.Embed] { override type X = dom.html.Embed }
implicit object JsFieldSet extends JsHtml[tag.Fieldset] { override type X = dom.html.FieldSet }
implicit object JsForm extends JsHtml[tag.Form] { override type X = dom.html.Form }
@deprecated("Element is deprecated", since = "html5")
implicit object JsFrame extends JsHtml[tag.Frame] { override type X = dom.html.Frame }
@deprecated("Element is deprecated", since = "html5")
implicit object JsFrameSet extends JsHtml[tag.Frameset] { override type X = dom.html.FrameSet }
implicit object JsH1 extends JsHtml[tag.H1] { override type X = dom.html.Heading }
implicit object JsH2 extends JsHtml[tag.H2] { override type X = dom.html.Heading }
implicit object JsH3 extends JsHtml[tag.H3] { override type X = dom.html.Heading }
Expand All @@ -54,8 +42,6 @@ object Js extends JsLowPrio {
implicit object JsIFrame extends JsHtml[tag.Iframe] { override type X = dom.html.IFrame }
implicit object JsImage extends JsHtml[tag.Img] { override type X = dom.html.Image }
implicit object JsInput extends JsHtml[tag.Input] { override type X = dom.html.Input }
@deprecated("Element is deprecated", since = "html5")
implicit object JsIsIndex extends JsHtml[tag.Isindex] { override type X = dom.html.IsIndex }
implicit object JsLabel extends JsHtml[tag.Label] { override type X = dom.html.Label }
implicit object JsLegend extends JsHtml[tag.Legend] { override type X = dom.html.Legend }
implicit object JsLi extends JsHtml[tag.Li] { override type X = dom.html.LI }
Expand All @@ -80,8 +66,8 @@ object Js extends JsLowPrio {
implicit object JsStyle extends JsHtml[tag.Style] { override type X = dom.html.Style }
implicit object JsTable extends JsHtml[tag.Table] { override type X = dom.html.Table }
implicit object JsTableRow extends JsHtml[tag.Tr] { override type X = dom.html.TableRow }
implicit object JsTableDataCell extends JsHtml[tag.Td] { override type X = dom.html.TableDataCell }
implicit object JsTableHeadCell extends JsHtml[tag.Th] { override type X = dom.html.TableHeaderCell }
implicit object JsTableDataCell extends JsHtml[tag.Td] { override type X = dom.html.TableCell }
implicit object JsTableHeadCell extends JsHtml[tag.Th] { override type X = dom.html.TableCell }
implicit object JsTextArea extends JsHtml[tag.Textarea] { override type X = dom.html.TextArea }
implicit object JsTitle extends JsHtml[tag.Title] { override type X = dom.html.Title }
implicit object JsTrack extends JsHtml[tag.Track] { override type X = dom.html.Track }
Expand Down
Loading

0 comments on commit 64fc19f

Please sign in to comment.