diff options
author | Tobias Roeser <le.petit.fou@web.de> | 2018-10-05 14:43:37 +0200 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-10-05 20:43:37 +0800 |
commit | 718907eb9b5252e44d704609f63fe280765ba776 (patch) | |
tree | 106dea2612f29d9a6b2ff4b4f6913bd999142d71 /docs | |
parent | b1082cf0ab772108fdd82b79a366ab59829a9907 (diff) | |
download | mill-718907eb9b5252e44d704609f63fe280765ba776.tar.gz mill-718907eb9b5252e44d704609f63fe280765ba776.tar.bz2 mill-718907eb9b5252e44d704609f63fe280765ba776.zip |
Example how to make case class serializable (#450)
* Example how to make case class serializable
* Fixed typo in docs
Diffstat (limited to 'docs')
-rw-r--r-- | docs/pages/4 - Tasks.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/pages/4 - Tasks.md b/docs/pages/4 - Tasks.md index a08bd032..6c7737e0 100644 --- a/docs/pages/4 - Tasks.md +++ b/docs/pages/4 - Tasks.md @@ -92,6 +92,16 @@ automatically JSON-serialized and stored at `out/classFiles/meta.json`. The return-value of targets has to be JSON-serializable via [uPickle](https://github.com/lihaoyi/upickle). +In case you want return your own +case class (e.g. `MyCaseClass`), you can make it JSON-serializable by adding the +following implicit def to its companion object: + +```scala +object MyCaseClass { + implicit def rw: upickle.default.ReadWriter[MyCaseClass] = upickle.default.macroRW +} +``` + If you want to return a file or a set of files as the result of a `Target`, write them to disk within your `T.ctx().dest` available through the [Task Context API](#task-context-api) and return a `PathRef` to the files you |