Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android開発における自動化のすゝめ

ayatk
December 24, 2016

 Android開発における自動化のすゝめ

KIT LT #1で発表したスライドです

ayatk

December 24, 2016
Tweet

More Decks by ayatk

Other Decks in Programming

Transcript

  1. Android։ൃʹ͓͚Δ
    ࣗಈԽͷ͢ʍΊ
    @ayatk
    2016-12-23@KIT_LT #1

    View full-size slide

  2. ࣗݾ঺հ
    Twitter:
    @AyaTokikaze
    ΍ͬͯΔ͜ͱ:
    • αʔόʔαΠυͩͬͨΓWebΞϓϦͩͬͨΓ
    ͳΜͰ΋͢Δ
    • GolangͰίϚϯυϥΠϯπʔϧॻ͍ͯ·ͨ͠

    View full-size slide

  3. Կ౓΋ಉ͜͡ͱ΍͍ͬͯΔͳʙ
    ͬͯࢥ͏࣌͋Γ·ͤΜ͔?

    View full-size slide

  4. OSSϥΠϒϥϦͷ
    ϥΠηϯε؅ཧ

    View full-size slide

  5. ϥΠϒϥϦΛ௥Ճ͢Δ
    ɹɹɹɹɹɹɹ↘
    ɹɹɹɹɹϥΠηϯε৚จΛίϐϖ
    ɹɹɹɹɹɹɹ⾫
    ϑΝΠϧʹషΓ෇͚
    ɹɹɹɹɹɹ⾪
    ɹɹɹɹɹΊΜͲ͍͘͞

    View full-size slide

  6. ϥΠϒϥϦΛ௥Ճ͢Δ
    ɹɹɹɹɹɹɹ⾪
    ɹɹɹɹɹϥΠηϯε৚จΛίϐϖ
    ɹɹɹɹɹɹɹ⾫
    ϑΝΠϧʹషΓ෇͚
    ɹɹɹɹɹɹ⾪
    ɹɹɹɹɹΊΜͲ͍͘͞

    View full-size slide

  7. ϥΠϒϥϦΛ௥Ճ͢Δ
    ɹɹɹɹɹɹɹ⾪
    ɹɹɹɹɹϥΠηϯε৚จΛίϐϖ
    ɹɹɹɹɹɹɹ⾫
    ϑΝΠϧʹషΓ෇͚
    ɹɹɹɹɹɹ⾪
    ɹɹɹɹɹΊΜͲ͍͘͞

    View full-size slide

  8. ϥΠϒϥϦΛ௥Ճ͢Δ
    ɹɹɹɹɹɹɹ⾪
    ɹɹɹɹɹϥΠηϯε৚จΛίϐϖ
    ɹɹɹɹɹɹɹ⾫
    ϑΝΠϧʹషΓ෇͚
    ɹɹɹɹɹɹ⾪
    ɹɹɹɹɹɹΊΜͲ͍͘͞

    View full-size slide

  9. ʊਓਓਓਓਓʊ
    ʼɹͭΒ͍ɹʻ
    ʉ^Y^Y^Y^ʉ

    View full-size slide

  10. ࣗಈԽ͠·͠ΐ͏

    View full-size slide

  11. ͳΜͰɹɹɹɹɹɹɹʁ
    • AndroidΞϓϦΛϏϧυ͢Δ࣌ઈରʹ࢖͏

    (ࠓ࣌AntͳΜ͔࢖ͬͯΔਓ͍·ͤΜΑͶ…?)
    • εΫϦϓτΛ૊Ί͹୭Ͱ΋(JVM؀ڥ͕͋Ε͹)
    Ͳ͜Ͱ΋ಉ͡ํ๏ͰϏϧυ͕Ͱ͖Δ
    • ඞཁͳϥΠϒϥϦ͸উखʹऔ͖ͬͯͯ͘ΕΔ

    View full-size slide

  12. Android։ൃΛࣗಈԽ͢Δʹ͸
    ࠷ߴͷπʔϧ

    View full-size slide

  13. • versionCodeͷࣗಈੜ੒
    • cookpad/license-tools-plugin
    • Triple-T/gradle-play-publisher
    • ͓·͚

    View full-size slide

  14. • versionCodeͷࣗಈੜ੒
    • cookpad/license-tools-plugin
    • Triple-T/gradle-play-publisher
    • ͓·͚

    View full-size slide

  15. • versionCodeͷΠϯΫϦϝϯτΛ๨ΕͯPlay Storeͷ
    apk͕ߋ৽Ͱ͖ͳ͍…
    • ຖճΞοϓσʔτ͢ΔͨͼʹversionName΋
    versionCode΋ߋ৽͢Δͷ͸ΊΜͲ͍͘͞
    ʔʼ versionNameΛߋ৽ͨ͠ΒversionCode

    ɹɹ ΛࣗಈͰߋ৽ͯ͘͠ΕͨΒศརͩΑͶ?
    versionCodeͷࣗಈੜ੒

    View full-size slide

  16. • versionCodeͷΠϯΫϦϝϯτΛ๨ΕͯPlay Storeͷ
    apk͕ߋ৽Ͱ͖ͳ͍…
    • ຖճΞοϓσʔτ͢ΔͨͼʹversionName΋
    versionCode΋ߋ৽͢Δͷ͸ΊΜͲ͍͘͞
    ʔʼ versionNameΛߋ৽ͨ͠ΒversionCode

    ɹɹ ΛࣗಈͰߋ৽ͯ͘͠ΕͨΒศརͩΑͶ?
    versionCodeͷࣗಈੜ੒

    View full-size slide

  17. • versionCodeͷΠϯΫϦϝϯτΛ๨ΕͯPlay Storeͷ
    apk͕ߋ৽Ͱ͖ͳ͍…
    • ຖճΞοϓσʔτ͢ΔͨͼʹversionName΋
    versionCode΋ߋ৽͢Δͷ͸ΊΜͲ͍͘͞…
    ʔʼ versionNameΛߋ৽ͨ͠ΒversionCode

    ɹɹ ΛࣗಈͰߋ৽ͯ͘͠ΕͨΒศརͩΑͶ?
    versionCodeͷࣗಈੜ੒

    View full-size slide

  18. versionCodeͷࣗಈੜ੒
    def VERSION = ‘1.2.3’
    android {
    defaultConfig {
    versionName VERSION
    versionCode buildVersionCode() // => 1020300
    }
    }
    def buildVersionCode() {
    def (major, minor, patch) = VERSION.tokenize(‘.’)
    (major*1000000) + (minor*10000) + (patch*100)
    }
    https://blog.jayway.com/2015/03/11/automatic-versioncode-generation-in-android-gradle/

    View full-size slide

  19. • versionCodeͷࣗಈੜ੒
    • cookpad/license-tools-plugin
    • Triple-T/gradle-play-publisher
    • ͓·͚

    View full-size slide

  20. • GradleͷdependenciesΛಡΈࠐΜͰ

    ϥΠηϯε৚จ͕ॻ͔ΕͨHTMLΛੜ੒͢Δ
    • ϥΠϒϥϦΛ௥Ճ͢ΔͱϏϧυ࣌ʹϥΠηϯε
    ͷνΣοΫΛͯ͘͠ΕΔ
    ʔʼ ख࡞ۀͰϥΠηϯεΛ؅ཧ͠ͳ͍͍ͯ͘!!!!
    cookpad/license-tools-plugin

    View full-size slide

  21. • versionCodeͷࣗಈੜ੒
    • cookpad/license-tools-plugin
    • Triple-T/gradle-play-publisher
    • ͓·͚

    View full-size slide

  22. Triple-T/gradle-play-publisher
    • Gradle͔ΒGoogle Play Developer Consoleʹ

    ௚઀apkΛσϓϩΠͰ͖ΔΑ
    • Ϗϧυ -> Developer ConsoleΛ։͘ -> Ξοϓ
    ϩʔυͱ͍͏ྲྀΕΛίϚϯυΆͪʔͰऴΘΔ
    ʔʼ खಈΑΓ΋ѹ౗తʹਃ੥ָ͕!!

    View full-size slide

  23. • versionCodeͷࣗಈੜ੒
    • cookpad/license-tools-plugin
    • Triple-T/gradle-play-publisher
    • ͓·͚

    View full-size slide

  24. ͓·͚
    • Android StudioͷϏϧυͰ͸Φϓγϣϯʹ

    “-Pandroid.injected.invoked.from.ide=true”

    ͕౉͞ΕΔͷͰɺίϚϯυϥΠϯͱAndroid
    StudioͷϏϧυͷॲཧ͕෼͚ΕΔ
    def isIdeBuild = project.properties[‘android.injected.invoked.from.ide']
    if (isIdeBuild == null || isIdeBuild.equalsIgnoreCase("true")) {
    // do something for ide build
    }

    View full-size slide

  25. ศརͳπʔϧΛ࢖ͬͯ
    ΋ͬͱָΛ͠·͠ΐ͏!!

    View full-size slide