40
YAB !(Yet Another Build tool) Christos KK Loverdos [email protected] @loverdos Athens Scala Meetup, 2015-05-05

YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

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, …

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, …

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, …

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, …

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, …

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, …

Ant$ ant …

$ ant init …

$ ant compile …

Page 8: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …

Motivation

Kinda frustrated with maven

Page 16: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

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, …

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, …

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, …

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, …

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, …

Key features

Immutability all the way

Page 22: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …

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, …
Page 34: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …
Page 35: YAB !(Yet Another Build tool) · Build systems/tools make ant maven sbt gradle, pants, buck, bazel, …

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, …

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, …

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, …

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, …

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, …

Thank you