Slaying bugs
w/ Gradle and Jenkins
David Kay
Wednesday, September 11, 13
Overview
• Gradle
• Jenkins
Wednesday, September 11, 13
Build Tools?
Wednesday, September 11, 13
Wednesday, September 11, 13
Wednesday, September 11, 13
Wednesday, September 11, 13
Wednesday, September 11, 13
Unless your name is John Carmack, you aren’t.
So what are we left with?
Wednesday, September 11, 13
Wednesday, September 11, 13
Wednesday, September 11, 13
WTF is ?
• New Build system
• Alternatives
• ant
• maven
• buck
Wednesday, September 11, 13
In other words...
Trust me,
Wednesday, September 11, 13
it’s awesome.
Wednesday, September 11, 13
Wednesday, September 11, 13
Vlad putin is not convinced
Build Tools
• ant
• maven
• buck
Wednesday, September 11, 13
Wednesday, September 11, 13
• Simple
• Mature
• Customizable
What’s Awesome:
Wednesday, September 11, 13
In other words, it’s like duct tape
Wednesday, September 11, 13
If you’re the kind of person to build a prom dress out of duct tape
Wednesday, September 11, 13
It’ll be a great fit
• Lots of work
• No dependency management
What Sucks:
Wednesday, September 11, 13
For me, too much work
Wednesday, September 11, 13
• Mature
• Comprehensive
• Dependency management
• Easy configuration
What’s Awesome:
Wednesday, September 11, 13
Wednesday, September 11, 13
• Massively complex
• Shitty integration with libproject / .aar
• Hard to fix
What Sucks:
Wednesday, September 11, 13
Buck
Wednesday, September 11, 13
Buck
What’s Awesome:
• SOOOO FAST
• Simple
• Easy to compartmentalize project
Wednesday, September 11, 13
Wednesday, September 11, 13
Buck
What Sucks:
• No dependency management
• No support for running tests on device
• Poor documentation
Wednesday, Septe...
And the winner is....
Wednesday, September 11, 13
And the winner is....
Wednesday, September 11, 13
HOV!
And the winner is....
Wednesday, September 11, 13
Basics
Wednesday, September 11, 13
Basics
• Built on Groovy
Wednesday, September 11, 13
Wednesday, September 11, 13
Wednesday, September 11, 13
Basics
• Built on Groovy
• gradle files are Groovy files
Wednesday, September 11, 13
So, uh, where were we...
Basics
• gradle files are Groovy files
def square(x) {
x * x
}
in your build file!
Wednesday, September 11, 13
Hello World
> gradle -q hello
Hello world!
task hello {
doLast {
println 'Hello world!'
}
}
build.gradle
how to run
Wednes...
LAME
Wednesday, September 11, 13
Hello Java
> gradle assemble
apply plugin: 'java'
build.gradle
how to run
Wednesday, September 11, 13
Not Bad...
Wednesday, September 11, 13
Hello Android
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:0.5.6'
}
}
apply plugin: 'android'
an...
Alright!
Wednesday, September 11, 13
Hello Android
src/
main/
res/
value/
layout/
...
java/
com/
...
test/
res/
....
src/
....
Directory Structure
Wednesday, S...
Multi-Project
include ':HelloGradle', ':vendor:volley'
settings.gradle
project-root/
Wednesday, September 11, 13
Dependencies
...
dependencies {
// from a local jar
compile files('jackson.jar')
// from maven central/etc
compile 'com.ja...
Test Tools
• Unit tests: Robolectric
• Integration/end-to-end: Robotium
Wednesday, September 11, 13
?Wednesday, September 11, 13
Wednesday, September 11, 13
?Wednesday, September 11, 13
Wednesday, September 11, 13
OKOK
How do we RUN the tests?
Wednesday, September 11, 13
Hello Android
> gradle assemble
# compile debug/release/test
> gradle check
# run all tests
how to run
Wednesday, Septembe...
Wednesday, September 11, 13
Nice!
But how do we AUTOMATE it?
Wednesday, September 11, 13
Jenkins!!!
Wednesday, September 11, 13
like a certain other butler
Jenkins!!!
• Rock-solid
• Plugins
• Hackable/extensible
What’s Awesome:
Wednesday, September 11, 13
like a certain other b...
Wednesday, September 11, 13
Won’t tell you stories about Burmese jewel bandits.
...but at least he won’t walk out on you t...
Jenkins!!!
• First-time config
• Android Emulator :(
• Resource-intensive
What Sucks:
Wednesday, September 11, 13
Build System
Build Slaves
Wednesday, September 11, 13
Build System Ouput
S3 Bucket
Build Errors
Dev Team
Beta Testers
Wednesday, September 11, 13
Wednesday, September 11, 13
Pitfalls
• Headless Emulator
• Android Emulator / Xvnc delay
• -no-audio
Wednesday, September 11, 13
Wednesday, September 11, 13
Comprende!
Wednesday, September 11, 13
Comprende!
WTF?
Wednesday, September 11, 13
“How a programmer reads your resume” - Steve Hanov
http://stevehanov.ca/blog/resume_comic.png
Wednesday, September 11, 13
CheckStyle
Wednesday, September 11, 13
CheckStyle
<module name="Checker">
<module name="TreeWalker">
<property name="tabWidth" value="2"/>
<module name="Indentat...
defaultConfig {
versionName '0.1.1'
versionCode System.env.BUILD_NUMBER ?
"$System.env.BUILD_NUMBER".toInteger() : 2
}
bui...
Wednesday, September 11, 13
Bug Hunting
defaultConfig {
versionName '0.1.1'
versionCode System.env.BUILD_NUMBER ?
"$System.env.BUILD_NUMBER".toInteger() : 2
}
bui...
Build System
Build Slaves
Wednesday, September 11, 13
Build System Ouput
S3 Bucket
Build Errors
Dev Team
Beta Testers
Wednesday, September 11, 13
Thanks!
• http://bit.ly/gradle-jenkins for the code
Wednesday, September 11, 13
Recommended Reading
Android Gradle Plugin User Guide
Growing Object-Oriented Software, Guided By Tests
Wednesday, Septembe...
Shameless Pitch
We build apps for iOS & Android
www.gargoyle.co
Wednesday, September 11, 13
Contact
David Y. Kay
@DavidYKay
dk@gargoyle.co
Wednesday, September 11, 13
Upcoming SlideShare
Loading in …5
×

Slaying Bugs with Gradle and Jenkins

2,407 views
2,283 views

Published on

A comprehensive look at

From the New York Android Developers meetup

Published in: Technology, News & Politics
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,407
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
34
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Slaying Bugs with Gradle and Jenkins

  1. 1. Slaying bugs w/ Gradle and Jenkins David Kay Wednesday, September 11, 13
  2. 2. Overview • Gradle • Jenkins Wednesday, September 11, 13
  3. 3. Build Tools? Wednesday, September 11, 13
  4. 4. Wednesday, September 11, 13
  5. 5. Wednesday, September 11, 13
  6. 6. Wednesday, September 11, 13
  7. 7. Wednesday, September 11, 13 Unless your name is John Carmack, you aren’t. So what are we left with?
  8. 8. Wednesday, September 11, 13
  9. 9. Wednesday, September 11, 13
  10. 10. Wednesday, September 11, 13
  11. 11. WTF is ? • New Build system • Alternatives • ant • maven • buck Wednesday, September 11, 13 In other words...
  12. 12. Trust me, Wednesday, September 11, 13
  13. 13. it’s awesome. Wednesday, September 11, 13
  14. 14. Wednesday, September 11, 13 Vlad putin is not convinced
  15. 15. Build Tools • ant • maven • buck Wednesday, September 11, 13
  16. 16. Wednesday, September 11, 13
  17. 17. • Simple • Mature • Customizable What’s Awesome: Wednesday, September 11, 13 In other words, it’s like duct tape
  18. 18. Wednesday, September 11, 13 If you’re the kind of person to build a prom dress out of duct tape
  19. 19. Wednesday, September 11, 13 It’ll be a great fit
  20. 20. • Lots of work • No dependency management What Sucks: Wednesday, September 11, 13 For me, too much work
  21. 21. Wednesday, September 11, 13
  22. 22. • Mature • Comprehensive • Dependency management • Easy configuration What’s Awesome: Wednesday, September 11, 13
  23. 23. Wednesday, September 11, 13
  24. 24. • Massively complex • Shitty integration with libproject / .aar • Hard to fix What Sucks: Wednesday, September 11, 13
  25. 25. Buck Wednesday, September 11, 13
  26. 26. Buck What’s Awesome: • SOOOO FAST • Simple • Easy to compartmentalize project Wednesday, September 11, 13
  27. 27. Wednesday, September 11, 13
  28. 28. Buck What Sucks: • No dependency management • No support for running tests on device • Poor documentation Wednesday, September 11, 13
  29. 29. And the winner is.... Wednesday, September 11, 13
  30. 30. And the winner is.... Wednesday, September 11, 13 HOV!
  31. 31. And the winner is.... Wednesday, September 11, 13
  32. 32. Basics Wednesday, September 11, 13
  33. 33. Basics • Built on Groovy Wednesday, September 11, 13
  34. 34. Wednesday, September 11, 13
  35. 35. Wednesday, September 11, 13
  36. 36. Basics • Built on Groovy • gradle files are Groovy files Wednesday, September 11, 13 So, uh, where were we...
  37. 37. Basics • gradle files are Groovy files def square(x) { x * x } in your build file! Wednesday, September 11, 13
  38. 38. Hello World > gradle -q hello Hello world! task hello { doLast { println 'Hello world!' } } build.gradle how to run Wednesday, September 11, 13
  39. 39. LAME Wednesday, September 11, 13
  40. 40. Hello Java > gradle assemble apply plugin: 'java' build.gradle how to run Wednesday, September 11, 13
  41. 41. Not Bad... Wednesday, September 11, 13
  42. 42. Hello Android buildscript { dependencies { classpath 'com.android.tools.build:gradle:0.5.6' } } apply plugin: 'android' android { compileSdkVersion 17 } build.gradle > gradle assemble how to run Wednesday, September 11, 13
  43. 43. Alright! Wednesday, September 11, 13
  44. 44. Hello Android src/ main/ res/ value/ layout/ ... java/ com/ ... test/ res/ .... src/ .... Directory Structure Wednesday, September 11, 13
  45. 45. Multi-Project include ':HelloGradle', ':vendor:volley' settings.gradle project-root/ Wednesday, September 11, 13
  46. 46. Dependencies ... dependencies { // from a local jar compile files('jackson.jar') // from maven central/etc compile 'com.jayway.android.robotium:robotium-solo:4.2' // from a library project compile project(':vendor:volley') } ... build.gradle Wednesday, September 11, 13
  47. 47. Test Tools • Unit tests: Robolectric • Integration/end-to-end: Robotium Wednesday, September 11, 13
  48. 48. ?Wednesday, September 11, 13
  49. 49. Wednesday, September 11, 13
  50. 50. ?Wednesday, September 11, 13
  51. 51. Wednesday, September 11, 13
  52. 52. OKOK How do we RUN the tests? Wednesday, September 11, 13
  53. 53. Hello Android > gradle assemble # compile debug/release/test > gradle check # run all tests how to run Wednesday, September 11, 13
  54. 54. Wednesday, September 11, 13
  55. 55. Nice! But how do we AUTOMATE it? Wednesday, September 11, 13
  56. 56. Jenkins!!! Wednesday, September 11, 13 like a certain other butler
  57. 57. Jenkins!!! • Rock-solid • Plugins • Hackable/extensible What’s Awesome: Wednesday, September 11, 13 like a certain other butler
  58. 58. Wednesday, September 11, 13 Won’t tell you stories about Burmese jewel bandits. ...but at least he won’t walk out on you to prove a point.
  59. 59. Jenkins!!! • First-time config • Android Emulator :( • Resource-intensive What Sucks: Wednesday, September 11, 13
  60. 60. Build System Build Slaves Wednesday, September 11, 13
  61. 61. Build System Ouput S3 Bucket Build Errors Dev Team Beta Testers Wednesday, September 11, 13
  62. 62. Wednesday, September 11, 13
  63. 63. Pitfalls • Headless Emulator • Android Emulator / Xvnc delay • -no-audio Wednesday, September 11, 13
  64. 64. Wednesday, September 11, 13
  65. 65. Comprende! Wednesday, September 11, 13
  66. 66. Comprende! WTF? Wednesday, September 11, 13
  67. 67. “How a programmer reads your resume” - Steve Hanov http://stevehanov.ca/blog/resume_comic.png Wednesday, September 11, 13
  68. 68. CheckStyle Wednesday, September 11, 13
  69. 69. CheckStyle <module name="Checker"> <module name="TreeWalker"> <property name="tabWidth" value="2"/> <module name="Indentation"> <property name="caseIndent" value="2"/> <property name="basicOffset" value="2"/> </module> <module name="GenericWhitespace"/> <module name="AvoidStarImport"/> <module name="ConstantName"/> <module name="EmptyBlock"/> <module name="MemberName"/> <module name="ConstantName"/> <module name="MethodName"/> <module name="TypeName"/> </module> <module name="StrictDuplicateCode"> <property name="min" value="15"/> </module> </module> Wednesday, September 11, 13
  70. 70. defaultConfig { versionName '0.1.1' versionCode System.env.BUILD_NUMBER ? "$System.env.BUILD_NUMBER".toInteger() : 2 } build.gradle Auto-build Number Wednesday, September 11, 13 Why is this relevant?
  71. 71. Wednesday, September 11, 13 Bug Hunting
  72. 72. defaultConfig { versionName '0.1.1' versionCode System.env.BUILD_NUMBER ? "$System.env.BUILD_NUMBER".toInteger() : 2 } build.gradle Auto-build Number Wednesday, September 11, 13
  73. 73. Build System Build Slaves Wednesday, September 11, 13
  74. 74. Build System Ouput S3 Bucket Build Errors Dev Team Beta Testers Wednesday, September 11, 13
  75. 75. Thanks! • http://bit.ly/gradle-jenkins for the code Wednesday, September 11, 13
  76. 76. Recommended Reading Android Gradle Plugin User Guide Growing Object-Oriented Software, Guided By Tests Wednesday, September 11, 13
  77. 77. Shameless Pitch We build apps for iOS & Android www.gargoyle.co Wednesday, September 11, 13
  78. 78. Contact David Y. Kay @DavidYKay dk@gargoyle.co Wednesday, September 11, 13

×