buildr - build like you code

38
- build like you code Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name

Upload: izzet-mustafaiev

Post on 05-Dec-2014

513 views

Category:

Technology


2 download

DESCRIPTION

Introduction presentation to Buildr as a build tool for Java/Groovy/Scala projects written in Ruby demonstrates how JVM languages projects could be built and automated using Buildr and Ruby.

TRANSCRIPT

Page 1: Buildr -  build like you code

- build like you

codeIzzet Mustafayev@EPAM Systems@webdizzhttp://webdizz.name

Page 2: Buildr -  build like you code

this is me● SA at EPAM Systems

● primary skill is Java

● hands-on-coding with Ruby, Groovy and

some Scala

● passionate about agile, clean code

practices and devops movement

Page 3: Buildr -  build like you code

agenda● introduction

● why does my build tool suck?

● how does it taste?

● integration

● summary

● q&a

Page 4: Buildr -  build like you code

why does my build tool suck?

Page 5: Buildr -  build like you code
Page 6: Buildr -  build like you code

xml

Page 7: Buildr -  build like you code

try to extend...

Page 8: Buildr -  build like you code

copy-paste

Page 9: Buildr -  build like you code

performance

Page 10: Buildr -  build like you code

dependencies

Page 11: Buildr -  build like you code

how does it taste?

Page 12: Buildr -  build like you code

Buildr

follows philosophy

of Maven

with simplicity

of Ant

Page 13: Buildr -  build like you code

ruby

rake

buildr

awesome language for scripting,expressive, lightweight

tasks, files, dependencies

projects, lifecycle, artifacts, plugins

Page 14: Buildr -  build like you code

simple installation steps1. wget -c http://jruby.org.s3.amazonaws.

com/downloads/1.7.5/jruby-bin-1.7.5.zip

2. unzip jruby-bin-1.7.5.zip

3. add JRuby bin folder to PATH

4. gem install buildr

Page 15: Buildr -  build like you code

help➔ buildr help # for tasks

➔ buildr --help # for options

Page 16: Buildr -  build like you code

new project➔ buildr

Page 17: Buildr -  build like you code

build java http://goo.gl/pf669x

repositories.remote << ’http://repo1.maven.org/maven2’

define ‘junit’ do

project.version = ’4.11’

project.group = ’junit’

compile.with 'org.hamcrest:hamcrest-core:jar:1.3'

test.compile.with

package :jar

end

Page 18: Buildr -  build like you code

build scala http://goo.gl/4UQajarequire 'scala_version'

require 'buildr/scala'

require 'dependencies'

repositories.remote << 'http://repo1.maven.org/maven2'

define 'spring-scala' do

project.version = '1.0.0'

project.group = 'org.springframework.scala'

compile.options.javac = ['-feature', '-language:implicitConversions', '-

language:reflectiveCalls']

compile.with COMPILE_DEPS

test.using(:scalatest).with('org.hsqldb:hsqldb-j5:jar:2.2.4')

package :jar

end

Page 19: Buildr -  build like you code

build groovy http://goo.gl/iO1aVK

require 'buildr/groovy'

groovyVersion = '1.7.5’

Buildr::Groovy::Groovyc::REQUIRES.groovy = groovyVersion

repositories.remote << 'http://repo1.maven.org/maven2'

define 'codenarc' do

project.group = 'org.codenarc'

project.version = '0.19'

compile.from('src/main/java').with 'log4j:log4j:jar:1.2.13', 'org.gmetrics:

GMetrics:jar:0.5', “org.codehaus.groovy:groovy-all:jar:#{groovyVersion}”

compile.from('src/main/groovy').using(:groovyc).with 'junit:junit:jar:4.8.2'

package :jar

end

Page 20: Buildr -  build like you code

tests inclusion➔ test.include "com.package.*" # in

buildfile

➔ buildr test:GoodTest,WorkingTest

➔ buildr test:failed

➔ buildr test=only specific_project:test

Page 21: Buildr -  build like you code

tests exclusion➔ test.exclude ’*BadTest’, ’

*SomeOtherTest*’ # in buildfile

➔ buildr test:-BadTest

➔ buildr test=no

Page 22: Buildr -  build like you code

tests for builddefine ’some project’ do

project.version = ‘1.11’

project.group = ’company.com’

compile.with # a lot of dependencies

test.compile.with # a lot of dependencies

check package(:jar).entry(’META-INF/MANIFEST’), ’Should have

license’ do

it.should contain(/Copyright (C) 2013/)

end

end

Page 23: Buildr -  build like you code

packaging➔ package :jar # :war, :rar, :ear, :zip, :tar,

:bundle

➔ package(:jar).add project(’client’), :

type=>:jar

➔ package(:war).libs += artifacts(MYSQL)

➔ package(:war).libs -= artifacts(LOG4J)

➔ package(:jar).include _(’docs’), ’

README’

Page 24: Buildr -  build like you code

parameterisation➔ YAML - Ain't Markup Language

➔ YAML is a human friendly data serialization

standard for all programming languages

Page 25: Buildr -  build like you code
Page 26: Buildr -  build like you code

parameterisation➔ personal in ~/.buildr/settings.yaml

➔ build in build.yaml

➔ profiles in profiles.yaml

➔ buildr -e env

Page 27: Buildr -  build like you code

extension

Page 28: Buildr -  build like you code

require 'buildr'

module YourExtension

include Extension

first_time do

# Define task not specific to any project.

end before_define do |project|

# Define task for this particular project.

end after_define do |project|

# Do a job

end

end

end

class Buildr::Project

include YourExtension

end

Page 29: Buildr -  build like you code

integration with CI/CD

➔ buildr clean install

Page 30: Buildr -  build like you code
Page 31: Buildr -  build like you code

summary

Page 32: Buildr -  build like you code

pros● fast

● easy to extend

● expressive

● polyglot

● wysiwyg

Page 33: Buildr -  build like you code

cons● ruby knowledge

● pure IDE support

Page 34: Buildr -  build like you code

when to use?● need to easily tweak build/automation

● need flexibility in configuration

● need speed

● or you need something new

Page 35: Buildr -  build like you code

when not to use?● in tough time-line

● your current build is over-customized

● team does not want to learn ruby

Page 37: Buildr -  build like you code

q&a

Page 38: Buildr -  build like you code

Izzet Mustafayev@EPAM Systems@webdizzhttp://webdizz.name

thank you!- build

like you

code