sbt / sbt-remote-control

Create and manage sbt process using unicorns and forks
Other
74 stars 14 forks source link

DynamicSerialization - just for values or also messages? #169

Closed havocp closed 10 years ago

havocp commented 10 years ago

The doc comment says SbtClient.dynamicSerialization is for values AND messages. But right now it doesn't look like that's true (the Message trait is sealed and we never look up message Format in dynamicSerialization).

One fix could be:

Just an initial sketch, not sure how it will play out.

havocp commented 10 years ago

Just saw we have sendRawEvent on UIContext which uses dynamic serialization. In my proposal I'd suggest we delete this. Why would I have access to T but not Writes[T] if I am an sbt plugin working with T and UIContext? I should have the Writes[T].

Values are different because they are sent generically by the task engine, rather than sent by the task itself. The task itself sends events and knows the type statically so can just provide a Writes.

havocp commented 10 years ago

Another aspect of this is https://github.com/sbt/sbt-remote-control/issues/167 - just looked through Protocol.scala and none of the current messages are OK for a plugin or task to send. They are all only for the sbt server engine to send. So CustomEvent really is just TaskEvent or something like that - and task events should probably have their whole own namespace. Sending ExecutionStarted from a task should make a TaskEvent(ExecutionStarted) not a toplevel ExecutionStarted.