Ceylon.build by Loïc Rouchon

15

Click here to load reader

description

Discover how the Ceylon build system works and how it will evolve.

Transcript of Ceylon.build by Loïc Rouchon

Page 1: Ceylon.build by Loïc Rouchon

Introduction to ceylon.buildBy Loïc Rouchon

Page 2: Ceylon.build by Loïc Rouchon

Executive Summary

• What is ceylon.build

• Why ceylon.build

• Definitions• Features

Page 3: Ceylon.build by Loïc Rouchon

What is ceylon.build

• Tool to run goals from command line

• Aims to be an alternative to Ant / Maven / Gradle

Page 4: Ceylon.build by Loïc Rouchon

Why ceylon.build

• Write code, not XML

• Type-safety

• Built-in module system

Page 5: Ceylon.build by Loïc Rouchon

Definition

• Goal:– A function– With a name– And dependencies on other goals

Page 6: Ceylon.build by Loïc Rouchon

First syntax attempt

import ceylon.build.engine { build }import ceylon.build.task { Goal }import ceylon.build.tasks.misc { echo }

void run() {    build {        Goal {            name = "hello";            echo("hello")        },        Goal {            name = "bye";            echo("bye")        }    };}

Page 7: Ceylon.build by Loïc Rouchon

First syntax attempt

import ceylon.build.engine { build }import ceylon.build.task { Goal }import ceylon.build.tasks.misc { echo }

void run() {    build {        Goal {            name = "hello";            echo("hello")        },        Goal {            name = "bye";            echo("bye")        }    };}

• Hard to read for an IDE plugin

Page 8: Ceylon.build by Loïc Rouchon

First syntax attempt

import ceylon.build.engine { build }import ceylon.build.task { Goal }import ceylon.build.tasks.misc { echo }

void run() {    value bar = Goal {        name = "bar";        echo("bar")    }    value foo = Goal {        name = "foo";        dependencies = [bar];        echo("foo")    }    build { foo, bar };}

• Hard to read for an IDE plugin

• Dependencies break Tree-like syntax

Page 9: Ceylon.build by Loïc Rouchon

Future syntax

import ceylon.build.task { goal }import ceylon.build.tasks.misc { echo }

"Say Hello"goal shared void hello() {    echo("hello");}

"Say Bye"goal shared void bye() {    echo("bye");}

Page 10: Ceylon.build by Loïc Rouchon

Command line usage

$ ceylon build hello $ ceylon build hello bye

## ceylon.build# running goals: [hello] in order# running hello()hello world## success ­ duration 0s

## ceylon.build# running goals: [hello, bye] in order# running hello()hello# running bye()bye## success ­ duration 0s

Usage: ceylon run ceylon.build.runner your.build.module [<goal...>]Or, if your build module is in build folder: ceylon build [<goal...>]

Page 11: Ceylon.build by Loïc Rouchon

Import a set of goals

Goal set definition Your build moduleimport ceylon.build.task { goal }import ceylon.build.tasks.misc { echo }

shared class FooBar() {    goal shared void foo() {        echo("foo");    }    goal shared void bar() {        echo("bar");    }}

import ceylon.build.task { include }

include shared fooBar = FooBar();

Page 12: Ceylon.build by Loïc Rouchon

Dependency management

• A goal can define dependencies on other goals– Dependencies will be executed prior to this goal

– Each goal requested (directly or by dependency) will only be executed once

Page 13: Ceylon.build by Loïc Rouchon

Dependency management

$ ceylon build foo

## ceylon.build# running goals: [bar, foo] in order# running bar()bar# running foo()foo## success ­ duration 0s

import ceylon.build.task { goal }import ceylon.build.tasks.misc { echo }

goal { dependencies = [`function bar`]; }shared void foo() {    echo("foo");}

goal shared void bar() {    echo("bar");}

Page 14: Ceylon.build by Loïc Rouchon

Useful links

• Github– https://github.com/ceylon/ceylon.build

• Engine documentation: – http://modules.ceylon-lang.org/repo/1/ceylon/build

/engine/1.0.0/module-doc/

• Task API documentation:– http://modules.ceylon-lang.org/repo/1/ceylon/build

/task/1.0.0/module-doc/

Page 15: Ceylon.build by Loïc Rouchon

Q&A

• Questions! Answers?