These are chat archives for sbt/sbt

30th
May 2016
RomanIakovlev
@RomanIakovlev
May 30 2016 12:04
@drdozer heh, I’ve implemented exactly this at work recently, but it’s closed source for now. So yeah, it’s possible, with some tricks.
Even more, I’ve implemented something like starting the interactive sbt console in the docker from the sbt command on the host. Sbt inception, sort of.
Miles Sabin
@milessabin
May 30 2016 14:29
Paging @eed3si9n @dwijnand @InTheNow @fommil (and anyone else for that matter :-) ) ... comments on #2634 would be very welcome.
InTheNow
@InTheNow
May 30 2016 14:32
Do I need to sign a CLA to comment?
Miles Sabin
@milessabin
May 30 2016 14:32
Not to comment.
Yes, the CLA is a bit of a problem. I'm no happier signing it than @fommil.
Sam Halliday
@fommil
May 30 2016 14:35
I've given a few comments, the impl is beyond my knowledge but I have a few tiny things to say on testing
Matthew Pocock
@drdozer
May 30 2016 14:51
@RomanIakovlev thanks. That gives me hope I can implement it.
RomanIakovlev
@RomanIakovlev
May 30 2016 14:55
@drdozer essentially it boils down to building an image with sbt-docker and then running a process (I’ve used ammonite-ops for that). Like this: docker run <your_image_id_from_sbt-docker> /bin/sh -c ’sbt test’. If you don’t want an interactive mode, then you can just run it directly in sbt.
Matthew Pocock
@drdozer
May 30 2016 14:56
@RomanIakovlev I'm looking at extending sbt-docker to manage container lifecycles
  createOptions in docker := new CreateOptions {
    image("mysql")
    expose(22)
    port("0.0.0.0", 3306, 3306)
    port("0.0.0.0:9022:22")
  }
RomanIakovlev
@RomanIakovlev
May 30 2016 14:56
@drdozer Sounds good!
Matthew Pocock
@drdozer
May 30 2016 14:57
so the idea would be to hook in a docker + create to set up a container with your schema in it, then issue start/stop on that container before/after generateSources
but I'm being hampered by not really understanding sbt - currently I'm getting some confusing NoClassDefFoundError messages
Matthew Pocock
@drdozer
May 30 2016 15:03
are sbt plugins sandboxed in classpaths of their own?
RomanIakovlev
@RomanIakovlev
May 30 2016 15:03
No, they can access everything in the project that hosts them.
Well, at least in the context of a task or a command.
Matthew Pocock
@drdozer
May 30 2016 15:04
OK, I think my meta-project had become corrupted - manually deleting all target directories seems to have got it working again
RomanIakovlev
@RomanIakovlev
May 30 2016 15:05
Yeah, that happens sometimes...
Matthew Pocock
@drdozer
May 30 2016 15:14
ok, so I'm hacking on a plugin -- it looks like when the snapshot of the plugin updates and I then reload the project I'm testing the plugin inside, that the classpaths in the test project's meta project are getting mangled somehow
I have to delete all the target folders and do a completely virgin clean go guarantee it won't throw class not found errors
RomanIakovlev
@RomanIakovlev
May 30 2016 15:15
Ah yeah, I faced this too. You have to restart sbt comptelety to get rid of that.
Well, in my case a restart was enough.
In other words, after “reload” or “update” inside the current sbt session compilation produced some cryptic errors, but exiting sbt and starting it again helped.
Matthew Pocock
@drdozer
May 30 2016 15:16
glad it is not just me
Erik Osheim
@non
May 30 2016 15:49
@InTheNow @milessabin for better or worse i've signed the CLA in the past, so if someone who isn't comfortable CLA-ing needs something done i'm happy to be a proxy (if necessary)
(assuming there is a legal way to be a proxy of course, haha)
Miles Sabin
@milessabin
May 30 2016 15:52
@non thanks for the offer :-)
InTheNow
@InTheNow
May 30 2016 15:52
@non thanks too ;)
Matthew Pocock
@drdozer
May 30 2016 16:06
ok, so I've implemented a working dockerCreate command, as taskKey[ContainerId]("Create a docker container.")
it returns the id of the container it created
RomanIakovlev
@RomanIakovlev
May 30 2016 16:07
By creating you mean starting it?
Matthew Pocock
@drdozer
May 30 2016 16:07
so say i want to use that same ContainerId in the dockerStart command (that I've not written yet) -- how do I plumb that ContainerId value into dockerStart?
no, I mean docker create
RomanIakovlev
@RomanIakovlev
May 30 2016 16:08
Hmm, I thought you use sbt-docker for that
Matthew Pocock
@drdozer
May 30 2016 16:08
Before my patches, sbt-docker makes docker images. It doesn't create/start/stop docker containers from those images
RomanIakovlev
@RomanIakovlev
May 30 2016 16:09
Anyways, you can just use the dockerCreate.value of that task in dockerStart task. Sbt understands the dependencies between tasks and will run your dockerCreate before the dockerStart.
Matthew Pocock
@drdozer
May 30 2016 16:51
@RomanIakovlev thanks, that's working :D
so I can now create and start containers -- time for a break and then I'll implement stop and rm
nafg
@nafg
May 30 2016 18:13
@drdozer there's anothere scala docker library that might be more geared towards what you're trying to do
Set of utility classes to make integration testing with dockerised services in Scala easy.
Though a bit... aged
Matthew Pocock
@drdozer
May 30 2016 18:33
@nafg I've kind of implemented it now
marcuslonnberg/sbt-docker#48
thanks for the blog post link :D
Matthew Pocock
@drdozer
May 30 2016 18:53
how does sbt work out if a task needs to be re-run or if the old value is not yet stale?
or do I need to do the staleness book-keeping within the task itself?