-

build
like you

code
Izzet Mustafayev@EPAM Systems
@webdizz
http://webdizz.name
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
agenda
● introduction
● why does my build tool suck?
● how does it taste?
● integration
● summary
● q&a
why does my build tool suck?
xml
try to extend...
copy-paste
performance
dependencies
how does it taste?
Buildr
follows philosophy
of Maven
with simplicity
of Ant
ruby

awesome language for scripting,
expressive, lightweight

rake

tasks, files, dependencies

buildr

projects, lifecycle, artifacts, plugins
simple installation steps
1. 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
help
➔ buildr help # for tasks
➔ buildr --help # for options
new project
➔ buildr
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
build scala http://goo.gl/4UQaja
require '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
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
tests inclusion
➔ test.include "com.package.*" # in
buildfile

➔ buildr test:GoodTest,WorkingTest
➔ buildr test:failed
➔ buildr test=only specific_project:test
tests exclusion
➔ test.exclude ’*BadTest’, ’
*SomeOtherTest*’ # in buildfile

➔ buildr test:-BadTest
➔ buildr test=no
tests for build
define ’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
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’
parameterisation
➔ YAML - Ain't Markup Language
➔ YAML is a human friendly data serialization
standard for all programming languages
parameterisation
➔ personal in ~/.buildr/settings.yaml
➔ build in build.yaml
➔ profiles in profiles.yaml
➔ buildr -e env
extension
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
integration with CI/CD
➔ buildr clean install
summary
pros
● fast
● easy to extend
● expressive
● polyglot
● wysiwyg
cons
● ruby knowledge
● pure IDE support
when to use?
● need to easily tweak build/automation
● need flexibility in configuration
● need speed
● or you need something new
when not to use?
● in tough time-line
● your current build is over-customized
● team does not want to learn ruby
getting started
● http://buildr.apache.org/
● http://www.amazon.
com/Buildr/dp/1442160942/
● https://github.com/phoet/buildr-examples
● https://cwiki.apache.
org/confluence/display/BUILDR
q&a
thank you!
- build
like you

code

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

Buildr - build like you code

  • 1.
    - build like you code Izzet Mustafayev@EPAMSystems @webdizz http://webdizz.name
  • 2.
    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
  • 3.
    agenda ● introduction ● whydoes my build tool suck? ● how does it taste? ● integration ● summary ● q&a
  • 4.
    why does mybuild tool suck?
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
    ruby awesome language forscripting, expressive, lightweight rake tasks, files, dependencies buildr projects, lifecycle, artifacts, plugins
  • 14.
    simple installation steps 1.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
  • 15.
    help ➔ buildr help# for tasks ➔ buildr --help # for options
  • 16.
  • 17.
    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
  • 18.
    build scala http://goo.gl/4UQaja require'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
  • 19.
    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
  • 20.
    tests inclusion ➔ test.include"com.package.*" # in buildfile ➔ buildr test:GoodTest,WorkingTest ➔ buildr test:failed ➔ buildr test=only specific_project:test
  • 21.
    tests exclusion ➔ test.exclude’*BadTest’, ’ *SomeOtherTest*’ # in buildfile ➔ buildr test:-BadTest ➔ buildr test=no
  • 22.
    tests for build define’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
  • 23.
    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’
  • 24.
    parameterisation ➔ YAML -Ain't Markup Language ➔ YAML is a human friendly data serialization standard for all programming languages
  • 26.
    parameterisation ➔ personal in~/.buildr/settings.yaml ➔ build in build.yaml ➔ profiles in profiles.yaml ➔ buildr -e env
  • 27.
  • 28.
    require 'buildr' module YourExtension includeExtension 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
  • 29.
    integration with CI/CD ➔buildr clean install
  • 31.
  • 32.
    pros ● fast ● easyto extend ● expressive ● polyglot ● wysiwyg
  • 33.
  • 34.
    when to use? ●need to easily tweak build/automation ● need flexibility in configuration ● need speed ● or you need something new
  • 35.
    when not touse? ● in tough time-line ● your current build is over-customized ● team does not want to learn ruby
  • 36.
    getting started ● http://buildr.apache.org/ ●http://www.amazon. com/Buildr/dp/1442160942/ ● https://github.com/phoet/buildr-examples ● https://cwiki.apache. org/confluence/display/BUILDR
  • 37.
  • 38.
    thank you! - build likeyou code Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name