YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel,...
Transcript of YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel,...
![Page 1: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/1.jpg)
YAB !(Yet Another Build tool)
Christos KK Loverdos
[email protected]@loverdos
Athens Scala Meetup, 2015-05-05
![Page 2: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/2.jpg)
AgendaBuild systems/tools
Motivation
Key features
Design & semantics
Examples
Roadmap (-ish)
![Page 3: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/3.jpg)
Build systems/toolsmake
ant
maven
sbt
gradle, pants, buck, bazel, …
![Page 4: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/4.jpg)
Makeworld: cd src; $(MAKE) install
clean: cd src; $(MAKE) clean rm -f *~
test10: tests/test10.ott bin/ott \ -o out.thy -o out.v …
![Page 5: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/5.jpg)
Make$ make world …
$ make clean …
$ make test10 …
![Page 6: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/6.jpg)
Ant<project name=“foo” default=“compile”> <target name=“compile” depends=“init”> <mkdir dir=“${build.dir}”/> <copy todir=“${build.dir}”> <fileset dir=“${basedir}”> <exclude name=“**/VERSION”> </fileset> </copy> </target> </project>
![Page 7: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/7.jpg)
Ant$ ant …
$ ant init …
$ ant compile …
![Page 8: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/8.jpg)
Maven<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency>
![Page 9: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/9.jpg)
Maven<plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.0</version>
<configuration> <scalaVersion>2.11.6</scalaVersion> </configuration> </plugin>
![Page 10: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/10.jpg)
Maven$ mvn clean compile package …
$ mvn dependency:resolve …
$ mvn clean deploy …
![Page 11: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/11.jpg)
SBT (Simple Build Tool)
“sbt is a neat tool and I have been using it almost exclusively lately” — me, 2008-12-05, simple-build-tool group
Contributed “sbt.bat” via email :-)I was on Windows back then :-)
![Page 12: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/12.jpg)
SBT (Simple Build Tool)
De-facto (?) Scala build tool
Turing-complete DSL (Full Scala)
Plugins offer extra functionality
Not-so-simple after all …
![Page 13: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/13.jpg)
Motivation
I had an itch to scratch
![Page 14: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/14.jpg)
Christos KK [email protected]/loverdos
ckkloverdos.com
Building without the closed-world assumptionIntegrating enterprise build artifacts using Scala
ScalaDays
2010
![Page 15: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/15.jpg)
Motivation
Kinda frustrated with maven
![Page 16: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/16.jpg)
Motivation
Although used SBT professionally, it’s “uncontrolled”/“undisciplined” turing completeness ultimately puzzled me
![Page 17: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/17.jpg)
Motivation
I though that the Problem Domain of a build tool did not get the attention it deserved and there was a clean room for investigation
![Page 18: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/18.jpg)
Motivation
I needed a side project for my own reasons
![Page 19: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/19.jpg)
Key features
Clean separation of Data & Behaviour
Objects are not the answer to everything, always
![Page 20: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/20.jpg)
Key featuresData-first approach
Your build is defined by data
Dependencies, what to execute etc are data ==> purely functional
Execution of data-defined orchestration is via precise behaviours; think services.
![Page 21: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/21.jpg)
Key features
Immutability all the way
![Page 22: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/22.jpg)
Key features
Direct Acyclic Graph
Coarse-grained cycle detection ==> better software engineering practices
Cycles mean no build at all
![Page 23: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/23.jpg)
Key features
Do not (re)invent any wheel
Maven Central is an achievement
Re-use existing libs via maven coordinates
![Page 24: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/24.jpg)
Key features
Make it as simple as possible but no simpler
![Page 25: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/25.jpg)
Key features
Respect the developer
There is only one way to do this:
Treat them as end-users, not hackers
![Page 26: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/26.jpg)
Key featuresMulti-paradigm
One repo per project
One repo for all (Google-style)
Hybrid projects
mount external dependencies (à la FS)
![Page 27: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/27.jpg)
Key features
Hash-based change detection
Reproducible builds
Keeps track of everything that is used in the build process
![Page 28: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/28.jpg)
Design & SemanticsRecipes define what we can make and how
A JAR, a WAR
the output of javac, scalac etc
firing up a server (!) (think: jetty)
![Page 29: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/29.jpg)
Design & Semantics
Ingredients are what the recipes use
Each recipe defines its ingredients
Some are required; others not
![Page 30: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/30.jpg)
Design & SemanticsOrders are what we give to YAB
“order a scala compilation”
An order refers to the execution of a recipe
We provide it with values for the needed ingredients
![Page 31: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/31.jpg)
Design & SemanticsAnd that’s it:
Ingredients (Data)
Recipes (Behaviour)
Orders (Data-first recipe orchestration)
![Page 32: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/32.jpg)
Design & SemanticsBuild Components or just Components
Hierarchical project structure
think: sub-projects, maven modules etc
Component <==> yab.conf
![Page 33: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/33.jpg)
![Page 34: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/34.jpg)
![Page 35: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/35.jpg)
yab-vfs/yab.conforders { compile { type: "scala/scalac" ingredients: [ { scalaVersion: "2.11.1" } { Order: "/remotes/mlpipe::compile" } { Order: "/remotes/mlpipe-collections::compile" } ] } jar { type: "jar/make" ingredients: [ { Order: compile } ] } default=jar }
![Page 36: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/36.jpg)
Command-line$ yab /yab-vfs::compile
[yab] […] /remotes/mlpipe::compile [ /yab-vfs::compile ] [yab] [✓] /remotes/mlpipe::compile [0.545 sec] … [yab] […] /yab-vfs::compile [yab] [✓] /yab-vfs::compile [0.047 sec] [0.761 sec in total] [yab] ⤑ FileRoot(=.yab/components/yab-vfs/product/scalac) [yab] Finished in 2.700 sec
![Page 37: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/37.jpg)
yab-spec/yab.conforders { compile { type: "scala/scalac" ingredients: [ { scalacOptions: [ "-deprecation", "-unchecked", "-feature" "-optimise" "-language:existentials,higherKinds,implicitConversions" ] } { Order: “/remotes/mlpipe::compile" } { MavenArtifact: “com.typesafe:config:1.2.1" } ] } }
![Page 38: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/38.jpg)
Roadmap
Write docs
Finish latest iteration (some service-orientation love, cleanup)
Open source
![Page 39: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/39.jpg)
Facts/ImpressionsIt has been fun designing & developing YAB so far.
From immutable ASTs to clean separation of Data & Behaviour, the challenges are constant and rewarding.
The core principles can go beyond the build process.
![Page 40: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …](https://reader034.fdocuments.in/reader034/viewer/2022051923/60118f3992479431e20aca43/html5/thumbnails/40.jpg)
Thank you