Buildr - build like you code

852 views

Published on

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.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
852
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Buildr - build like you code

  1. 1. - build like you code Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name
  2. 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. 3. agenda ● introduction ● why does my build tool suck? ● how does it taste? ● integration ● summary ● q&a
  4. 4. why does my build tool suck?
  5. 5. xml
  6. 6. try to extend...
  7. 7. copy-paste
  8. 8. performance
  9. 9. dependencies
  10. 10. how does it taste?
  11. 11. Buildr follows philosophy of Maven with simplicity of Ant
  12. 12. ruby awesome language for scripting, expressive, lightweight rake tasks, files, dependencies buildr projects, lifecycle, artifacts, plugins
  13. 13. 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
  14. 14. help ➔ buildr help # for tasks ➔ buildr --help # for options
  15. 15. new project ➔ buildr
  16. 16. 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
  17. 17. 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
  18. 18. 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
  19. 19. tests inclusion ➔ test.include "com.package.*" # in buildfile ➔ buildr test:GoodTest,WorkingTest ➔ buildr test:failed ➔ buildr test=only specific_project:test
  20. 20. tests exclusion ➔ test.exclude ’*BadTest’, ’ *SomeOtherTest*’ # in buildfile ➔ buildr test:-BadTest ➔ buildr test=no
  21. 21. 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
  22. 22. 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’
  23. 23. parameterisation ➔ YAML - Ain't Markup Language ➔ YAML is a human friendly data serialization standard for all programming languages
  24. 24. parameterisation ➔ personal in ~/.buildr/settings.yaml ➔ build in build.yaml ➔ profiles in profiles.yaml ➔ buildr -e env
  25. 25. extension
  26. 26. 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
  27. 27. integration with CI/CD ➔ buildr clean install
  28. 28. summary
  29. 29. pros ● fast ● easy to extend ● expressive ● polyglot ● wysiwyg
  30. 30. cons ● ruby knowledge ● pure IDE support
  31. 31. when to use? ● need to easily tweak build/automation ● need flexibility in configuration ● need speed ● or you need something new
  32. 32. when not to use? ● in tough time-line ● your current build is over-customized ● team does not want to learn ruby
  33. 33. 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
  34. 34. q&a
  35. 35. thank you! - build like you code Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name

×