c c b b t t
play

C C B B T T Jan Christopher Vogt / @cvogt - PowerPoint PPT Presentation

A Vision for Scala Builds fun, fast, intuitive, composable, statically checked I am releasing 1.0-beta today C C B B T T Jan Christopher Vogt / @cvogt https://github.com/cvogt/talk-2016-03-04 NESCALA MARCH 4TH 2016


  1. A Vision for Scala Builds fun, fast, intuitive, composable, statically checked I am releasing 1.0-beta today C C B B T T Jan Christopher Vogt / @cvogt https://github.com/cvogt/talk-2016-03-04 NESCALA MARCH 4TH 2016 PHILADELPHIA

  2. Who am I? Jan Christopher Vogt e e l l u u d d e e h h c c s s ai y y l l l l a a c c i i g g a a s s m m g g n n i i t t e e e e m m Slick, Martin’s lab, Compossible Records, Scala Forklift, MavenSearch

  3. What’s the goal here?

  4. x.ai 25 Engineers, lots of Scala projects (CBT is my personal, free-time side-project)

  5. CBT Few, simple building blocks. Easy. Fast. Idiomatic Scala. Flexible and compositional. Easy code and contribution.

  6. Building blocks - build composition! - Scala library of functionality - builds scripts written in vanilla Scala (builds = classes, “tasks” = methods) - configuration via inheritance (shallow layer) Similar to SBT 0.7. - cli interop (back in 2011)

  7. Fast - resident JVM via Nailgun - caching of dependencies - artifacts/pom on disk - classloader in memory - run zinc only when changed - concurrency (opt-in) - native OSX file change triggers

  8. Easy to understand and contribute - focus! - tiny: < 1500 LOC - easy code! Scala beginners can understand. - bootstraps from source: install = git clone

  9. Supported features right now - compile, run, test, scaladoc - package jars - publish to sonatype - download jars from maven - file change triggers - build composition (dependent builds)

  10. Missing features (likely easy to add) 1. configurable resolvers 2. cross scala version builds 3. scalajs support 4. repl

  11. Rough edges - some aspects of - usability - logging - only tested on OSX - only used by me :)

  12. Live Demo

  13. Getting started check - README.txt

  14. Philosophy and design

  15. Builds aren’t special. Just code.

  16. Dependencies - zinc - Scala - BarbaryWatchService - ammonite-ops (still)

  17. Custom maven resolver - new implementation - proper caching - (some feature limitation still) - Coursier as a drop-in

  18. Fast re-compilation triggers - watches sources of project, build, CBT

  19. Parallel task execution - totally opt-in - requires care regarding IO - per-run result cache

  20. Build composition

  21. Build composition project2 project1 shared Can be separate git repos each one compiles project3 assembly-project

  22. Build composition Simple building block, many uses: Same rules 1. Dependent builds everywhere 2. Multi-project builds 3. Tests 4. Builds of builds 5. Whenever A needs to compile before B

  23. Current limitations

  24. Concurrent builds - not supported yet - should be fine via dependency graph - requires internal care regarding caches

  25. Re-configuration Inheritance is static Re-configuration through static code

  26. Dynamic re-configuration e.g. provide version from command line But how? Members are already hard-wired.

  27. Ad-hoc re-configuration e.g. automatically append “-SNAPSHOT” to the version number for snapshot builds But how? Code does not know the eventual class.

  28. Candidate solutions ● messy, easy, powerful: mutable members ● clean, easy, limited: hard-coded use cases ● clean, hard, powerful: code-generation (it’s a build tool after all)

  29. Example: code-generation class BasicBuild(...){ def publishSnapshot: Unit = { val reconfiguredBuild = this .mixin( new BasicBuild{ override def version = super .version+“-SNAPSHOT” } ): reconfiguredBuild b.publish } }

  30. How to contribute

  31. The code is simple ● CBT is distributed as source. You clone it. ● check DEVELOPER_GUIDE.txt ● read the code: clean and easy. ● change it, CBT re-builds itself on use ● submit a PR

  32. Write extensions ● very easy ● write traits to mix into builds ● publish as libs on maven ● depend on them in your BuildBuild

  33. Diving into the source If time permits. Otherwise unconference session.

  34. Near future work - allow different CBT and Scala versions - concurrent builds - Coursier integration - more tests - Scala Days 2016 surprise feature

  35. Future work ● git(hub) dependencies ● sbt interop

  36. CBT?!? Compositional Build Tool Complex Build Tool ;)? Cool Build Tool CBT Build Tool Compossible Build Tool COmposition Possible

  37. CBT! For now: “Chris’ Build Tool” if( year == 2017 && cbt.hasCommunity ) cbt.setName( “Community Build Tool” )

  38. NEScala special offer: I’ll make your CBT builds work. Talk to me.

  39. What’s next ● This is BETA - let the bug hunting begin ● report issues or submit PRs (easy ;)). ● let’s get it solid until Scala Days git push

  40. chris @ human.x.ai Senior Backend Engineer https://github.com/cvogt/cbt ! ! g g n n i i r r i i h h e e r r a a e e W W Twitter: @cvogt @xdotai Github: @cvogt Slides, etc

Recommend


More recommend