SlideShare a Scribd company logo
1 of 56
Download to read offline
avg build time
(minutes)
Infra change
Infra change
scala_project
├── WORKSPACE
└── src
└── main
└── scala
└── com
├── example
│ ├── A.scala
│ ├── B.scala
│ └── C.scala
└── example2
├── D.scala
├── E.scala
└── F.scala
scala_project
├── WORKSPACE
└── src
└── main
└── scala
└── com
├── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD
│ └── C.scala
└── example2
├── D.scala
├── E.scala
└── F.scala
f(A,B,C)f( )
Source files
env’ variables
dependencies
A
B
C
wix
scala_project
├── WORKSPACE
└── src
├── main
│ └── scala
│ └── com
│ └── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD FILE
│ ├── C.scala
│ └── Example.scala
└── test
A.scala -> scala_library -> a.jar
scala_library(
name="a",
srcs=[
"A.scala",
],
deps = [":c"])
$ bazel build :a
f(A,B,C)f( )
A
B
C
A
B
C
f( ) f(A,B,C)
f(A,B,C)
f( )
A
B
C
f(A,B,C)
f( )
A
B
C
Compilation Test RunPending
✔ ✔ ✔
✔ ✔ ✔
✔ ✔ ✔ ✔
✔ ✔ ✔
✔ ✔ ✔
✔ ✔ ✔ ✔
CI/local tradeoff
out of the box
scala_project
├── build.sbt / build.gradle / pom.xml
└── src
├── main
├── test
scala_project
├── WORKSPACE
└── src
├── main
│ └── scala
│ └── com
│ └── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD FILE
│ ├── C.scala
│ └── Example.scala
└── test
scala_project
├── build.sbt / build.gradle / pom.xml
└── src
├── main
├── test
scala_project
├── WORKSPACE
└── src
├── main
│ └── scala
│ └── com
│ └── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD FILE
│ ├── C.scala
│ └── Example.scala
└── test
A.scala -> scala_library -> a.jar
scala_library(
name="a",
srcs=[
"A.scala",
],
deps = [":c"])
$ bazel build :a
scala_project
├── WORKSPACE
└── src
├── main
│ └── scala
│ └── com
│ └── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD FILE
│ ├── C.scala
│ └── Example.scala
└── test
B.scala -> scala_binary ->
B.jar + app_runner.sh
scala_binary(
name="b",
srcs=[
"B.scala",
],
main_class="com.example.Foo")
$ bazel run :b
ExampleTest.scala -> scala_test ->
example_test.jar + test_runner.sh
scala_test(
name="example_test",
srcs=glob(["*Test.scala"]))
$ bazel test :example_test
scala_project
├── WORKSPACE
└── src
├── main
│ └── scala
│ └── com
│ └── example
│ ├── A.scala
│ ├── B.scala
│ ├── BUILD
│ ├── C.scala
│ └── Example.scala
└── test
└── scala
└── com
└── example
├── BUILD
├── ExampleTest.scala
└── Example2Test.scala
f(A,B,C)f( )
A
B
C
hash1
hash2
scala_toolchain(
name = "my_toolchain_impl",
scalacopts = ["-Ywarn-unused"],
unused_dependency_checker_mode = "off",
visibility = ["//visibility:public"]
)
--unused_dependency_checker_mode=WARN|ERROR
...
error:Target '//some_package:unused_dep' is specified as a dependency to //path/to:foo but isn't used, please
remove it from the deps.
buildozer 'remove deps //some_package:unused_dep' //path/to:foo
foo
B unused
--strict_java_deps=WARN|ERROR
...
Target '@cats//jar' is used but isn't explicitly declared, please add it to the deps.
buildozer 'add deps @cats//jar' //path/to:foo
foo
specs2
cats
--strict_java_deps=WARN|ERROR
...
Target '@cats//jar' is used but isn't explicitly declared, please add it to the deps.
buildozer 'add deps @cats//jar' //path/to:foo
Based on Jason Zaugg’s Classpath Shrinker plugin
foo
specs2
cats
scala_toolchain(
name = "wix_plus_one_global_toolchain_impl",
scalacopts = [
"-unchecked",
...
],
plus_one_deps_mode = "on",
scalac_provider_attr = "@core_server_build_tools//toolchains:scalac_default",
visibility = ["//visibility:public"],
)
build --strategy=Scalac=worker
Scala 2.11.12
scala_repositories(("2.12.6", {
"scala_compiler": "3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863",
"scala_library": "f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98",
"scala_reflect": "ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa"
}))
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days
Building Scala with Bazel - Scala Days

More Related Content

Similar to Building Scala with Bazel - Scala Days

Dominare il codice legacy
Dominare il codice legacyDominare il codice legacy
Dominare il codice legacyTommaso Torti
 
Panoramica su Ant
Panoramica su AntPanoramica su Ant
Panoramica su Antbobpuley
 
Drupal come framework di sviluppo
Drupal come framework di sviluppoDrupal come framework di sviluppo
Drupal come framework di sviluppoGrUSP
 
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...Creare un proprio linguaggio di programmazione per il web e applicazioni desk...
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...Codemotion
 
MongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBMongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBStefano Dindo
 
Laboratorio Di Basi Di Dati 03 Il D B M S Postgre S Q L
Laboratorio Di  Basi Di  Dati 03  Il  D B M S  Postgre S Q LLaboratorio Di  Basi Di  Dati 03  Il  D B M S  Postgre S Q L
Laboratorio Di Basi Di Dati 03 Il D B M S Postgre S Q Lguestbe916c
 
Sistemi di Build Alternativi
Sistemi di Build AlternativiSistemi di Build Alternativi
Sistemi di Build AlternativiDario Bertini
 
Codemotion 2012 creare un proprio linguaggio di programmazione
Codemotion 2012 creare un proprio linguaggio di programmazioneCodemotion 2012 creare un proprio linguaggio di programmazione
Codemotion 2012 creare un proprio linguaggio di programmazioneGabriele Guizzardi
 
Sviluppo web dall'antichità all'avanguardia e ritorno
Sviluppo web  dall'antichità all'avanguardia e ritornoSviluppo web  dall'antichità all'avanguardia e ritorno
Sviluppo web dall'antichità all'avanguardia e ritornolordarthas
 
Laboratorio Di Basi Di Dati 08 Il Web Server Apache
Laboratorio Di  Basi Di  Dati 08  Il  Web Server  ApacheLaboratorio Di  Basi Di  Dati 08  Il  Web Server  Apache
Laboratorio Di Basi Di Dati 08 Il Web Server Apacheguestbe916c
 
Reactive programming principles
Reactive programming principlesReactive programming principles
Reactive programming principlesRiccardo Cardin
 
DDAY2014 - Performance in Drupal 8
DDAY2014 - Performance in Drupal 8DDAY2014 - Performance in Drupal 8
DDAY2014 - Performance in Drupal 8DrupalDay
 
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017Codemotion
 

Similar to Building Scala with Bazel - Scala Days (20)

Dominare il codice legacy
Dominare il codice legacyDominare il codice legacy
Dominare il codice legacy
 
Applicazioni native in java
Applicazioni native in javaApplicazioni native in java
Applicazioni native in java
 
Panoramica su Ant
Panoramica su AntPanoramica su Ant
Panoramica su Ant
 
FANTIN BIG DATA (2)
FANTIN BIG DATA (2)FANTIN BIG DATA (2)
FANTIN BIG DATA (2)
 
Drupal come framework di sviluppo
Drupal come framework di sviluppoDrupal come framework di sviluppo
Drupal come framework di sviluppo
 
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...Creare un proprio linguaggio di programmazione per il web e applicazioni desk...
Creare un proprio linguaggio di programmazione per il web e applicazioni desk...
 
Perl Template Toolkit
Perl Template ToolkitPerl Template Toolkit
Perl Template Toolkit
 
MongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBMongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDB
 
Amazon S3 in Perl
Amazon S3 in PerlAmazon S3 in Perl
Amazon S3 in Perl
 
Laboratorio Di Basi Di Dati 03 Il D B M S Postgre S Q L
Laboratorio Di  Basi Di  Dati 03  Il  D B M S  Postgre S Q LLaboratorio Di  Basi Di  Dati 03  Il  D B M S  Postgre S Q L
Laboratorio Di Basi Di Dati 03 Il D B M S Postgre S Q L
 
Sistemi di Build Alternativi
Sistemi di Build AlternativiSistemi di Build Alternativi
Sistemi di Build Alternativi
 
Lezione Android prima parte
Lezione Android prima parteLezione Android prima parte
Lezione Android prima parte
 
Codemotion 2012 creare un proprio linguaggio di programmazione
Codemotion 2012 creare un proprio linguaggio di programmazioneCodemotion 2012 creare un proprio linguaggio di programmazione
Codemotion 2012 creare un proprio linguaggio di programmazione
 
Corso Java 2 - AVANZATO
Corso Java 2 - AVANZATOCorso Java 2 - AVANZATO
Corso Java 2 - AVANZATO
 
Sviluppo web dall'antichità all'avanguardia e ritorno
Sviluppo web  dall'antichità all'avanguardia e ritornoSviluppo web  dall'antichità all'avanguardia e ritorno
Sviluppo web dall'antichità all'avanguardia e ritorno
 
Laboratorio Di Basi Di Dati 08 Il Web Server Apache
Laboratorio Di  Basi Di  Dati 08  Il  Web Server  ApacheLaboratorio Di  Basi Di  Dati 08  Il  Web Server  Apache
Laboratorio Di Basi Di Dati 08 Il Web Server Apache
 
Reactive programming principles
Reactive programming principlesReactive programming principles
Reactive programming principles
 
Php mysql3
Php mysql3Php mysql3
Php mysql3
 
DDAY2014 - Performance in Drupal 8
DDAY2014 - Performance in Drupal 8DDAY2014 - Performance in Drupal 8
DDAY2014 - Performance in Drupal 8
 
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017
 

More from Natan Silnitsky

Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...Natan Silnitsky
 
DevSum - Lessons Learned from 2000 microservices
DevSum - Lessons Learned from 2000 microservicesDevSum - Lessons Learned from 2000 microservices
DevSum - Lessons Learned from 2000 microservicesNatan Silnitsky
 
GeeCon - Lessons Learned from 2000 microservices
GeeCon - Lessons Learned from 2000 microservicesGeeCon - Lessons Learned from 2000 microservices
GeeCon - Lessons Learned from 2000 microservicesNatan Silnitsky
 
Migrating to Multi Cluster Managed Kafka - ApacheKafkaIL
Migrating to Multi Cluster Managed Kafka - ApacheKafkaILMigrating to Multi Cluster Managed Kafka - ApacheKafkaIL
Migrating to Multi Cluster Managed Kafka - ApacheKafkaILNatan Silnitsky
 
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven MicroservicesWix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven MicroservicesNatan Silnitsky
 
BuildStuff - Lessons Learned from 2000 Event Driven Microservices
BuildStuff - Lessons Learned from 2000 Event Driven MicroservicesBuildStuff - Lessons Learned from 2000 Event Driven Microservices
BuildStuff - Lessons Learned from 2000 Event Driven MicroservicesNatan Silnitsky
 
Lessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimLessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimNatan Silnitsky
 
Devoxx Ukraine - Kafka based Global Data Mesh
Devoxx Ukraine - Kafka based Global Data MeshDevoxx Ukraine - Kafka based Global Data Mesh
Devoxx Ukraine - Kafka based Global Data MeshNatan Silnitsky
 
Devoxx UK - Migrating to Multi Cluster Managed Kafka
Devoxx UK - Migrating to Multi Cluster Managed KafkaDevoxx UK - Migrating to Multi Cluster Managed Kafka
Devoxx UK - Migrating to Multi Cluster Managed KafkaNatan Silnitsky
 
Dev Days Europe - Kafka based Global Data Mesh at Wix
Dev Days Europe - Kafka based Global Data Mesh at WixDev Days Europe - Kafka based Global Data Mesh at Wix
Dev Days Europe - Kafka based Global Data Mesh at WixNatan Silnitsky
 
Kafka Summit London - Kafka based Global Data Mesh at Wix
Kafka Summit London - Kafka based Global Data Mesh at WixKafka Summit London - Kafka based Global Data Mesh at Wix
Kafka Summit London - Kafka based Global Data Mesh at WixNatan Silnitsky
 
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative Natan Silnitsky
 
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala LoveNatan Silnitsky
 
Migrating to Multi Cluster Managed Kafka - DevopStars 2022
Migrating to Multi Cluster Managed Kafka - DevopStars 2022Migrating to Multi Cluster Managed Kafka - DevopStars 2022
Migrating to Multi Cluster Managed Kafka - DevopStars 2022Natan Silnitsky
 
Open sourcing a successful internal project - Reversim 2021
Open sourcing a successful internal project - Reversim 2021Open sourcing a successful internal project - Reversim 2021
Open sourcing a successful internal project - Reversim 2021Natan Silnitsky
 
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021Natan Silnitsky
 
Advanced Caching Patterns used by 2000 microservices - Code Motion
Advanced Caching Patterns used by 2000 microservices - Code MotionAdvanced Caching Patterns used by 2000 microservices - Code Motion
Advanced Caching Patterns used by 2000 microservices - Code MotionNatan Silnitsky
 
Advanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
Advanced Caching Patterns used by 2000 microservices - Devoxx UkraineAdvanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
Advanced Caching Patterns used by 2000 microservices - Devoxx UkraineNatan Silnitsky
 
Advanced Microservices Caching Patterns - Devoxx UK
Advanced Microservices Caching Patterns - Devoxx UKAdvanced Microservices Caching Patterns - Devoxx UK
Advanced Microservices Caching Patterns - Devoxx UKNatan Silnitsky
 

More from Natan Silnitsky (20)

Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
 
DevSum - Lessons Learned from 2000 microservices
DevSum - Lessons Learned from 2000 microservicesDevSum - Lessons Learned from 2000 microservices
DevSum - Lessons Learned from 2000 microservices
 
GeeCon - Lessons Learned from 2000 microservices
GeeCon - Lessons Learned from 2000 microservicesGeeCon - Lessons Learned from 2000 microservices
GeeCon - Lessons Learned from 2000 microservices
 
Migrating to Multi Cluster Managed Kafka - ApacheKafkaIL
Migrating to Multi Cluster Managed Kafka - ApacheKafkaILMigrating to Multi Cluster Managed Kafka - ApacheKafkaIL
Migrating to Multi Cluster Managed Kafka - ApacheKafkaIL
 
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven MicroservicesWix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
 
BuildStuff - Lessons Learned from 2000 Event Driven Microservices
BuildStuff - Lessons Learned from 2000 Event Driven MicroservicesBuildStuff - Lessons Learned from 2000 Event Driven Microservices
BuildStuff - Lessons Learned from 2000 Event Driven Microservices
 
Lessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimLessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - Reversim
 
Devoxx Ukraine - Kafka based Global Data Mesh
Devoxx Ukraine - Kafka based Global Data MeshDevoxx Ukraine - Kafka based Global Data Mesh
Devoxx Ukraine - Kafka based Global Data Mesh
 
Devoxx UK - Migrating to Multi Cluster Managed Kafka
Devoxx UK - Migrating to Multi Cluster Managed KafkaDevoxx UK - Migrating to Multi Cluster Managed Kafka
Devoxx UK - Migrating to Multi Cluster Managed Kafka
 
Dev Days Europe - Kafka based Global Data Mesh at Wix
Dev Days Europe - Kafka based Global Data Mesh at WixDev Days Europe - Kafka based Global Data Mesh at Wix
Dev Days Europe - Kafka based Global Data Mesh at Wix
 
Kafka Summit London - Kafka based Global Data Mesh at Wix
Kafka Summit London - Kafka based Global Data Mesh at WixKafka Summit London - Kafka based Global Data Mesh at Wix
Kafka Summit London - Kafka based Global Data Mesh at Wix
 
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative
Migrating to Multi Cluster Managed Kafka - Conf42 - CloudNative
 
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love5 Takeaways from Migrating a Library to Scala 3 - Scala Love
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
 
Migrating to Multi Cluster Managed Kafka - DevopStars 2022
Migrating to Multi Cluster Managed Kafka - DevopStars 2022Migrating to Multi Cluster Managed Kafka - DevopStars 2022
Migrating to Multi Cluster Managed Kafka - DevopStars 2022
 
Open sourcing a successful internal project - Reversim 2021
Open sourcing a successful internal project - Reversim 2021Open sourcing a successful internal project - Reversim 2021
Open sourcing a successful internal project - Reversim 2021
 
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021
How to successfully manage a ZIO fiber’s lifecycle - Functional Scala 2021
 
Advanced Caching Patterns used by 2000 microservices - Code Motion
Advanced Caching Patterns used by 2000 microservices - Code MotionAdvanced Caching Patterns used by 2000 microservices - Code Motion
Advanced Caching Patterns used by 2000 microservices - Code Motion
 
Advanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
Advanced Caching Patterns used by 2000 microservices - Devoxx UkraineAdvanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
Advanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
 
Advanced Microservices Caching Patterns - Devoxx UK
Advanced Microservices Caching Patterns - Devoxx UKAdvanced Microservices Caching Patterns - Devoxx UK
Advanced Microservices Caching Patterns - Devoxx UK
 

Building Scala with Bazel - Scala Days