SlideShare a Scribd company logo
1 of 19
Download to read offline
SBT Concepts
Happy Monday @ Gilt
     Feb 2013

  rtritsch@gilt.com
Playing with/Debugging SBT
● > settings -V <regex>
● > tasks -V <regex>
● > inspect <setting/task>
  ○ good to get the type of a setting/task
  ○ inspect tree <setting/task>
● > show <setting/task>
● > project <project>
● > ~reload


● Keys.scala
Basics
● An SBT build is an immutable map of key-
  value pairs describing the build
   ○ e.g. version = "0.0.1"
● When loading the *.sbt and *.scala files SBT
  builds a (long, huge) list of Setting[T] objects
  that describe a transformation to the map
   ○ e.g. name := "My Project"
● The list is then first sorted and the each
  Setting[T] is applied to the map
Basics (cont.)
● A Setting[T] can be build/expressed as ...
  ○ Key := Value where Key is one of ...
    ■ SettingKey[T], TaskKey[T], InputKey[T]
● There are lots of predefined Keys
  ○ Look at Keys.scala
● The operator describes the transformation
  ○ e.g. := replaces a key-value with another one, +=
    would add a value to a list
    ■ e.g. given an existing Setting[List[String]]
       identified by a SettingKey[List[String]] called
       example, you can add a value to the setting
       with ...
         ●   example += "another string"
Basics - Keys
● SettingKey[T] are computed once when the
  project is loaded and kept around
● TaskKey[T] are computed every time they
  are evaluated
  ○ val showTime = TaskKey[Unit]("show-time", "...")
  ○ showTime := {println <Time>}
  ○ This will result in a Setting[Task[Unit]] that can be
    added to the list of settings
● InputKey[T] to be discussed later
Basics - Scopes
● Actually ...
   ○ ... there is not one Key, but lots of them, because ...
   ○ ... they are Scoped, means ...
   ○ ... e.g. name can have a different value in different
     scopes
● Scopes have 3 axis: Project, Configuration
  and Task
   ○ Project should be clear/obvious
   ○ Configurations are e.g. Compile, Test, RunTime
   ○ Tasks are e.g. package-bin, package-src
     ■ scoping is used to give SettingKeys a different
        value for a task (e.g. artifactName)
Basics - Scopes (cont.)
● Special scopes are ...
  ○ There is a global scope for Configuration and Tasks
    called "Global"
    ■ <key> in (Global, Global) := ...
  ○ There is an "entire-build" scope called "ThisBuild"
    ■ <key> in ThisBuild := ...
        ●   same as <key> := ...
● Project scoping happens by putting the setting
  into the right scope (as opposed to using the
  "in" operator)
● Last but not least ... <key> in (Compile,
  compile) := ... make total sense, right?
Basic - Scopes (cont.)
● Use inspect to explore scoping
  ○ Learn how to read Provided-by, Delegates and
    Related
● Use show to display (Task)Keys
● Make inspect tree <key> work
Setting settings :)
●   (Re)Set - := [T]
●   Append value (to Seq) - += [T]
●   Append seq (to Seq) - ++= Seq[T]
●   Apply function to previous value(s) - ~= {T=>T}
●   Make a setting depend on another - <<=
SBT builds are SBT projects :)
● Look at ../project/project/Build.scala
   ○ Every project loads all *.sbt files from the root plus
     all *.scala files from the project/ directory
   ○ Explore the difference between version.sbt and
     plugins.sbt
Wrap up ...
             ... continue to play on ...
https://github.com/rolandtritsch/scala-sbt-tutorial
Backup
Using sbt-assembly ... right
● Initially it "just" adds a new task: assembly
● Question is ... how does this task relate and
  integrate with the rest of the build process, e.
  g. package and publish?
● Conceptually ... you first compile, then you
  package and then you publish
   ○ Package has multiple sub-tasks (package-bin,
     package-src, package-doc)
   ○ Each sub-task produces an Artifact that can then get
     published
Using sbt-assembly ... right (cont.)
● Proposal is ...
   ○ ... to introduce a new task package-assembly
   ○ ... and to run this task when package runs
   ○ ... and have it produce a new Artifact
   ○ ... and publish this Artifact as part of the publish task
     (or the publish-to or the publish-local) and a name
     that is different from the name that is used to
     package/publish the bin)
   ○ ... and make that work as part of the Compile
     configuration (should not be available in the Test
     configuration)
   ○ ... and get rid of running the tests as part of
     packaging it
Using sbt-assembly ... right (cont.)
● sbt <project> compile
● sbt <project> package
● sbt <project> publish

● sbt <project> package-assembly
● sbt <project> publish-local
● sbt <project> publish-to
Work in progress
Multi-Project Builds
● aggregate vs. dependsOn
Compile, package and publish ...
● What you publish is an Artifact
Advanced
● InputKey[T] ...

More Related Content

What's hot

Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin WritingSchalk Cronjé
 
Developing your own OpenStack Swift middleware
Developing your own OpenStack Swift middlewareDeveloping your own OpenStack Swift middleware
Developing your own OpenStack Swift middlewareChristian Schwede
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writingSchalk Cronjé
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Prometheus: infrastructure and application monitoring in kubernetes cluster
Prometheus: infrastructure and application monitoring in kubernetes clusterPrometheus: infrastructure and application monitoring in kubernetes cluster
Prometheus: infrastructure and application monitoring in kubernetes clusterLohika_Odessa_TechTalks
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 

What's hot (20)

GradleFX
GradleFXGradleFX
GradleFX
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Simple build tool
Simple build toolSimple build tool
Simple build tool
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
Developing your own OpenStack Swift middleware
Developing your own OpenStack Swift middlewareDeveloping your own OpenStack Swift middleware
Developing your own OpenStack Swift middleware
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web Stack
 
DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020
 
Jenkins' shared libraries in action
Jenkins' shared libraries in actionJenkins' shared libraries in action
Jenkins' shared libraries in action
 
3 Git
3 Git3 Git
3 Git
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Ant
AntAnt
Ant
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writing
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
 
Prometheus: infrastructure and application monitoring in kubernetes cluster
Prometheus: infrastructure and application monitoring in kubernetes clusterPrometheus: infrastructure and application monitoring in kubernetes cluster
Prometheus: infrastructure and application monitoring in kubernetes cluster
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 

Similar to Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013

Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)
Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)
Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)Igalia
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210Mahmoud Samir Fayed
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgetsICS
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and PipelinesSyed Imam
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxAbhishek Tirkey
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxGauravPandey43518
 
The Ring programming language version 1.6 book - Part 16 of 189
The Ring programming language version 1.6 book - Part 16 of 189The Ring programming language version 1.6 book - Part 16 of 189
The Ring programming language version 1.6 book - Part 16 of 189Mahmoud Samir Fayed
 
Talk on Standard Template Library
Talk on Standard Template LibraryTalk on Standard Template Library
Talk on Standard Template LibraryAnirudh Raja
 
The Ring programming language version 1.7 book - Part 17 of 196
The Ring programming language version 1.7 book - Part 17 of 196The Ring programming language version 1.7 book - Part 17 of 196
The Ring programming language version 1.7 book - Part 17 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 21 of 181
The Ring programming language version 1.5.2 book - Part 21 of 181The Ring programming language version 1.5.2 book - Part 21 of 181
The Ring programming language version 1.5.2 book - Part 21 of 181Mahmoud Samir Fayed
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Taiwan User Group
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data scienceSovello Hildebrand
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17Daniel Eriksson
 
AI02_Python (cont.).pptx
AI02_Python (cont.).pptxAI02_Python (cont.).pptx
AI02_Python (cont.).pptxNguyễn Tiến
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesSubhajit Sahu
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshuSidd Singh
 

Similar to Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013 (20)

Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)
Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)
Standardizing JavaScript Decorators in TC39 (Full Stack Fest 2019)
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgets
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and Pipelines
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
The Ring programming language version 1.6 book - Part 16 of 189
The Ring programming language version 1.6 book - Part 16 of 189The Ring programming language version 1.6 book - Part 16 of 189
The Ring programming language version 1.6 book - Part 16 of 189
 
Talk on Standard Template Library
Talk on Standard Template LibraryTalk on Standard Template Library
Talk on Standard Template Library
 
The Ring programming language version 1.7 book - Part 17 of 196
The Ring programming language version 1.7 book - Part 17 of 196The Ring programming language version 1.7 book - Part 17 of 196
The Ring programming language version 1.7 book - Part 17 of 196
 
The Ring programming language version 1.5.2 book - Part 21 of 181
The Ring programming language version 1.5.2 book - Part 21 of 181The Ring programming language version 1.5.2 book - Part 21 of 181
The Ring programming language version 1.5.2 book - Part 21 of 181
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
 
Constructor,destructors cpp
Constructor,destructors cppConstructor,destructors cpp
Constructor,destructors cpp
 
CMake_Tutorial.pdf
CMake_Tutorial.pdfCMake_Tutorial.pdf
CMake_Tutorial.pdf
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data science
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
AI02_Python (cont.).pptx
AI02_Python (cont.).pptxAI02_Python (cont.).pptx
AI02_Python (cont.).pptx
 
Sbt for mere mortals
Sbt for mere mortalsSbt for mere mortals
Sbt for mere mortals
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : Notes
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshu
 

More from Roland Tritsch

Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...
Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...
Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...Roland Tritsch
 
Reactive Programming Meetup - NodeJs on K8s
Reactive Programming Meetup - NodeJs on K8sReactive Programming Meetup - NodeJs on K8s
Reactive Programming Meetup - NodeJs on K8sRoland Tritsch
 
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthroughScala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthroughRoland Tritsch
 
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?Roland Tritsch
 
Mobile Monday - WebServices on the iPhone - 05/2008
Mobile Monday - WebServices on the iPhone - 05/2008Mobile Monday - WebServices on the iPhone - 05/2008
Mobile Monday - WebServices on the iPhone - 05/2008Roland Tritsch
 
A SOA for the car - 01/2009
A SOA for the car - 01/2009A SOA for the car - 01/2009
A SOA for the car - 01/2009Roland Tritsch
 
Puppet Camp Dublin - 06/2012
Puppet Camp Dublin - 06/2012Puppet Camp Dublin - 06/2012
Puppet Camp Dublin - 06/2012Roland Tritsch
 
iPhone meets SOA - 06/2008
iPhone meets SOA - 06/2008iPhone meets SOA - 06/2008
iPhone meets SOA - 06/2008Roland Tritsch
 
Innovation, Gilt and Ireland - 11/2011
Innovation, Gilt and Ireland - 11/2011Innovation, Gilt and Ireland - 11/2011
Innovation, Gilt and Ireland - 11/2011Roland Tritsch
 
Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012Roland Tritsch
 
"Managed Customization” in the Garment Industry - 10/2010
"Managed Customization” in the Garment Industry - 10/2010"Managed Customization” in the Garment Industry - 10/2010
"Managed Customization” in the Garment Industry - 10/2010Roland Tritsch
 
RESTful Services and Distributed OSGi - 04/2009
RESTful Services and Distributed OSGi - 04/2009RESTful Services and Distributed OSGi - 04/2009
RESTful Services and Distributed OSGi - 04/2009Roland Tritsch
 
AJAX for Mobile Devices - 04/2009
AJAX for Mobile Devices - 04/2009AJAX for Mobile Devices - 04/2009
AJAX for Mobile Devices - 04/2009Roland Tritsch
 

More from Roland Tritsch (14)

Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...
Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...
Shared-Nothing Microservices Architectures ... and how to get there @ 404.ie ...
 
SMACK Stack @ Nitro
SMACK Stack @ NitroSMACK Stack @ Nitro
SMACK Stack @ Nitro
 
Reactive Programming Meetup - NodeJs on K8s
Reactive Programming Meetup - NodeJs on K8sReactive Programming Meetup - NodeJs on K8s
Reactive Programming Meetup - NodeJs on K8s
 
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthroughScala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
 
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?
Immutable Deployment Platforms and Continuos Delivery - Friends or Foes?
 
Mobile Monday - WebServices on the iPhone - 05/2008
Mobile Monday - WebServices on the iPhone - 05/2008Mobile Monday - WebServices on the iPhone - 05/2008
Mobile Monday - WebServices on the iPhone - 05/2008
 
A SOA for the car - 01/2009
A SOA for the car - 01/2009A SOA for the car - 01/2009
A SOA for the car - 01/2009
 
Puppet Camp Dublin - 06/2012
Puppet Camp Dublin - 06/2012Puppet Camp Dublin - 06/2012
Puppet Camp Dublin - 06/2012
 
iPhone meets SOA - 06/2008
iPhone meets SOA - 06/2008iPhone meets SOA - 06/2008
iPhone meets SOA - 06/2008
 
Innovation, Gilt and Ireland - 11/2011
Innovation, Gilt and Ireland - 11/2011Innovation, Gilt and Ireland - 11/2011
Innovation, Gilt and Ireland - 11/2011
 
Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012
 
"Managed Customization” in the Garment Industry - 10/2010
"Managed Customization” in the Garment Industry - 10/2010"Managed Customization” in the Garment Industry - 10/2010
"Managed Customization” in the Garment Industry - 10/2010
 
RESTful Services and Distributed OSGi - 04/2009
RESTful Services and Distributed OSGi - 04/2009RESTful Services and Distributed OSGi - 04/2009
RESTful Services and Distributed OSGi - 04/2009
 
AJAX for Mobile Devices - 04/2009
AJAX for Mobile Devices - 04/2009AJAX for Mobile Devices - 04/2009
AJAX for Mobile Devices - 04/2009
 

Recently uploaded

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Recently uploaded (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013

  • 1. SBT Concepts Happy Monday @ Gilt Feb 2013 rtritsch@gilt.com
  • 2. Playing with/Debugging SBT ● > settings -V <regex> ● > tasks -V <regex> ● > inspect <setting/task> ○ good to get the type of a setting/task ○ inspect tree <setting/task> ● > show <setting/task> ● > project <project> ● > ~reload ● Keys.scala
  • 3. Basics ● An SBT build is an immutable map of key- value pairs describing the build ○ e.g. version = "0.0.1" ● When loading the *.sbt and *.scala files SBT builds a (long, huge) list of Setting[T] objects that describe a transformation to the map ○ e.g. name := "My Project" ● The list is then first sorted and the each Setting[T] is applied to the map
  • 4. Basics (cont.) ● A Setting[T] can be build/expressed as ... ○ Key := Value where Key is one of ... ■ SettingKey[T], TaskKey[T], InputKey[T] ● There are lots of predefined Keys ○ Look at Keys.scala ● The operator describes the transformation ○ e.g. := replaces a key-value with another one, += would add a value to a list ■ e.g. given an existing Setting[List[String]] identified by a SettingKey[List[String]] called example, you can add a value to the setting with ... ● example += "another string"
  • 5. Basics - Keys ● SettingKey[T] are computed once when the project is loaded and kept around ● TaskKey[T] are computed every time they are evaluated ○ val showTime = TaskKey[Unit]("show-time", "...") ○ showTime := {println <Time>} ○ This will result in a Setting[Task[Unit]] that can be added to the list of settings ● InputKey[T] to be discussed later
  • 6. Basics - Scopes ● Actually ... ○ ... there is not one Key, but lots of them, because ... ○ ... they are Scoped, means ... ○ ... e.g. name can have a different value in different scopes ● Scopes have 3 axis: Project, Configuration and Task ○ Project should be clear/obvious ○ Configurations are e.g. Compile, Test, RunTime ○ Tasks are e.g. package-bin, package-src ■ scoping is used to give SettingKeys a different value for a task (e.g. artifactName)
  • 7. Basics - Scopes (cont.) ● Special scopes are ... ○ There is a global scope for Configuration and Tasks called "Global" ■ <key> in (Global, Global) := ... ○ There is an "entire-build" scope called "ThisBuild" ■ <key> in ThisBuild := ... ● same as <key> := ... ● Project scoping happens by putting the setting into the right scope (as opposed to using the "in" operator) ● Last but not least ... <key> in (Compile, compile) := ... make total sense, right?
  • 8. Basic - Scopes (cont.) ● Use inspect to explore scoping ○ Learn how to read Provided-by, Delegates and Related ● Use show to display (Task)Keys ● Make inspect tree <key> work
  • 9. Setting settings :) ● (Re)Set - := [T] ● Append value (to Seq) - += [T] ● Append seq (to Seq) - ++= Seq[T] ● Apply function to previous value(s) - ~= {T=>T} ● Make a setting depend on another - <<=
  • 10. SBT builds are SBT projects :) ● Look at ../project/project/Build.scala ○ Every project loads all *.sbt files from the root plus all *.scala files from the project/ directory ○ Explore the difference between version.sbt and plugins.sbt
  • 11. Wrap up ... ... continue to play on ... https://github.com/rolandtritsch/scala-sbt-tutorial
  • 13. Using sbt-assembly ... right ● Initially it "just" adds a new task: assembly ● Question is ... how does this task relate and integrate with the rest of the build process, e. g. package and publish? ● Conceptually ... you first compile, then you package and then you publish ○ Package has multiple sub-tasks (package-bin, package-src, package-doc) ○ Each sub-task produces an Artifact that can then get published
  • 14. Using sbt-assembly ... right (cont.) ● Proposal is ... ○ ... to introduce a new task package-assembly ○ ... and to run this task when package runs ○ ... and have it produce a new Artifact ○ ... and publish this Artifact as part of the publish task (or the publish-to or the publish-local) and a name that is different from the name that is used to package/publish the bin) ○ ... and make that work as part of the Compile configuration (should not be available in the Test configuration) ○ ... and get rid of running the tests as part of packaging it
  • 15. Using sbt-assembly ... right (cont.) ● sbt <project> compile ● sbt <project> package ● sbt <project> publish ● sbt <project> package-assembly ● sbt <project> publish-local ● sbt <project> publish-to
  • 18. Compile, package and publish ... ● What you publish is an Artifact