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

5分で分かるビルドロジック共通化の今

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for mkeeda mkeeda
April 20, 2023

 5分で分かるビルドロジック共通化の今

Avatar for mkeeda

mkeeda

April 20, 2023
Tweet

More Decks by mkeeda

Other Decks in Programming

Transcript

  1. About me • mkeeda (޲Ҫా Ұฏ) • Twitter: @mr_mkeeda •

    Github: @mkeeda • Android Engineer at Cybozu, Inc • ޷͖ͳؖࠃυϥϚ:
 βɾάϩʔϦʔʙً͔͖͠෮़ʙ 2
  2. 5 sample-app feature-a feature-b build.gradle build.gradle plugins { id 'com.android.library'

    id 'org.jetbrains.kotlin.android' } android { compileSdk 33 defaultConfig { minSdk 26 targetSdk 33 // ... } compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } } dependencies { //... } build.gradle API level JDK version app build.gradle
  3. Convention Plugins Gradle Plugin system Binary plugin interface Plugin<T> plugins

    { id ‘…’ } Script plugin Script apply from: ‘other.gradle’ 6
  4. sample-app project Composite build (Included build) 9 :app other project

    :shared includeBuild(‘shared’) shared.jar sample-app.apk gradle :shared:jar gradle :app:assemble shared.jar :shared:jar
  5. buildSrc Composite build 10 sample-app build.gradle build.gradle build-logic ( )

    src/main/kotlin MyPlugin.kt feature-a feature-b sample-app feature-a feature-b build.gradle build.gradle buildSrc src/main/kotlin MyPlugin.kt
  6. Gradle 8 . 0 buildSrc Gradle 8 . 0 buildSrc

    Composite build buildSrc Some changes to make buildSrc more like an included build 
 https://github.com/gradle/gradle/pull/ 22 5 40 buildSrc https://github.com/gradle/gradle/issues/ 6045 #issuecomment- 7177527 60 11
  7. Sharing Build Logic between Subprojects 
 https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html Using Gradle Plugins

    
 https://docs.gradle.org/current/userguide/plugins.html Structuring Large Projects 
 https://docs.gradle.org/current/userguide/structuring_software_products.html Herding Elephants | Square Corner Blog 
 https://developer.squareup.com/blog/herding-elephants/ Composing builds 
 https://docs.gradle.org/current/userguide/composite_builds.html 13