SlideShare une entreprise Scribd logo
1  sur  54
The road to sbt 1.0: Paved with
server
Josh Suereth (@jsuereth)
Eugene Yokota (@eed3si9n)
Reactive Platform team
Agenda
● A brief (incomplete and mostly wrong) history of Build Tools
● A roadmap to sbt 1.0
o Modularization
● sbt-server
A brief history of build tools
Incomplete and mostly wrong
#!/bin/sh
$ make -j 2 hello
# Makefile
OBJ = test.o test2.o
%.o : %.c
$(CC) -c -o $@ < $<
hello : $(OBJ)
gcc -o $@ $^
Make (1976)
● new! Dependency-based programming
● Uses system command to carry out tasks
● problem! Machine-dependent
Q: How do I build this program?
Autoconf/Automake (1991/1996)
● Generate configure script and Makefile templates
o Configure generates header scripts and real makefile
o Configure discovers what the machine has
● Use an even MORE arcane syntax
o m4 macros
o magic strings
Q: How do I build on this machine?
Internet
$ ant dist
<project name="MyProject" default="dist" basedir=".">
<description>example build file</description>
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="compile" description="compile the source " >
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<mkdir dir="${dist}/lib"/>
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar"
basedir="${build}"/>
</target>
</project>
Ant (2000)
Q: How do I build on this machine?
● new! Built-in tasks like mkdir, javac, and jar
o Self-contained and platform-independent
● task plugins (like ant-contrib)
● problem! Hard to reuse build logic
Package managers
Q: How do I find library source/binary?
● new! Metadata to track library dependencies
● new! Repository to host source and binary
● CTAN (1993), Port (1994), RPM (1997), APT (1998)
Maven (2004)
Q: How do I find library source/binary?
Q: How do I enforce consistent builds?
● Metadata to track library dependencies
● Repository to host source and binary
● new! Default build (Convention over Configuration)
● new! Plugins that allowed reuse of build logic
● problem! Difficult to customize
Ivy (2004)
Q: How do I find library source/binary?
● Metadata to track library dependencies
● Repository to host source and binary
● Maven integration on top of Ant
Rake (2003)
rule '.o' => ['.c'] do |t|
sh "cc #{t.source} -c -o #{t.name}"
end
task :name, [:first_name, :last_name] do |t, args|
puts "First name is #{args.first_name}"
puts "Last name is #{args.last_name}"
end
Rake (2004)
Q: How do I build on this machine?
Q: How do I customize my build?
● new! Internal DSL
o Leverage Ruby libraries rather than shell programs
o Provide cross-platform ruby libraries for supported language tools
● Real programming language to write tasks
O NOES XML!
SAX parsing is declared uncool
(immediately after inception)
REST/JSON attempt to displace SOAP
Buildr (2008)/Gradle (2009)/ Leningen(2009)
● Maven integration
Q: How do I find library source/binary?
Q: How do I customize my build?
● Use an internal DSL and a real program language
sbt (2008)
Q: How do I find library source/binary?
Q: How do I customize my build?
Q: How can I develop faster?
● new! Incremental compiler tracking source deps
● new! Interactive shell + library-aware REPL
● new! Test framework abstraction
● new! Parallel by default
● shabby-chic! ANSI colors
● Internal DSL + Maven integration
Google Blaze/Bazel (2009)
Q: How can I develop faster?
Q: How do I avoid version conflicts?
● new! Incremental build
● new! Cache builds remotely
● new! Clustered Building
● Abandon Maven. Check in all source to version control.
Force everyone on the same version.
● 1 SCM repo for all projects
● Assume homogeneous-ish environment
Pants (2014)/Buck (2014)
Q: How can I develop faster?
Q: How do I avoid version conflicts?
● Incremental build
● Cache builds remotely
● Force all dependencies to the same version for all
projects
● Put everything in a mono-repository
History
make (1977)
automake (1996)/
autoconf (1991)
Rake (2003)
Maven (2004)
Ivy (2004)
sbt (2008)
Blaze (2009)
Gradle (2009)
Leiningen
(2009)
Pants (2014)
Buck (2014)
RPM (1997)
Ant (2000)
Buildr (2008)
Jon Pretty's shell scripts (2004-2015)
History Recap
● sbt has inherited:
o dependency based programming (Make)
o internal build DSL (Rake)
o Package/Library Management (Maven)
o Convention over configuration (Maven)
o Re-usable build flow (Maven)
● sbt brings:
o interactivity (on the shell)
o parallel by default
A roadmap to sbt 1.0
stability + sbt server => modularization
sbt 1.0 technical previews
● sbt 0.13.5, 0.13.6, 0.13.7, 0.13.8, (0.13.9)
● Binary compatible with sbt 0.13.x plugins
Community participation
● New committer: @dwijnand (Dale Wijnand)
o :_* no longer needed for settings(Seq(...))
o -= & --= for settings & tasks
o Numbers of bug fixes
● Warszaw Scala (@ajozwik Andrzej,
@rkrzewski rkrzewski, @jaceklaskowski
Jacek etc)
o Natural whitespace handling
o Stackoverflow
● @Duhemm (Martin Duhem, EPFL)
o Incremental compilation of macros
● @ajsquared (Andrew Johnson)
Auto plugins
● See Plugins
● enablePlugins, disablePlugins
● requires
● trigger (noTrigger, allRequirements)
● Good for company-wide plugins
Cached resolution
● See cached resolution
● Caches dependency graph
o Subproject graph within a single run
o Direct dependencies across builds
● Uses sbt/serialization (non/jawn + Pickling)
Stability
1. Conceptual stability
2. Binary compatibility of sbt plugins
3. Source compatibility of build files
Concepts (mostly stable)
1. Scala incremental compiler
2. Dependency manager (Scala-aware)
3. Task and plugin system (using Scala)
4. Test framework abstraction
5. Text-based interactive shell
5. sbt server + client(s)
Plugin binary compatibility
● sbt 0.13 maintained 18 months of bincompat
o Lots of hacks and effort. Unable to remove cruft.
● sbt 1.x.y should be bincompat with 1.0.0
● Need to minimize surface API
o able to add small features when requested
Build source compatibility
● Source compatibility of your build.sbt
● sbt 1.x.y should be stable
● sbt 1.0 gives us opportunity to break DSL
o Deprecate project/build.scala?
o Unify sbt shell key syntax w/ Scala DSL syntax
Modularization
Componentize stable features, innovate new ideas
1. Pull out cohesive subprojects
2. Distinguish public API and internal details
3. Document usages
4. Clean up historical code
5. Cross publish for latest scala versions
(if applicable)
6. Publish to Maven Central (or JCenter)
Module candidates
● IO API
● Launcher API
● Serialization API
● Compiler/REPL API
● Test framework API
● Dependency Management API
● Network API
● Task DSL
● Completion API
● sbt client (sbt-server)
sbt-server
Architecture and Design
The problem
● Many things want access to the build
● We need to centrally control build-related
tasks to avoid breakage.
o intellij auto-import + "sbt ~ test"
o activator + "play run"
sbt-server design
sbt-server
disk (target/)
sbt client
commands /
watches
changes
Events
(logs, status, custom)
After server - Execution Queue
CMD
(compile)
Engine
TasksRead server
Queue
Next
command
previous
log file
Reload
the build
Server Event
Loop
Request Queue
CommandQueue
Client #1 Client #2
LatestState
Next State
Problem: Disconnects
● Client may not be the one to start sbt
● Client may disconnect from server, or server
may crash
Connect as an Event
val connector = SbtConnector(
"terminal", "Command Line Terminal",
configuration.baseDirectory)
def onConnect(client: SbtClient): Unit = {
client handleEvents { … }
client watch ...
}
connector.open(onConnect, onError)(<execution context>)
Connect as an Event
val connector = SbtConnector(
"terminal", "Command Line Terminal",
configuration.baseDirectory)
def onConnect(client: SbtClient): Unit = {
client handleEvents { … }
client watch ...
}
connector.open(onConnect, onError)(
<execution context>)
Clients
reconstruct their
watches
and restore their
view of the build
on any reconnect
Problem: Input
sbt tasks may want the user to type input
Example Client (input)
client.requestExecution(
"run",
Some(TerminalInteraction -> TerminalThread)
)
client
server
ExecutionRequest
Example task (input)
readInput := {
val context = (interactionService in Global).value
context.readLine("> ", mask=false)
}
Problem: commands block
When running the `run` task, all other build
commands are blocked.
Background Jobs
● tasks can "fork" background jobs in server
● clients can discover/connect/stop with
background jobs.
server
background
job service
Forked "run"
of application
scala REPL
ensime
server?
not implemented
Input/Interaction Design
● Commands
o The requesting client provides the means for
terminal interaction
o Logs and stderr/stdout are sent to all clients.
● Background Jobs (Not Completed Yet)
o Any client can take terminal interaction for a
background task
o opt-in for getting stdout/stderr events
Problem: Existing plugins
Current plugins + sbt should be able to try out
sbt server, without breaking anything
sbt-core-next
A new, optional, plugin for sbt 0.13.x series
which provides the new services for sbt-server
● BackgroundRunService
● InteractionServicePlugin
● SendEventServicePlugin
● SerializersService
In use in Play 2.4
What's next?
sbt-server TODOS
● Interaction Improvements
o readline abstraction (a.k.a. Scala REPL support)
o Background Job hooks
● meta-project as first class citizen
o replace `reload plugins` command for first-class
support
o ~ as first-class citizen in server
● kill-on-bad-state watchdog
● sbt-terminal-client (drop existing client)
How can I help?
http://www.scala-sbt.org/community.html#how-can-I-help
● Follow @scala_sbt
● Contribute to StackOverflow sbt tag
● Report bugs
● Create plugins
o Try/migrate your plugins to remote APIs: https://github.com/sbt/sbt-
core-next
● Patch the core
o Github Community labeled issues
o Subscribe to sbt-dev list
o Join the discussion on Gitter sbt/sbt
Thanks!

Contenu connexe

Tendances

How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
Hiroshi SHIBATA
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02
Hiroshi SHIBATA
 

Tendances (20)

What's new in MySQL 5.6
What's new in MySQL 5.6What's new in MySQL 5.6
What's new in MySQL 5.6
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
Testing cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTestTesting cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTest
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
[네이버오픈소스세미나] What’s new in Zipkin - Adrian Cole
[네이버오픈소스세미나] What’s new in Zipkin - Adrian Cole[네이버오픈소스세미나] What’s new in Zipkin - Adrian Cole
[네이버오픈소스세미나] What’s new in Zipkin - Adrian Cole
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02
 
20140918 ruby kaigi2014
20140918 ruby kaigi201420140918 ruby kaigi2014
20140918 ruby kaigi2014
 
Q4.11: Getting Started in LAVA
Q4.11: Getting Started in LAVAQ4.11: Getting Started in LAVA
Q4.11: Getting Started in LAVA
 
20140925 rails pacific
20140925 rails pacific20140925 rails pacific
20140925 rails pacific
 
De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14
 
Performance Profiling Tools and Tricks
Performance Profiling Tools and TricksPerformance Profiling Tools and Tricks
Performance Profiling Tools and Tricks
 
Expressive Microservice Framework Blastoff
Expressive Microservice Framework BlastoffExpressive Microservice Framework Blastoff
Expressive Microservice Framework Blastoff
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
Node js
Node jsNode js
Node js
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
 
LCA13: LAVA and CI Component Review
LCA13: LAVA and CI Component ReviewLCA13: LAVA and CI Component Review
LCA13: LAVA and CI Component Review
 

En vedette

“Satisfaction from e banking services. a comparative study of hdfc and icici...
“Satisfaction from e banking services. a comparative study of  hdfc and icici...“Satisfaction from e banking services. a comparative study of  hdfc and icici...
“Satisfaction from e banking services. a comparative study of hdfc and icici...
bairasiareshu
 

En vedette (14)

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
 
SBT Crash Course
SBT Crash CourseSBT Crash Course
SBT Crash Course
 
Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
 
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopHadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoop
 
Continuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyreContinuous Integration for Spark Apps by Sean McIntyre
Continuous Integration for Spark Apps by Sean McIntyre
 
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)
 
sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策
 
Build application using sbt
Build application using sbtBuild application using sbt
Build application using sbt
 
“Satisfaction from e banking services. a comparative study of hdfc and icici...
“Satisfaction from e banking services. a comparative study of  hdfc and icici...“Satisfaction from e banking services. a comparative study of  hdfc and icici...
“Satisfaction from e banking services. a comparative study of hdfc and icici...
 
Project on E-banking
Project on E-bankingProject on E-banking
Project on E-banking
 
Internet banking - College Project
Internet banking - College ProjectInternet banking - College Project
Internet banking - College Project
 
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)
 
E banking
E bankingE banking
E banking
 
E Banking
E BankingE Banking
E Banking
 

Similaire à Road to sbt 1.0: Paved with server (2015 Amsterdam)

Why kernelspace sucks?
Why kernelspace sucks?Why kernelspace sucks?
Why kernelspace sucks?
OpenFest team
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
lolopetit
 

Similaire à Road to sbt 1.0: Paved with server (2015 Amsterdam) (20)

.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 Peaks.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 Peaks
 
Why kernelspace sucks?
Why kernelspace sucks?Why kernelspace sucks?
Why kernelspace sucks?
 
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
 
OSDC 2016 - rkt and Kubernentes what's new with Container Runtimes and Orches...
OSDC 2016 - rkt and Kubernentes what's new with Container Runtimes and Orches...OSDC 2016 - rkt and Kubernentes what's new with Container Runtimes and Orches...
OSDC 2016 - rkt and Kubernentes what's new with Container Runtimes and Orches...
 
Nodejs
NodejsNodejs
Nodejs
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Odo improving the developer experience on OpenShift - hack &amp; sangria
Odo   improving the developer experience on OpenShift - hack &amp; sangriaOdo   improving the developer experience on OpenShift - hack &amp; sangria
Odo improving the developer experience on OpenShift - hack &amp; sangria
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Introduction to Performance APIs
Introduction to Performance APIsIntroduction to Performance APIs
Introduction to Performance APIs
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)
 

Plus de Eugene Yokota

Plus de Eugene Yokota (10)

Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)Equality in Scala (ScalaMatsuri 2020)
Equality in Scala (ScalaMatsuri 2020)
 
sbt: core concepts and updates (Scala Love 2020)
sbt: core concepts and updates (Scala Love 2020)sbt: core concepts and updates (Scala Love 2020)
sbt: core concepts and updates (Scala Love 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)
 
sbt core concepts (ScalaMatsuri 2019)
sbt core concepts (ScalaMatsuri 2019)sbt core concepts (ScalaMatsuri 2019)
sbt core concepts (ScalaMatsuri 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)
 
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)
 
Thinking in Cats
Thinking in CatsThinking in Cats
Thinking in Cats
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Road to sbt 1.0: Paved with server (2015 Amsterdam)

  • 1.
  • 2. The road to sbt 1.0: Paved with server Josh Suereth (@jsuereth) Eugene Yokota (@eed3si9n)
  • 4. Agenda ● A brief (incomplete and mostly wrong) history of Build Tools ● A roadmap to sbt 1.0 o Modularization ● sbt-server
  • 5. A brief history of build tools Incomplete and mostly wrong
  • 7. $ make -j 2 hello # Makefile OBJ = test.o test2.o %.o : %.c $(CC) -c -o $@ < $< hello : $(OBJ) gcc -o $@ $^
  • 8. Make (1976) ● new! Dependency-based programming ● Uses system command to carry out tasks ● problem! Machine-dependent Q: How do I build this program?
  • 9. Autoconf/Automake (1991/1996) ● Generate configure script and Makefile templates o Configure generates header scripts and real makefile o Configure discovers what the machine has ● Use an even MORE arcane syntax o m4 macros o magic strings Q: How do I build on this machine?
  • 11. $ ant dist <project name="MyProject" default="dist" basedir="."> <description>example build file</description> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="compile" description="compile the source " > <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile" description="generate the distribution" > <mkdir dir="${dist}/lib"/> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> </target> </project>
  • 12. Ant (2000) Q: How do I build on this machine? ● new! Built-in tasks like mkdir, javac, and jar o Self-contained and platform-independent ● task plugins (like ant-contrib) ● problem! Hard to reuse build logic
  • 13. Package managers Q: How do I find library source/binary? ● new! Metadata to track library dependencies ● new! Repository to host source and binary ● CTAN (1993), Port (1994), RPM (1997), APT (1998)
  • 14. Maven (2004) Q: How do I find library source/binary? Q: How do I enforce consistent builds? ● Metadata to track library dependencies ● Repository to host source and binary ● new! Default build (Convention over Configuration) ● new! Plugins that allowed reuse of build logic ● problem! Difficult to customize
  • 15. Ivy (2004) Q: How do I find library source/binary? ● Metadata to track library dependencies ● Repository to host source and binary ● Maven integration on top of Ant
  • 16. Rake (2003) rule '.o' => ['.c'] do |t| sh "cc #{t.source} -c -o #{t.name}" end task :name, [:first_name, :last_name] do |t, args| puts "First name is #{args.first_name}" puts "Last name is #{args.last_name}" end
  • 17. Rake (2004) Q: How do I build on this machine? Q: How do I customize my build? ● new! Internal DSL o Leverage Ruby libraries rather than shell programs o Provide cross-platform ruby libraries for supported language tools ● Real programming language to write tasks
  • 18. O NOES XML! SAX parsing is declared uncool (immediately after inception) REST/JSON attempt to displace SOAP
  • 19. Buildr (2008)/Gradle (2009)/ Leningen(2009) ● Maven integration Q: How do I find library source/binary? Q: How do I customize my build? ● Use an internal DSL and a real program language
  • 20. sbt (2008) Q: How do I find library source/binary? Q: How do I customize my build? Q: How can I develop faster? ● new! Incremental compiler tracking source deps ● new! Interactive shell + library-aware REPL ● new! Test framework abstraction ● new! Parallel by default ● shabby-chic! ANSI colors ● Internal DSL + Maven integration
  • 21. Google Blaze/Bazel (2009) Q: How can I develop faster? Q: How do I avoid version conflicts? ● new! Incremental build ● new! Cache builds remotely ● new! Clustered Building ● Abandon Maven. Check in all source to version control. Force everyone on the same version. ● 1 SCM repo for all projects ● Assume homogeneous-ish environment
  • 22. Pants (2014)/Buck (2014) Q: How can I develop faster? Q: How do I avoid version conflicts? ● Incremental build ● Cache builds remotely ● Force all dependencies to the same version for all projects ● Put everything in a mono-repository
  • 23. History make (1977) automake (1996)/ autoconf (1991) Rake (2003) Maven (2004) Ivy (2004) sbt (2008) Blaze (2009) Gradle (2009) Leiningen (2009) Pants (2014) Buck (2014) RPM (1997) Ant (2000) Buildr (2008) Jon Pretty's shell scripts (2004-2015)
  • 24. History Recap ● sbt has inherited: o dependency based programming (Make) o internal build DSL (Rake) o Package/Library Management (Maven) o Convention over configuration (Maven) o Re-usable build flow (Maven) ● sbt brings: o interactivity (on the shell) o parallel by default
  • 25. A roadmap to sbt 1.0 stability + sbt server => modularization
  • 26. sbt 1.0 technical previews ● sbt 0.13.5, 0.13.6, 0.13.7, 0.13.8, (0.13.9) ● Binary compatible with sbt 0.13.x plugins
  • 27. Community participation ● New committer: @dwijnand (Dale Wijnand) o :_* no longer needed for settings(Seq(...)) o -= & --= for settings & tasks o Numbers of bug fixes ● Warszaw Scala (@ajozwik Andrzej, @rkrzewski rkrzewski, @jaceklaskowski Jacek etc) o Natural whitespace handling o Stackoverflow ● @Duhemm (Martin Duhem, EPFL) o Incremental compilation of macros ● @ajsquared (Andrew Johnson)
  • 28. Auto plugins ● See Plugins ● enablePlugins, disablePlugins ● requires ● trigger (noTrigger, allRequirements) ● Good for company-wide plugins
  • 29. Cached resolution ● See cached resolution ● Caches dependency graph o Subproject graph within a single run o Direct dependencies across builds ● Uses sbt/serialization (non/jawn + Pickling)
  • 30. Stability 1. Conceptual stability 2. Binary compatibility of sbt plugins 3. Source compatibility of build files
  • 31. Concepts (mostly stable) 1. Scala incremental compiler 2. Dependency manager (Scala-aware) 3. Task and plugin system (using Scala) 4. Test framework abstraction 5. Text-based interactive shell 5. sbt server + client(s)
  • 32. Plugin binary compatibility ● sbt 0.13 maintained 18 months of bincompat o Lots of hacks and effort. Unable to remove cruft. ● sbt 1.x.y should be bincompat with 1.0.0 ● Need to minimize surface API o able to add small features when requested
  • 33. Build source compatibility ● Source compatibility of your build.sbt ● sbt 1.x.y should be stable ● sbt 1.0 gives us opportunity to break DSL o Deprecate project/build.scala? o Unify sbt shell key syntax w/ Scala DSL syntax
  • 34. Modularization Componentize stable features, innovate new ideas 1. Pull out cohesive subprojects 2. Distinguish public API and internal details 3. Document usages 4. Clean up historical code 5. Cross publish for latest scala versions (if applicable) 6. Publish to Maven Central (or JCenter)
  • 35. Module candidates ● IO API ● Launcher API ● Serialization API ● Compiler/REPL API ● Test framework API ● Dependency Management API ● Network API ● Task DSL ● Completion API ● sbt client (sbt-server)
  • 37. The problem ● Many things want access to the build ● We need to centrally control build-related tasks to avoid breakage. o intellij auto-import + "sbt ~ test" o activator + "play run"
  • 38. sbt-server design sbt-server disk (target/) sbt client commands / watches changes Events (logs, status, custom)
  • 39. After server - Execution Queue CMD (compile) Engine TasksRead server Queue Next command previous log file Reload the build Server Event Loop Request Queue CommandQueue Client #1 Client #2 LatestState Next State
  • 40. Problem: Disconnects ● Client may not be the one to start sbt ● Client may disconnect from server, or server may crash
  • 41. Connect as an Event val connector = SbtConnector( "terminal", "Command Line Terminal", configuration.baseDirectory) def onConnect(client: SbtClient): Unit = { client handleEvents { … } client watch ... } connector.open(onConnect, onError)(<execution context>)
  • 42. Connect as an Event val connector = SbtConnector( "terminal", "Command Line Terminal", configuration.baseDirectory) def onConnect(client: SbtClient): Unit = { client handleEvents { … } client watch ... } connector.open(onConnect, onError)( <execution context>) Clients reconstruct their watches and restore their view of the build on any reconnect
  • 43. Problem: Input sbt tasks may want the user to type input
  • 44. Example Client (input) client.requestExecution( "run", Some(TerminalInteraction -> TerminalThread) ) client server ExecutionRequest
  • 45. Example task (input) readInput := { val context = (interactionService in Global).value context.readLine("> ", mask=false) }
  • 46. Problem: commands block When running the `run` task, all other build commands are blocked.
  • 47. Background Jobs ● tasks can "fork" background jobs in server ● clients can discover/connect/stop with background jobs. server background job service Forked "run" of application scala REPL ensime server? not implemented
  • 48. Input/Interaction Design ● Commands o The requesting client provides the means for terminal interaction o Logs and stderr/stdout are sent to all clients. ● Background Jobs (Not Completed Yet) o Any client can take terminal interaction for a background task o opt-in for getting stdout/stderr events
  • 49. Problem: Existing plugins Current plugins + sbt should be able to try out sbt server, without breaking anything
  • 50. sbt-core-next A new, optional, plugin for sbt 0.13.x series which provides the new services for sbt-server ● BackgroundRunService ● InteractionServicePlugin ● SendEventServicePlugin ● SerializersService In use in Play 2.4
  • 52. sbt-server TODOS ● Interaction Improvements o readline abstraction (a.k.a. Scala REPL support) o Background Job hooks ● meta-project as first class citizen o replace `reload plugins` command for first-class support o ~ as first-class citizen in server ● kill-on-bad-state watchdog ● sbt-terminal-client (drop existing client)
  • 53. How can I help? http://www.scala-sbt.org/community.html#how-can-I-help ● Follow @scala_sbt ● Contribute to StackOverflow sbt tag ● Report bugs ● Create plugins o Try/migrate your plugins to remote APIs: https://github.com/sbt/sbt- core-next ● Patch the core o Github Community labeled issues o Subscribe to sbt-dev list o Join the discussion on Gitter sbt/sbt