Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

2

Share

Download to read offline

sbt 1

Download to read offline

sbt 1 talk given at Scala Days New York 2018

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

sbt 1

  1. 1. sbt 1 Eugene Yokota (@eed3si9n) Dale Wijnand (@dwijnand)
 June 2018
  2. 2. • Lightbend Tooling team who are these guys Eugene (@eed3si9n) Dale (@dwijnand) • Lightbend Tooling team
  3. 3. sbt by example • https://www.scala-sbt.org/1.x/docs/sbt-by- example.html
  4. 4. overhaul
  5. 5. overhaul
  6. 6. overhaul • remove old parts • update new parts • know-how of rebuilding the parts
  7. 7. goal of sbt 1 • minimize conceptual jump from sbt 0.13
  8. 8. sbt 1 (updated parts) • Semantic Versioning • Binary compatible throughout 1.y.z • Feature releases and Patch releases
  9. 9. sbt 1 (updated parts) • Use Maven Central • As opposed to Ivy layout hosted on Bintray behind redirect
  10. 10. sbt 1 (updated parts) • Use Scala 2.12 for build definition • As opposed to Scala 2.10
  11. 11. sbt 1 (updated parts) • Pseudo-case classes generated by Contraband • https://www.scala-sbt.org/contraband/ • Instead of .copy(foo = 1), you write .withFoo(1) • Generates JSON codec
  12. 12. sbt 1 (updated parts) • Incremental compiler Zinc 1 • https://github.com/sbt/zinc • Class-based name hashing
  13. 13. sbt 1 (updated parts) • Library Management (LM) API • https://github.com/sbt/librarymanagement • Abstracts Apache Ivy so we can replace it later
  14. 14. sbt 1 (removed parts) • sbt.Plugin • Use sbt.AutoPlugin introduced in sbt 0.13.5
  15. 15. sbt 1 (removed parts) • sbt 0.12 style • the key dependency operators: <<=, <+=, <++= • the tuple enrichments (apply and map) • sbt.Build trait in project/Build.scala
  16. 16. sbt 1 (new parts) • sbt server • unified slash syntax • more on these later
  17. 17. sbt ecosystem
  18. 18. sbt is a hub • builds • dependency graph, library ecosystem • test interface • development tasks • plugins • developers (users & contributors)
  19. 19. how big is the ecosystem • 147,367 code results • "scalaVersion" extension:sbt
  20. 20. how big is the ecosystem • 209,745 download per month (sbt 1 on Maven Central) • (excludes preloaded .zip, .tgz, .msi)
  21. 21. how big is the ecosystem • 12956 downloads (in 7 days after 1.1.5 came out)
  22. 22. how big is the ecosystem • 455 plugins (341 0.13 plugins; 224 1.0 plugins) • 600+ packages on Bintray sbt/sbt-plugin-releases
  23. 23. migrating the plugin ecosystem • organizing community efforts 10 days later..
  24. 24. migrating the plugins ecosystem • 99 plugins were on sbt 1 in 2 months
  25. 25. Places to find us • sbt 1 / Zinc meeting (every Wednesday) • Gitter (sbt/sbt + sbt/sbt-contrib) • Lightbend Discuss: https:// discuss.lightbend.com/c/tooling • Stackoverflow: http://stackoverflow.com/ tags/sbt • GitHub Issues: sbt/sbt • Twitter: https://twitter.com/scala_sbt • and lots of repos...
  26. 26. GitHub repos • sbt/sbt - the build tool • sbt/zinc • sbt/librarymanagement • sbt/util • sbt/io • sbt/website • sbt/launcher • sbt/sbt-launcher-package • sbt/contraband • sbt/sbt-houserules
  27. 27. GitHub repos • sbt/sbt - the build tool • sbt/zinc • sbt/librarymanagement • sbt/util • sbt/io • sbt/website • sbt/launcher • sbt/sbt-launcher-package • sbt/contraband • sbt/sbt-houserules all repos: • build: sbt • PR validation: Travis CI • Testing: ScalaTest/Specs2/ScalaCheck/scripted
  28. 28. Types of contributions • Help adoption • Assist other users • At work, on Stackoverflow etc • Contribute to documentation • Garden the issue tracker • Report issues • Expand ecosystem • Patch the core
  29. 29. Gardening the issue tracker • Summarize discussions from other channels • Capture problems • Sift facts, opinions, and analysis (steps, problems, expectations, notes) • Reproduce the reported issues • Triage • Leaving breadcrumbs for contributors (previous discussions, source links)
  30. 30. Patching the core • Lightbend Discuss • "Help wanted", "Good first issue"
  31. 31. Plugins that got merged to sbt • sbt-core-next • sbt-doge • sbt-slash • sbt-cross-building
  32. 32. sbt server
  33. 33. • See http://eed3si9n.com/sbt-server-reboot sbt server reboot
  34. 34. Language Server Protocol • created by Microsoft for VS Code • abstracts IDE features like a web API LSP VS Code Eclipse Sublime 3 NeoVim TypeScript Python sbt
  35. 35. demand for rich development environment • Jump to error • Code navigation • Tab completion • Visual debugging • Incremental compiler • Library management • Test integration • Plugin capabilities (100+ of plugins) Editors sbt • LSP • Event logging
  36. 36. a brief history of sbt server • 'client-server split for sbt' (2013) Havoc Pennington • A proposal to split sbt into 2 JVMs: client (cmd, IDE, Play run etc) talks to server. • Typesafe Activator 1.3.0 (2015) was released using sbt-remote-control. • 'sbt server reboot' (2016) Eugene Yokota • 1 JVM. sbt server listens to both CLI and network. IDEA calling compile. • sbt 1.1.0 (2017) was released with server built-in using Language Server Protocol.
  37. 37. • single JVM process • implemented as a command, sort of • JSON API to drive sbt from network what is sbt server?
  38. 38. • IDE integration • Distributed build example usages
  39. 39. sbt main loop shell prompts the user
  40. 40. sbt new "shell" command shell prompts the user, 
 and listens to network
  41. 41. nc $ nc -U /Users/foo/.sbt/1.0/server/ 0845deda85cb41abcdef/sock Content-Length: 99^M ^M { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "initializationOptions": { } } }^M ...
  42. 42. input/output of common tasks compile task
  43. 43. input/output of common tasks • Outputs are side effects to disk and screen
  44. 44. event logging • A way to log object (semantic logging) • Logs are then relayed as JSON • Decoupled from screens
  45. 45. unified slash syntax
  46. 46. sbt • a way of describing your build • interactive shell for development
  47. 47. sbt 0.13 • (scalacOptions in (Test, console)).value • test:console::scalacOptions
  48. 48. sbt 1.1.x • (Test/console/scalacOptions).value • Test/console/scalacOptions
  49. 49. unified slash syntax • [reference /] [Config /] [intask /] key • foo / compile • foo / Test / compile • ThisBuild / organization • foo / Compile / console / scalacOptions
  50. 50. scope delegation • [reference /] [Config /] [intask /] key • foo / Test / console / scalacOptions Zero Runtime console Compile Zero Zero ThisBuild Zero Zero ... ...
  51. 51. problematic areas
  52. 52. sauce dependency
  53. 53. sbt-sriracha • adds .sourceDependency(scoptJVMRef, scoptJVMLib) • use -Dsbt.sourcemode=true to switch http://eed3si9n.com/hot-source-dependencies-using-sbt-sriracha lazy val scoptJVMRef = ProjectRef( workspaceDirectory / "scopt", "scoptJVM") lazy val scoptJVMLib = "com.github.scopt" %% "scopt" % "3.7.0"   lazy val root = (project in file(".")) .sourceDependency(scoptJVMRef, scoptJVMLib) .settings( name := "Hello world" )
  54. 54. cross building across Scala versions, platforms, etc
  55. 55. sbt-projectmatrix (TBA) • adds lazy val foo = projectMatrix lazy val core = (projectMatrix in file("core")) .scalaVersions("2.12.6", "2.11.12") .settings( name := "core" ) .jvmPlatform() lazy val app = (projectMatrix in file("app")) .dependsOn(core) .scalaVersions("2.12.6") .settings( name := "app" ) .jvmPlatform() https://discuss.lightbend.com/t/spatial-representation-of-cross- building/1277/9
  56. 56. Potential areas of contribution • Library management (Coursier) • Dependency locking • Migrate code examples to compiled docs • Look for "Help wanted" label in GitHub issues
  57. 57. Questions?
  58. 58. Lightbend Subscription
  • hepin1989

    Jun. 21, 2018
  • dar151

    Jun. 21, 2018

sbt 1 talk given at Scala Days New York 2018

Views

Total views

658

On Slideshare

0

From embeds

0

Number of embeds

1

Actions

Downloads

8

Shares

0

Comments

0

Likes

2

×