buck, okbuck そして okbazel

Dbab5e5a1fd54531e1119ede6b3b9e65?s=47 Ryosuke Horie
March 23, 2017
410

buck, okbuck そして okbazel

Dbab5e5a1fd54531e1119ede6b3b9e65?s=128

Ryosuke Horie

March 23, 2017
Tweet

Transcript

  1. buck, okbuck ͦͯ͠ okbazel @Horie1024 2017/3/23 Gotanda.mobile #2 1

  2. About Me • Ryosuke Horie @Horie1024 • VASILY,Inc. AndroidΤϯδχΞ •

    ࡢ೥11݄ʹޒ൓ా΁ • !ͱࣗಈԽ͕޷͖ • ࠷ۙࢠڙ͕ੜ·Ε·ͨ͠" 2
  3. ࠓ೔࿩͢಺༰ • AndroidͷϏϧυπʔϧʹ͍ͭͯͷ࿩ 3

  4. AndroidͷϏϧυπʔϧ • 2017/3/23ݱࡏ Android StudioͰͷ։ൃ͕Ұൠత • Android Gradle Plugin •

    Android StudioͷϏϧυγεςϜ͸Gradleϕʔε • Ϗϧυπʔϧͱͯ͠Gradle͕ඪ४ 4
  5. GradleͰͷϏϧυ • Gradle͸ڧྗ! • DSLͰͷϏϧυεΫϦϓτͷهड़ • ϚϧνϓϩδΣΫτͷϏϧυ • ॊೈͳґଘؔ܎ͷ؅ཧͳͲ •

    ͔͠͠Ϗϧυ͕଎͘ͳ͍" 5
  6. ϏϧυΛߴ଎Խ͢Δʹ͸ʁ! • Ξϓϩʔν͸2ͭ • ઃఆͷௐ੔ • GradleҎ֎ͷϏϧυπʔϧͷར༻ 6

  7. ઃఆͷௐ੔ • ϓϩδΣΫτʹ߹Θͤͯνϡʔχϯά • How to decrease your Gradle build

    time by 65%? • 10 Tips to Improve Your Gradle Build Time 7
  8. GradleҎ֎ͷϏϧυπʔϧͷར༻ • Bazel • Buck 8

  9. Bazel • Google͕։ൃ͍ͯ͠ΔϏϧυπʔϧ • Cookpad͞Μͷهࣄ͕Θ͔Γ΍͍͢ • http://techlife.cookpad.com/entry/introduce- bazel-build 9

  10. Buck • Facebook͕։ൃɾ࢖༻͍ͯ͠ΔϏϧυπʔϧ • ex-Googlers͕FacebookͰ࡞ͬͨΒ͍͠(Bazel Q&AΑΓ) • Buck͸BazelΑΓޙʹઃܭ • ಛ௃͕ҟͳΔͷͰGoogle͸BuckΛ࢖Θͳ͍(Bazel

    Q&AΑΓ) 10
  11. BazelͱBuckͷҧ͍͸ʁ! 11

  12. Bazel features • Speed • Scalability • Flexibility • Correctness

    • Reliability • Repeatability 12
  13. Buck features • Speed up your builds • Add reproducibility

    to your builds • Get correct incremental builds • Understand your dependencies • Integrate with your IDE 13
  14. BazelͱBuckͷҧ͍͸ʁ! • ͲͪΒ΋Ϗϧυ͕଎͍ͷ͕ചΓ • ϏϧυΛߴ଎Խ͍ͨ͠ͷͰخ͍͠ • ಛ௃͕શମతʹࣅ͍ͯΔΑ͏ͳؾ΋ɾɾ • ϏϧυεΫϦϓτͷॻ͖ํ΋ࣅ͍ͯΔ 14

  15. Bazel android_library rule sample android_library( name = "activities", srcs =

    glob(["src/activities/*.java"]), custom_package = "com.google.bazel.example", manifest = "src/example/AndroidManifest.xml", resource_files = glob(["src/example/res/**"]), ) 15
  16. Buck android_library rule sample android_library( name = 'lib', srcs =

    glob(['*.java']), deps = [ '//android/resources:res', '//android/cxx:jni', ], visibility = [ '//android:demo-app', ], ) 16
  17. BazelͱBuckͷҧ͍͸ʁ! • ͲͪΒ΋Ϗϧυ଎౓͕଎͍ͷ͕ചΓ • શମతʹࣅ͍ͯΔ • ϏϧυεΫϦϓτͷॻ͖ํ΋ࣅ͍ͯΔ 17

  18. BazelͱBuckͷҧ͍͸ʁ! • ͲͪΒ΋Ϗϧυ଎౓͕଎͍ͷ͕ചΓ • શମతʹࣅ͍ͯΔ • ϏϧυεΫϦϓτͷॻ͖ํ΋ࣅ͍ͯΔ • ͲͪΒ΋Ϗϧυͷઃఆ͕೉͍͠ 18

  19. Ϗϧυͷઃఆਏ͍໰୊ • BazelɺBuckͷͲͪΒ΋Gradleͱൺֱͯ͠ཧղ͠ਏ͍ • Gradle͔ΒͷҠߦίετ⬆ • ϝϯς͢Δͷਏͦ͏ • ͦ͜Ͱొ৔͢Δͷ͕okbuck 19

  20. okbuck • Uber͕։ൃ͍ͯ͠ΔGradle plugin • https://github.com/uber/okbuck • GradleϓϩδΣΫτͰBuckΛ׆༻͢Δͷ͕໨త • Gradle

    wrapperϥΠΫͳBuck wrapperΛఏڙ • ./buckw build target 20
  21. okbuck tasks • buckWrapper - Create buck wrapper • okbuck

    - Generate BUCK files • okbuckClean - Delete configuration files generated by OkBuck • setupOkbuck - Setup okbuck cache and dependencies 21
  22. Generate BUCK files • ./gradlew okbuckͰBUCKϑΝΠϧΛੜ੒ • build.gradle͔ΒઃఆΛಡΈࠐΈࣗಈੜ੒ 22

  23. GradleͱBuckͷڞଘ • GradleϓϩδΣΫτͷߏ੒Λม͑ͣʹBuckͱڞଘ • طଘͷϓϩδΣΫτ΁ͷಋೖ͕༰қ • ։ൃ͸BuckɺϦϦʔεAPK͸GradleͰϏϧυͷΑ͏ͳ࢖͍ํ΋ 23

  24. Ϗϧυ଎౓ൺֱ • okbuckαϯϓϧϓϩδΣΫτݕূ • 5ճΫϦʔϯϏϧυΛ࣮ߦͨ͠ฏۉ஋ • Buck: ฏۉ 19.6s •

    Gradle: ฏۉ 79.2s 24
  25. okbuckͷ੍໿ • Buckͷ੍໿Λͦͷ··ड͚Δ • DataBindingඇαϙʔτ! • Kotlinඇαϙʔτ! • Facebookͷํ਑ʹࠨӈ͞ΕΔ 25

  26. okbazel͸ʁ 26

  27. okbazel • okbuckͷrepositoryʹPull Request͕ग़͍ͯΔ • Experimental okbazel support #251 •

    PRग़ͯ͠Δͷ͸BazelͷதͷਓΒ͍͠ • Ϛʔδ͸͞Ε͍ͯͳ͍ 27
  28. okbazelͷ੍໿ • Bazelͷ੍໿Λͦͷ··ड͚Δ • DataBindingαϙʔτ͸PR͕ग़͍ͯΔ • Add Android data binding

    support • Kotlinαϙʔτ͸ݱঢ়Ͳ͏ͳΔ͔Θ͔Βͳ͍ • Google͕։ൃ͍ͯ͠Δͷ͸େ͖͍ 28
  29. ·ͱΊ • okbuckΛར༻͢ΔͱGradleϓϩδΣΫτͰBuckΛར༻Մೳ • buckͰϏϧυ଎౓͸଎͘ͳΓͦ͏੍͕ͩ໿΋͋Δ • okbazel͕։ൃதͳͷͰظ଴! 29

  30. ͋Γ͕ͱ͏͍͟͝·ͨ͠ 30