Skip to content

Commit

Permalink
Add Scala 2.13 compilation target (#142)
Browse files Browse the repository at this point in the history
* Add cross target back

* Exclude plugins and compiler options no longer valid in 2.13

* Upgrade parser combinators and Scala 2.13

* Fix core dependencies settings

* Update 2.13 dependencies

* Adapting testkit for Scala 2.13

* Pass tests in 2.12.8

* Drop Scala 2.11.x support

* Add compatibility with Scala 2.13 LazyList

* Fix non exhaustive match

* Remove Scala 2.11 left-overs

* Add some mima exclusions for the changes in the testkit

* Additional mima exclusions

* Use previous stable version in mima bin compat

* Exclude remaining MiMa issues

* Update changelog

* Test parser performance only on Scala 2.12

* Remove docs module from aggregated build

* Publish docs only on 2.12

* Fiddling with the string interpolator

* More fiddling but no luck

* Measure parser performance in microseconds

* Improve validator benchmark

* Upgrade dependencies

* Move the compiler plugins into its own file

* Remove conditional version on parser combinators

* Add docs to the aggregated list of modules

* Remove contextual

* Remove matching at val side

* Remove additional unsafe matches
  • Loading branch information
alonsodomin committed Aug 23, 2019
1 parent adda7cf commit abe7905
Show file tree
Hide file tree
Showing 71 changed files with 436 additions and 325 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jdk:
- openjdk11

scala:
- 2.11.12
- 2.13.0
- 2.12.9

cache:
Expand Down
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@

New Features:

* [#142](https://github.com/alonsodomin/cron4s/pull/142): Add support for Scala 2.13 (and drop support for Scala 2.11)
* [#149](https://github.com/alonsodomin/cron4s/pull/149): Add extension module for [doobie](https://tpolecat.github.io/doobie/).
Find documentation about it in the [doobie extension](https://alonsodomin.github.io/cron4s/extensions/doobie.html) docs.
* [#138](https://github.com/alonsodomin/cron4s/pull/138): Rewrite parser using Scala Parser Combinators instead of FastParse.

Version upgrades:

* Scala 2.11.12 / Scala 2.12.9
* Scala 2.12.9 / Scala 2.13.0
* ScalaJS 0.6.28
* Cats 1.6.1
* Decline 0.6.2
* Circe 0.11.1
* Cats 2.0.0-M4
* Decline 0.7.0-M0
* Circe 0.12.0-M4
* Contextual 1.2.1
* ScalaJS MomentJS 0.10.0 / MomentJS 0.5.25
* Scala Java Time 2.0.0-RC3

## 0.5.0
Expand Down
7 changes: 6 additions & 1 deletion bench/src/main/scala/cron4s/bench/ParserBenchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@

package cron4s.bench

import java.util.concurrent.TimeUnit

import cron4s._

import org.openjdk.jmh.annotations._

@State(Scope.Thread)
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class ParserBenchmark {

@Param(
Array(
"10-35 2,4,6 * ? * *",
"* 5,10,15,20,25,30,35,40,45,50,55/2 * ? * mon-fri",
"10-65 * * * * *",
"* */10 5-10 ? * mon-fri"
"* */10 5-10 ? * mon-fri",
"*/30 10,20,40 5-15,25-35/4 ? 1,3,7,oct-dec sun"
)
)
var cronString: String = _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package cron4s.bench

import java.util.concurrent.TimeUnit

import cron4s._
import cron4s.expr._
import cron4s.validation.NodeValidator
Expand All @@ -28,6 +30,8 @@ import org.openjdk.jmh.annotations._
* Created by alonsodomin on 02/02/2017.
*/
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class SeveralNodeValidatorBenchmark {
import CronField._

Expand Down Expand Up @@ -60,11 +64,12 @@ class SeveralNodeValidatorBenchmark {

val _constImpliedByRange = SeveralNode(
ConstNode[Second](23),
BetweenNode[Second](ConstNode(17), ConstNode(30))
BetweenNode[Second](ConstNode(10), ConstNode(15)),
BetweenNode[Second](ConstNode(20), ConstNode(30)),
)
val _constImpliedByRangeReverse = SeveralNode(
val _overlappingRanges = SeveralNode(
BetweenNode[Second](ConstNode(17), ConstNode(30)),
ConstNode[Second](23)
BetweenNode[Second](ConstNode(25), ConstNode(50)),
)

@Benchmark
Expand Down Expand Up @@ -100,7 +105,7 @@ class SeveralNodeValidatorBenchmark {
NodeValidator[SeveralNode[Second]].validate(_constImpliedByRange)

@Benchmark
def constImpliedByRangeReverse(): List[InvalidField] =
NodeValidator[SeveralNode[Second]].validate(_constImpliedByRangeReverse)
def overlappingRanges(): List[InvalidField] =
NodeValidator[SeveralNode[Second]].validate(_overlappingRanges)

}

0 comments on commit abe7905

Please sign in to comment.