From 7b4ced648ecd9b79b3a16d67552f0bb69f4dd543 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Wed, 31 Oct 2018 20:44:53 +0000 Subject: Add tut contrib module (#464) * Add tut contrib module * Add TutModule tests and documentation * Use Path instead of PathRef for tut target directory * Use the correct scala version in TutModule * Ensure resolving tut doesn't bring in extra scala-library jars * Ensure MILL_VERSION system property is set in tut tests * Fork to run tut to fix classpath problems, add test with library usage * Follow convention w.r.t. publishVersion in testArgs * Add Scaladoc to TutModule * Don't supply a default version of Tut * Update docs to account for mandatory tutVersion setting * Inline tutArgs, otherwise Tut does not recompile when sources change --- main/core/src/mill/util/JsonFormatters.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'main/core') diff --git a/main/core/src/mill/util/JsonFormatters.scala b/main/core/src/mill/util/JsonFormatters.scala index f92941f7..2728d94d 100644 --- a/main/core/src/mill/util/JsonFormatters.scala +++ b/main/core/src/mill/util/JsonFormatters.scala @@ -3,6 +3,7 @@ package mill.util import ammonite.ops.{Bytes, Path} import upickle.Js import upickle.default.{ReadWriter => RW} +import scala.util.matching.Regex object JsonFormatters extends JsonFormatters trait JsonFormatters { implicit val pathReadWrite: RW[ammonite.ops.Path] = upickle.default.readwriter[String] @@ -11,6 +12,12 @@ trait JsonFormatters { Path(_) ) + implicit val regexReadWrite: RW[Regex] = upickle.default.readwriter[String] + .bimap[Regex]( + _.pattern.toString, + _.r + ) + implicit val bytesReadWrite: RW[Bytes] = upickle.default.readwriter[String] .bimap( o => javax.xml.bind.DatatypeConverter.printBase64Binary(o.array), -- cgit v1.2.3