SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
sbt

core concepts and updates
Eugene Yokota (@eed3si9n)
goal:

gain better intuition about sbt
sbt by example


build tool
• "automates repeatable tasks"

— Build Systems à la Carte

Mokhov, Mitchell, Jones
a casually functional

build tool
State
State
1. build structure
2. your disk
Command
• State State
Command
• State State
• processed sequentially
• low-level construct; avoid making custom commands
examples of command
commands
help, tasks
projects, project hello
set name := "foo"
<command1>; <command2>
++ 2.13.0, ++ 2.13.0!, +<command>
shell command
act command
act command
• lifts tasks and settings into a command
which state is it changing?
commands changes
help, tasks no changes
projects, project hello build structure
set name := "foo" build structure
<command1>; <command2> both
++ 2.13.0, ++ 2.13.0!, +<command> both
act command disk
why State + Command?
why State + Command?
• predictable checkpoint
• building block for interactiveness:

"automates repeatable tasks"
interactive
sbt> testOnly foo.bar
command
logs
sbt shell
effects
about time
distributed events
event a
event b
"happens before"
process p
distributed events
event a
event b
"happens before"
process p process q
distributed events
• a → b (a happens before b)
• a ↛ b (a does not happen before b)
• 2 distinct events a and b are said to
be concurrent if a ↛ b and b ↛ a
distributed events
• a → b (a happens before b)
• a ↛ b (a does not happen before b)
• 2 distinct events a and b are said to
be concurrent if a ↛ b and b ↛ a
2 events are concurrent if neither can causality affect
each other
Applicative functor
scala> (3.some, 2.some) mapN { _ + _ }
res8: Option[Int] = Some(5)
scala> (none[Int], 5.some) mapN { _ - _ }
res9: Option[Int] = None
See 'Oh, All the things you'll traverse' by Luka Jacobowitz
for comprehension
getLine flatMap { x =>
print(length(x)) flatMap { _ =>
getLine flatMap { y =>
IO(x ++ y)
}
}
}
for {
x <- getLine
_ <- print(length(x))
y <- getLine
} yield x ++ y
def procedural: Unit = {
val x = getLine
print(length(x))
val y = getLine
x ++ y
}
build.sbt DSL
// sbt 0.12 style
foo <<= (compile in Compile, bar) map { (c, b) =>
doSomething(b)
}
// sbt 1.x style
foo := {
val c = (Compile / compile).value
val b = bar.value
doSomething(b)
}
build.sbt DSL
// sbt 0.12 style
foo <<= (compile in Compile, bar) map { (c, b) =>
doSomething(b)
}
// sbt 1.x style
foo := {
val c = (Compile / compile).value
val b = bar.value
doSomething(b)
}
Applicative composition
build.sbt DSL
foo := {
val c = (Compile / compile).value
val b = bar.value
doSomething(b)
}
Compile / compile bar
foo
"happens before"
build.sbt DSL
foo := {
val c = (Compile / compile).value
val b = bar.value
doSomething(b)
}
Compile / compile bar
foo
"happens before"
line of sand in time-space
Applicative composition
foo := {
val c = (Compile / compile).value
val b = bar.value
doSomething(b)
}
Test / test := {
val c = (Compile / compile).value
val f = foo.value
}
Compile / compile bar
foo
"happens before"
Test / test
"happens before"
why Applicative composition?
Compile / compile bar
foo
"happens before"
Test / test
"happens before"
why Applicative composition?
Compile / compile bar
foo
"happens before"
Test / test
"happens before"
1. minimality (executes task at most once, for input
that changed)
evaluated only once
why Applicative composition?
Compile / compile bar
foo
"happens before"
Test / test
"happens before"
1. minimality
2. automatic parallel processing
act command
• given a task, creates a plan that evaluates the task
in current and aggregated subprojects
• concurrent tasks are evaluated in parallel
lazy val root = (project in file("."))
.aggregate(util, core)
.settings(...)
lazy val util = (project in
file("util"))
.dependsOn(core)
lazy val core = (project in
file("core"))
act command
• how does it relate with State?
s0 s1 s2
reload (settings) act (task) act (task)
tasks vs commands
• prefer tasks for plugin extension
• tasks compose automatically
• command composition is stateful / sequential
~ command
sbt 1.0 - 1.3
sbt 1.0 (2017)
• Scala 2.12 (from 2.10)
• build.sbt only
• drop <<=, <+=, <++= operators
• semantic versioning + modularization: Zinc 1
sbt 1.1 (2017)
before unified slash syntax
// in build.sbt
scalacOptions in (core, Test, console)
// in sbt shell
core/test:console::scalacOptions
unified slash syntax
core / Test / console / scalacOptions
sbt 1.2 (2018)
• SbtPlugin plugin
• cross JDK forking
• addPluginSbtFile command
• experimental thin clients
sbt 1.3 (2019)
• library management with Coursier
• super shell
• turbo mode with ClassLoader layering
• IO improvements
sbt 1.4+
sbt server
• Scala Center and I will collaborate for sbt-bsp
support
• better build IDE integration
build linting
• detect settings in build.sbt not used by other tasks.
build matrix
• spatial (subproject) representation of cross build
across multiple Scala versions, JVM, JS, and
Native
cached compilation
• liberation from machine
• by virtualizing the internal file paths, we can make
them machine-dependent
→
modular (incremental)

build pipelining
parser
etc
typer, pickler etc jvm
refcheck,
erasure
parser
etc
typer, pickler etc jvm
refcheck,
erasure
parser
etc
typer, pickler etc jvm
refcheck,
erasure
early/foo.jar
early/bar.jar
"sbtw"
• pure Java launcher to replace Bash, Batch, and
current launcher
thanks and stay healthy
2020.03 mixtape
COVID-19 real-time update in US (https://
coronavirus.1point3acres.com/en)
Coronavirus update and guidance (https://
www.flattenthecurve.com/)
about me

Más contenido relacionado

La actualidad más candente (7)

CakePHP + PostgreSQL
CakePHP + PostgreSQLCakePHP + PostgreSQL
CakePHP + PostgreSQL
 
Будь первым
Будь первымБудь первым
Будь первым
 
GCD in Action
GCD in ActionGCD in Action
GCD in Action
 
Draw More, Work Less
Draw More, Work LessDraw More, Work Less
Draw More, Work Less
 
Why MacRuby Matters
Why MacRuby MattersWhy MacRuby Matters
Why MacRuby Matters
 
Ignite es6
Ignite es6Ignite es6
Ignite es6
 
Debugging JavaScript with Chrome
Debugging JavaScript with ChromeDebugging JavaScript with Chrome
Debugging JavaScript with Chrome
 

Similar a sbt: core concepts and updates (Scala Love 2020)

How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
Ngoc Dao
 

Similar a sbt: core concepts and updates (Scala Love 2020) (20)

Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
Lobos Introduction
Lobos IntroductionLobos Introduction
Lobos Introduction
 
Django Celery - A distributed task queue
Django Celery - A distributed task queueDjango Celery - A distributed task queue
Django Celery - A distributed task queue
 
Writing Redis in Python with asyncio
Writing Redis in Python with asyncioWriting Redis in Python with asyncio
Writing Redis in Python with asyncio
 
AutoDesk
AutoDeskAutoDesk
AutoDesk
 
The Ring programming language version 1.2 book - Part 17 of 84
The Ring programming language version 1.2 book - Part 17 of 84The Ring programming language version 1.2 book - Part 17 of 84
The Ring programming language version 1.2 book - Part 17 of 84
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScript
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Simple Build Tool Introduction
Simple Build Tool IntroductionSimple Build Tool Introduction
Simple Build Tool Introduction
 
Om nom nom nom
Om nom nom nomOm nom nom nom
Om nom nom nom
 
Simple build tool
Simple build toolSimple build tool
Simple build tool
 
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayQuantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
 
The Ring programming language version 1.5.2 book - Part 27 of 181
The Ring programming language version 1.5.2 book - Part 27 of 181The Ring programming language version 1.5.2 book - Part 27 of 181
The Ring programming language version 1.5.2 book - Part 27 of 181
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuPostgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
 
Play framework
Play frameworkPlay framework
Play framework
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 

Más de Eugene Yokota

Más de Eugene Yokota (11)

Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)
 
Analysis of Zinc (nescala 2020)
Analysis of Zinc (nescala 2020)Analysis of Zinc (nescala 2020)
Analysis of Zinc (nescala 2020)
 
Analysis of Zinc (ScalaSphere 2019)
Analysis of Zinc (ScalaSphere 2019)Analysis of Zinc (ScalaSphere 2019)
Analysis of Zinc (ScalaSphere 2019)
 
pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)
 
sbt 1
sbt 1sbt 1
sbt 1
 
sbt server (LSP discussion, 2018 Jan)
sbt server (LSP discussion, 2018 Jan)sbt server (LSP discussion, 2018 Jan)
sbt server (LSP discussion, 2018 Jan)
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
 
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaSphere ver)
 
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)
The state of sbt 0.13, sbt server, and sbt 1.0 (ScalaMatsuri ver)
 
Thinking in Cats
Thinking in CatsThinking in Cats
Thinking in Cats
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 

Último

Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
makhmalhalaaay
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
baharayali
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
shivanisharma5244
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
baharayali
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Amil Baba Naveed Bangali
 

Último (20)

"The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version""The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version"
 
Deerfoot Church of Christ Bulletin 5 5 24
Deerfoot Church of Christ Bulletin 5 5 24Deerfoot Church of Christ Bulletin 5 5 24
Deerfoot Church of Christ Bulletin 5 5 24
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by verse
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
 
The_Chronological_Life_of_Christ_Part_99_Words_and_Works
The_Chronological_Life_of_Christ_Part_99_Words_and_WorksThe_Chronological_Life_of_Christ_Part_99_Words_and_Works
The_Chronological_Life_of_Christ_Part_99_Words_and_Works
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by verse
 
A Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxxA Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxx
 
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptxMEIDUNIDADE COM JESUS  PALESTRA ESPIRITA1.pptx
MEIDUNIDADE COM JESUS PALESTRA ESPIRITA1.pptx
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
 
Hire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your ProjectHire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your Project
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
 
St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
 
St. Louise de Marillac and Care of the Sick Poor
St. Louise de Marillac and Care of the Sick PoorSt. Louise de Marillac and Care of the Sick Poor
St. Louise de Marillac and Care of the Sick Poor
 
Legends of the Light v2.pdf xxxxxxxxxxxxx
Legends of the Light v2.pdf xxxxxxxxxxxxxLegends of the Light v2.pdf xxxxxxxxxxxxx
Legends of the Light v2.pdf xxxxxxxxxxxxx
 
Flores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understandFlores de Mayo-history and origin we need to understand
Flores de Mayo-history and origin we need to understand
 
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCRElite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
 
May 2024 Calendar of Events for Hope Lutheran Church
May 2024 Calendar of Events for Hope Lutheran ChurchMay 2024 Calendar of Events for Hope Lutheran Church
May 2024 Calendar of Events for Hope Lutheran Church
 

sbt: core concepts and updates (Scala Love 2020)