Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
SBT Made Simple
@囚千任 - http://afoo.me
Monday, September 9, 13
Immutability
Monday, September 9, 13
Setting
• A Build File is just a sequence of Settings
• A Setting is just a transformation to key-
value pairs
• A Transformation to some key-value pair is
immutable
Monday, September 9, 13
State Transition
• Project State is volatile
• state transition is immutable
Monday, September 9, 13
Composition
Monday, September 9, 13
Task
• dependency model to composition model
• task composition to form bigger granularity
unit
Monday, September 9, 13
InputTask
• Task with input
• input validation and completion support
with parser
• parser combinator is a form of composition
Monday, September 9, 13
Command
• Special InputTask
• accept Project state and settings as input
• project state is driven by a composition of
command execution
Monday, September 9, 13
Modularity
Monday, September 9, 13
Monday, September 9, 13
Configuration
• Ivy concept similar to Maven’s Scope
• Predefined or custom Configurations setup
Modularity boundary
Monday, September 9, 13
Project
• project is another level of modularity
• multiple project build definitions have their
specific configuration
Monday, September 9, 13
Plugins
• SBT plugin mechanism is another
modularity strategy
• enhance reusability too.
Monday, September 9, 13
Consistency
One Rule To Rule Them All
Monday, September 9, 13
Same Effect?
name := {
“hello” + “sbt”
}
sbt := {
“hello” + “sbt”
}
Monday, September 9, 13
Not Really!
name := {
“hello” + “sbt”
}
sbt := {
“hello” + “sbt”
}
=> Setting[String]
=> Setting[Task[String]]
Monday, September 9, 13
Key is the key
val name = settingKey[String](“desc.”)
name := {
“hello” + “sbt”
}
val sbt = taskKey[String](“task desc”)
sbt := {
“hello” + “sbt”
}
=> Setting[String]
=> Setting[Task[String]]
Monday, September 9, 13
Key is the key
• SettingKey[T]
• TaskKey[T]
• InputKey[T]
Monday, September 9, 13
Demo Time~
Monday, September 9, 13
Monday, September 9, 13

More Related Content

SBT Made Simple