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

Gradle-Plugin-in-2026.pdf

Avatar for RyuNen344 RyuNen344
September 03, 2026

 Gradle-Plugin-in-2026.pdf

Avatar for RyuNen344

RyuNen344

September 03, 2026

More Decks by RyuNen344

Other Decks in Programming

Transcript

  1. { Android | Kotlin } Gradle Plugin in 2026 Preparing

    for AGP 10.0.0 2026.09.03 DroidKaigi 2026 Bunjiro Miyoshi / RyuNen344
  2. About me name: Bunjiro Miyoshi id: RyuNen344 bio: Kodee lover

    like: Build System や CI/CD、綺麗な API になっているライブラリ
  3. ビルドを取り巻く環境は変化している Lightbuild (0.0.10 rc1) yaml で android を設定 Gradle の薄いラッパー

    Android CLI AI Agent 向けの開発 CLI Kotlin CLI yaml で定義 Gradle 非依存 AI Agent による開発の自動化の台頭により、環境の変化はますます大きくなっている
  4. “ Investing in build speed pays off ” Improve the

    Performance of Gradle Builds https://docs.gradle.org/9.7.0/userguide/performance.html 誰が如何なる方法でビルドしようと、速ければ速いほどいい
  5. Wrap up in 2025 Cache Me If You Can DroidKaigi

    2025 · https://2025.droidkaigi.jp/timetable/946751/
  6. 01 / 02 WRAP UP IN 2025 Gradle Lifecycle Initialization

    android {} Configuration finalizeDsl beforeVariants Execution onVariants
  7. 02 / 02 WRAP UP IN 2025 Effective Gradle Cache

    Deterministic @Input / @Output を宣言する 出力のない Task にも出力を定義する 乱数や宣言していない入力を使わない Lazy Provider / Property を使う ProjectLayout でファイルを触る ProviderFactory で環境変数を読む Task の input/output は決定的かつ遅延評価可能にするのが望ましい Gradle が提供する API を使用して定義すること
  8. 01 / 03 BUILT-IN KOTLIN Built-in Kotlin: Plugin BEFORE AGP

    8.x AFTER AGP 9.0 plugins { id("com.android.application") id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.kapt") } plugins { id("com.android.application") id("com.google.devtools.ksp") } kotlin-android の削除 kapt を KSP に移行 ( 移行できない場合は legacy-kapt ) // if kapt cannot be migrated id("com.android.legacy-kapt")
  9. 02 / 03 BUILT-IN KOTLIN Built-in Kotlin: Extension BEFORE AGP

    8.x AFTER AGP 9.0 android { compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } android { compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } } } kotlinOptions { languageVersion = "2.0" jvmTarget = "17" } kotlin { compilerOptions { languageVersion = KotlinVersion.KOTLIN_2_0 } } android.kotlinOptions を kotlin.compilerOptions へ移動 jvmTarget は android.compileOptions.targetCompatibility を継承
  10. 03 / 03 BUILT-IN KOTLIN Built-in Kotlin: Runtime buildscript {

    dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$version") classpath("com.google.devtools.ksp:symbol-processing-gradle-plugin: $version") } } KGP / KSP のバージョンは AGP に埋め込み バージョンを変更する場合は buildscript で classpath 指定
  11. 01 / 02 KMP LIBRARY com.android.kotlin.multiplatform.library BEFORE AGP 8.x AFTER

    AGP 9.0 plugins { id("org.jetbrains.kotlin.multiplatform") id("com.android.library") } plugins { id("org.jetbrains.kotlin.multiplatform") id("com.android.kotlin.multiplatform.library" ) } kotlin { androidTarget() } kotlin { // AGP 8.10-8.11: androidLibrary // AGP 8.12+: android android { // namespace, compileSdk, minSdk } } android { // namespace, compileSdk, minSdk } com.android.library を com.android.kotlin.multiplatform.library に変更 kotlin.androidTarget() と android {} は kotlin.android {} に統合
  12. 02 / 02 KMP LIBRARY com.android.kotlin.multiplatform.library できること ソースと依存は KMP の

    sourceSet へ Resources / Java / Local Unit Test / Instrumented Test は opt-in Android Lint 使用する場合は明示的に com.android.lint を適用 https://issuetracker.google.com/issues/385271861 できなくなること Build Type と Product Flavor Test Fixtures / Data Binding / View Binding / BuildConfig / AIDL / RenderScript / etc... アプリのエントリーポイント(com.android.application)
  13. 01 / 02 TEST FIXTURES AGP 9 supports Kotlin Test

    Fixtures android { testFixtures { enable = true androidResources = true } } dependencies { testFixturesImplementation(/* dependency */) } 別モジュールむけの Fixture が同一モジュールで実装可能 src/testFixtures/kotlin にコードを配置 app src androidTest main test [unitTest] testFixtures build.gradle
  14. 02 / 02 TEST FIXTURES AGP が対応するまで AGP 7.1 AGP

    8.5 Adds DSL Gradle 5.6 Supports JVM Gradle 5.6 から AGP 9.0 まで 6 年 Experimental Kotlin AGP 7.2 Supports Java AGP 9.0 Stable Kotlin & IDE
  15. 01 / 02 WHY BUILD MODEL Why so complicated Document

    を 写すだけ... AGP / KGP が 大きすぎる... Compile SDK の ための作業...
  16. 02 / 02 WHY BUILD MODEL May the Build Model

    be with you 書いた 1 行を 説明できる どこを触るか 当たりがつく API diff の 意味がわかる
  17. 01 / 04 GRADLE BUILD MODEL Gradle Build Model INITIALIZATION

    CONFIGURATION EXECUTION Settings Plugin Extension Project SourceSet Configuration Task
  18. 02 / 04 GRADLE BUILD MODEL Initialization Phase INITIALIZATION Settings

    CONFIGURATION EXECUTION Settings org.gradle.api.initialization.Settings Plugin Extension この build が何で構成されるかを表すモデル Project Project org.gradle.api.Project SourceSet Configuration :app のような Gradle モジュール 1 つを表すモデル Task
  19. 03 / 04 GRADLE BUILD MODEL Configuration Phase INITIALIZATION CONFIGURATION

    EXECUTION Settings Plugin Extension Project Plugin org.gradle.api.Plugin<Project> SourceSet Extension、ビルド対象、Task を作るオブジェクト ビルド対象と Task は Set<*> で保持される Extension Configuration Plugin に値を設定するためのモデル Task
  20. 04 / 04 GRADLE BUILD MODEL Configuration Phase INITIALIZATION CONFIGURATION

    SourceSet Settings ※ org.gradle.api.tasks.SourceSet 入力として扱うソースとリソースの集合 EXECUTION Configuration Task org.gradle.api.artifacts.Configuration org.gradle.api.Task Plugin Extension 依存とアーティファクトの集合 Project SourceSet Configuration Task 処理のまとまりを表すモデル
  21. 01 / 06 JAVA GRADLE PLUGIN Configuration, what? gradle.afterProject {

    configurations.forEach { println(it.name) } } androidJdkImage androidTestAnnotationProcessor androidTestApi androidTestCompileOnly androidTestDebugAnnotationProcessor androidTestDebugApi androidTestDebugCompileOnly androidTestDebugImplementation androidTestDebugImplementationDependenciesMetadata androidTestDebugRuntimeOnly androidTestDebugWearApp androidTestImplementation androidTestImplementationDependenciesMetadata androidTestReleaseAnnotationProcessor androidTestReleaseApi androidTestReleaseCompileOnly androidTestReleaseImplementation androidTestReleaseImplementationDependenciesMetadata androidTestReleaseRuntimeOnly androidTestReleaseWearApp androidTestRuntimeOnly androidTestUtil androidTestWearApp annotationProcessor api archives compileOnly compileOnlyApi composeMappingProducerClasspath coreLibraryDesugaring debugAnnotationProcessor debugApi debugCompileOnly debugCompileOnlyApi debugImplementation debugImplementationDependenciesMetadata debugRuntimeOnly debugWearApp default implementation implementationDependenciesMetadata jacocoAgent jacocoAnt kotlinBuildToolsApiClasspath kotlinCompilerClasspath kotlinCompilerPluginClasspath kotlinInternalAbiValidation kotlinKlibCommonizerClasspath kotlinNativeCompilerPluginClasspath ksp kspAndroidTest kspAndroidTestDebug kspAndroidTestRelease kspDebug kspRelease kspTest kspTestDebug kspTestFixtures kspTestFixturesDebug kspTestFixturesRelease kspTestRelease lintChecks lintPublish releaseAnnotationProcessor releaseApi releaseCompileOnly releaseCompileOnlyApi releaseImplementation releaseImplementationDependenciesMetadata releaseRuntimeOnly releaseWearApp runtimeOnly testAnnotationProcessor testApi testCompileOnly testDebugAnnotationProcessor testDebugApi testDebugCompileOnly testDebugImplementation testDebugImplementationDependenciesMetadata testDebugRuntimeOnly testDebugWearApp testFixturesAnnotationProcessor testFixturesApi testFixturesCompileOnly testFixturesCompileOnlyApi testFixturesDebugAnnotationProcessor testFixturesDebugApi testFixturesDebugCompileOnly testFixturesDebugCompileOnlyApi testFixturesDebugImplementation testFixturesDebugImplementationDependenciesMetadata testFixturesDebugRuntimeOnly testFixturesDebugWearApp testFixturesImplementation testFixturesImplementationDependenciesMetadata testFixturesReleaseAnnotationProcessor testFixturesReleaseApi testFixturesReleaseCompileOnly testFixturesReleaseCompileOnlyApi testFixturesReleaseImplementation testFixturesReleaseImplementationDependenciesMetadata testFixturesReleaseRuntimeOnly testFixturesReleaseWearApp testFixturesRuntimeOnly testFixturesWearApp testImplementation testImplementationDependenciesMetadata testReleaseAnnotationProcessor testReleaseApi testReleaseCompileOnly testReleaseImplementation testReleaseImplementationDependenciesMetadata testReleaseRuntimeOnly testReleaseWearApp testRuntimeOnly testWearApp wearApp
  22. 02 / 06 JAVA GRADLE PLUGIN Configuration, what? gradle.afterProject {

    configurations.forEach { println(it.name) } } androidJdkImage androidTestAnnotationProcessor androidTestApi androidTestCompileOnly androidTestDebugAnnotationProcessor androidTestDebugApi androidTestDebugCompileOnly androidTestDebugImplementation androidTestDebugImplementationDependenciesMetadata androidTestDebugRuntimeOnly androidTestDebugWearApp androidTestImplementation androidTestImplementationDependenciesMetadata androidTestReleaseAnnotationProcessor androidTestReleaseApi androidTestReleaseCompileOnly androidTestReleaseImplementation androidTestReleaseImplementationDependenciesMetadata androidTestReleaseRuntimeOnly androidTestReleaseWearApp androidTestRuntimeOnly androidTestUtil androidTestWearApp annotationProcessor api archives compileOnly compileOnlyApi composeMappingProducerClasspath coreLibraryDesugaring debugAnnotationProcessor debugApi debugCompileOnly debugCompileOnlyApi debugImplementation debugImplementationDependenciesMetadata debugRuntimeOnly debugWearApp default implementation implementationDependenciesMetadata jacocoAgent jacocoAnt kotlinBuildToolsApiClasspath kotlinCompilerClasspath kotlinCompilerPluginClasspath kotlinInternalAbiValidation kotlinKlibCommonizerClasspath kotlinNativeCompilerPluginClasspath ksp kspAndroidTest kspAndroidTestDebug kspAndroidTestRelease kspDebug kspRelease kspTest kspTestDebug kspTestFixtures kspTestFixturesDebug kspTestFixturesRelease kspTestRelease lintChecks lintPublish releaseAnnotationProcessor releaseApi releaseCompileOnly releaseCompileOnlyApi releaseImplementation releaseImplementationDependenciesMetadata releaseRuntimeOnly releaseWearApp runtimeOnly testAnnotationProcessor testApi testCompileOnly testDebugAnnotationProcessor testDebugApi testDebugCompileOnly testDebugImplementation testDebugImplementationDependenciesMetadata testDebugRuntimeOnly testDebugWearApp testFixturesAnnotationProcessor testFixturesApi testFixturesCompileOnly testFixturesCompileOnlyApi testFixturesDebugAnnotationProcessor testFixturesDebugApi testFixturesDebugCompileOnly testFixturesDebugCompileOnlyApi 一旦 Java Gradle Plugin で考える testFixturesDebugImplementation testFixturesDebugImplementationDependenciesMetadata testFixturesDebugRuntimeOnly testFixturesDebugWearApp testFixturesImplementation testFixturesImplementationDependenciesMetadata testFixturesReleaseAnnotationProcessor testFixturesReleaseApi testFixturesReleaseCompileOnly testFixturesReleaseCompileOnlyApi testFixturesReleaseImplementation testFixturesReleaseImplementationDependenciesMetadata testFixturesReleaseRuntimeOnly testFixturesReleaseWearApp testFixturesRuntimeOnly testFixturesWearApp testImplementation testImplementationDependenciesMetadata testReleaseAnnotationProcessor testReleaseApi testReleaseCompileOnly testReleaseImplementation testReleaseImplementationDependenciesMetadata testReleaseRuntimeOnly testReleaseWearApp testRuntimeOnly testWearApp wearApp
  23. 03 / 06 JAVA GRADLE PLUGIN Java Gradle Plugin, then?

    gradle.afterProject { configurations.forEach { println(it.name) } } api implementation compileOnly compileOnlyApi runtimeOnly annotationProcessor testImplementation testCompileOnly testRuntimeOnly testAnnotationProcessor compileClasspath runtimeClasspath testCompileClasspath testRuntimeClasspath apiElements runtimeElements mainSourceElements testResultsElementsForTest
  24. 04 / 06 JAVA GRADLE PLUGIN Java Gradle Plugin, then?

    gradle.afterProject { configurations.forEach { println(it.name) } } Dependency Scope Classpath Elements 依存を宣言する場所 artifact を解決する入力 artifact を公開する出力 api implementation compileOnly compileOnlyApi runtimeOnly annotationProcessor testImplementation testCompileOnly testRuntimeOnly testAnnotationProcessor compileClasspath runtimeClasspath testCompileClasspath testRuntimeClasspath apiElements runtimeElements mainSourceElements testResultsElementsForTest
  25. 05 / 06 JAVA GRADLE PLUGIN You already type them

    dependencies { implementation("$groupId:$artifactId:$version") } dependencies { add("implementation", "$groupId:$artifactId:$version") } fun DependencyHandler.implementation(dependencyNotation: Any): Dependency? = add("implementation", dependencyNotation)
  26. 06 / 06 JAVA GRADLE PLUGIN Java Gradle Plugin, doing

    what? INITIALIZATION Settings CONFIGURATION implementation Plugin compileOnly EXECUTION extendsFrom Extension Project main が持つ input は src/main/java src/main/resources main compile Classpath compileJava
  27. 01 / 03 EXTENSION & SOURCESET sourceSets is not a

    SourceSet Java Gradle Plugin AGP sourceSets { main { java.srcDir("src/gen") } } android { sourceSets { getByName("main") { ... } } } fun Project.sourceSets(configure: Action<SourceSetContainer>) = (this as ExtensionAware).extensions.configure("sourceSets", configure) interface com.android.build.api.dsl.ApplicationExtension { val sourceSets: NamedDomainObjectContainer<out AndroidSourceSet> } sourceSets は SourceSet への入り口
  28. 02 / 03 EXTENSION & SOURCESET AGP 9, no more

    type parameters BEFORE AGP 8.x fun CommonExtension<*, *, *, *>.something() { } fun CommonExtension<*, *, *, *, *>.something() { } fun CommonExtension<*, *, *, *, *, *>.something() { } // AGP 7.0 - 8.0 // AGP 8.1 // AGP 8.3 AFTER AGP 9.0 interface com.android.build.api.dsl.CommonExtension interface com.android.build.api.dsl.ApplicationExtension : CommonExtension fun CommonExtension.something() { } Type Parameter が増減していたため ソース互換性 が低かった AGP 9 で CommonExtension の Type Parameter を全廃し、DSL ブロックをサブタイプ側へ移した
  29. 03 / 03 EXTENSION & SOURCESET Kotlin DSL gets it

    too inline fun <reified T : Any> ExtensionContainer.findByType(): T? = findByType(typeOf<T>()) // TypeOf<T>, not Class<T> BEFORE AGP 8.x extensions.findByType<CommonExtension<*, *, *, *, *, *>>() // null -> org.gradle.api.reflect.TypeOf<CommonExtension<?, ?, ?, ?, ?, ?>> AFTER AGP 9.0 extensions.findByType<CommonExtension>() -> TypeOf<CommonExtension> Class<T> なら型引数は消えるが TypeOf<T> は型引数 が消えない Type Parameter がなくなったため TypeOf<T> でも CommonExtension を取得できるようになった
  30. 01 / 02 NON BUILD PLUGIN And com.google.devtools.ksp? Plugin plugins

    { id("com.google.devtools.ksp") } Extension ksp { arg("key", "value") } fun Project.`ksp`(configure: Action<KspExtension>): Unit = (this as ExtensionAware).extensions.configure("ksp", configure) Configuration dependencies { ksp("$groupId:$artifactId:$version") } fun DependencyHandler.`ksp`(dependencyNotation: Any): Dependency? = add("ksp", dependencyNotation)
  31. 02 / 02 NON BUILD PLUGIN And com.google.devtools.ksp? Plugin plugins

    { id("com.google.devtools.ksp") } Task ksp { arg("key", "value") } kspDebugKotlin Extension fun Project.`ksp`(configure: Action<KspExtension>): Unit = (this as ExtensionAware).extensions.configure("ksp", configure) dependencies { ksp("$groupId:$artifactId:$version") } Configuration fun DependencyHandler.`ksp`(dependencyNotation: Any): Dependency? = add("ksp", dependencyNotation)
  32. 01 / 01 FIRST HALF WRAP UP What You Write,

    What a Plugin Makes Gradle はビルドを抽象化したモデルを持っている Plugin は Extension と SourceSet と Configuration と Task を作る ビルドを設定しない Plugin も、Extension と Configuration から Task へ入力を渡す 書いているブロックは Extension、dependencies の名前は Configuration Kotlin DSL の Generics に要注意 Plugin を作る側は、公開 API を不必要に Generics へ依存させない 使う側は、必要なら Java like な書き方で対応する
  33. 01 / 06 KGP BUILD MODEL Kotlin JVM Gradle Plugin,

    doing what? INITIALIZATION CONFIGURATION EXECUTION Settings Java Gradle Plugin とほぼ同じ構成 Plugin Extension Project main が持つ入力は src/main/kotlin src/main/java main compile Classpath compileKotlin
  34. 02 / 06 KGP BUILD MODEL Kotlin JVM Gradle Plugin,

    doing what? SourceSet Configuration Task Output Java Gradle Plugin main compileClasspath compileJava classes compileClasspath compileKotlin classes Java Plugin のものを そのまま使う 出力が compileJava の classpath へ src/main/java Kotlin JVM Plugin main src/main/kotlin src/main/java Kotlin JVM Plugin は Java Gradle Plugin を適用した上に乗っている
  35. 03 / 06 KGP BUILD MODEL Sharing commonMain commonMain nativeMain

    jvmMain androidMain appleMain linuxMain mingwMain iosMain tvosMain watchosMain iosArm64Main iosSimulatorArm64Main iosArm64 / main の Compilation jvm / main の Compilation androidNativeMain macosMain
  36. 04 / 06 KGP BUILD MODEL commonMain's output, what? SourceSet

    Configuration Task Output Java Gradle Plugin main compileClasspath compileJava classes jvmCompileClasspath compileKotlinJvm classes iosArm64CompileKlibraries compileKotlinIosArm64 klib Kotlin Multiplatform Plugin commonMain org.gradle.api.tasks.SourceSet は行き先が一つであることを前提に作られている
  37. 05 / 06 KGP BUILD MODEL KGP defines its own

    SourceSet and Compilation org.gradle.api.tasks.SourceSet Source Dependency KotlinSourceSet Source Classpath Output KotlinCompilation Dependency + 他の SourceSet への dependsOn Classpath + どの SourceSet を集めるか + どの Target 向けか 共有できる org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet を定義した Output
  38. 06 / 06 KGP BUILD MODEL Between SourceSet and Task

    INITIALIZATION CONFIGURATION EXECUTION Settings KotlinTarget Plugin Project Extension KotlinCompilation commonMain SourceSet jvmMain Configuration jvmCompileClasspath Task KotlinSourceSet と KotlinCompilation で Many to Many を実現した
  39. 01 / 04 LEGACY VARIANT API Sharing main SourceSet Output

    Java Gradle Plugin main compileJava jar Android Gradle Plugin fooDebug main flavor foo/bar type debug/release fooRelease barDebug barRelease main の出力は build type × flavor 通りある apk aab aar etc...
  40. 02 / 04 LEGACY VARIANT API main's tasks, how many?

    SourceSet Output Java Gradle Plugin main compileJava jar Android は ビルドするものがいっぱいある Android Gradle Plugin fooDebug main flavor foo/bar type debug/release fooRelease barDebug barRelease preBuild checkManifest aidlCompile apk renderscriptCompile mergeResources aab mergeAssets aar generateBuildConfig etc... javaCompile processJavaResources assemble
  41. 03 / 04 LEGACY VARIANT API com.android.build.gradle.api.BaseVariant SourceSet Output Java

    Gradle Plugin compileJava fooDebug main ひとつぶんが BaseVariant ひとつ Android Gradle Plugin BaseVariant fooDebug main flavor foo/bar type debug/release jar fooRelease barDebug barRelease preBuild checkManifest aidlCompile apk renderscriptCompile mergeResources aab mergeAssets aar generateBuildConfig etc... javaCompile processJavaResources assemble
  42. 04 / 04 LEGACY VARIANT API From SourceSet to Task

    INITIALIZATION CONFIGURATION EXECUTION Settings Variant の数だけ Configuration と Task が作られる Plugin Extension com.android.build.gradle.api.BaseVariant Project com.android.build.gradle.api AndroidSourceSet Configuration Task
  43. 01 / 03 ANDROID COMPONENTS API Build Model of Components

    API INITIALIZATION CONFIGURATION EXECUTION Extension Settings 束ねる型が Component になり、 Extension が 1 つ増えた Plugin androidComponents com.android.build.api.variant.Component Project com.android.build.api.dsl AndroidSourceSet Configuration Task new
  44. 02 / 03 ANDROID COMPONENTS API Build Model of Components

    API INITIALIZATION CONFIGURATION EXECUTION Extension Settings 束ねる型が Component になり、 Extension が 1 つ増えた Plugin ココ androidComponents com.android.build.api.variant.Component Project com.android.build.api.dsl AndroidSourceSet Configuration AndroidSourceSet com.android.build.api.dsl Task
  45. 03 / 03 ANDROID COMPONENTS API Component Lifecycle Hooks 何をいつ変えられるのかが型で決まる

    Initialization android {} com.android.build.api.variant Configuration com.android.build.api.variant ComponentBuilder Component 確定前 確定後 finalizeDsl beforeVariants Execution onVariants
  46. 01 / 02 BUILT-IN KOTLIN Built-in Kotlin means ... Extension

    & Task Extension kotlin ブロックを AGP が用意する - id("org.jetbrains.kotlin.android") Task KotlinCompile を Component ごとに AGP が用意する KotlinCompile を AGP が主導する形に変わった
  47. 02 / 02 BUILT-IN KOTLIN Built-in Kotlin means ... Who

    Calls Whom Timing AGP 8.x AGP BaseVariant を作る BaseVariant を覗く Kotlin の出力を登録する KotlinCompile を作る KGP AGP 9.0 AGP Component を作る Artifacts に組み込む KotlinCompile を作らせる KGP コンパイルするのは KGP のまま KotlinCompile を作る source と classpath
  48. 01 / 02 KMP LIBRARY KMP Plugin means ... One

    Extension BEFORE AGP 8.x AFTER AGP 9.0 plugins { id("org.jetbrains.kotlin.multiplatform") id("com.android.library") } plugins { id("org.jetbrains.kotlin.multiplatform") id("com.android.kotlin.multiplatform.library" ) } kotlin { androidTarget() } kotlin { // AGP 8.10-8.11: androidLibrary // AGP 8.12+: android android { // namespace, compileSdk, minSdk } AGP が KGP を拡張する } KGP が AGP を拡張する android { // namespace, compileSdk, minSdk } Android のビルドをより一層 KGP に移譲する
  49. 02 / 02 KMP LIBRARY KMP Plugin means ... One

    Build Unit Timing com.android.library + androidTarget() AGP BaseVariant を作る BaseVariant を覗く Kotlin の出力を登録する KotlinCompilation を作る KGP com.android.kotlin.multiplatform.library AGP KotlinTarget を実装する 実装を渡す KGP 同じ 2 つの Plugin の境界が、モジュールの種類で逆を向く Compilation と Task を組み立てる
  50. 01 / 01 TEST FIXTURES Test Fixtures means ... AGP

    8.5 - 8.x, flag ON Variant / HostTest / DeviceTest TestFixtures KGP が作る AGP が呼んで作る android.experimental.enableTestFixturesKotlinSupport KotlinCompile KotlinCompile AGP 9.0 All Component AGP が呼んで作る KotlinCompile 実験フラグの向こうで先取りしていた形が、そのまま既定になった
  51. 01 / 02 WRAP UP Models and FQCNs KGP は

    source を 階層で共有できるようにモデリングした AGP は組み合わせをビルド単位で管理する Legacy Variant API を細分化して Components API になった 同じ名前で別のモデルがあるので要注意 SourceSet org.gradle.api.tasks.SourceSet org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet com.android.build.gradle.api.AndroidSourceSet com.android.build.api.dsl.AndroidSourceSet Variant / Component com.android.build.api.variant.Variant / Component com.android.build.gradle.api.BaseVariant org.gradle.api.component.SoftwareComponentVariant org.gradle.api.artifacts.ConfigurationVariant ← Gradle にもある
  52. 02 / 02 WRAP UP What to Look at, What

    to Follow Plugin を読み解くとき SourceSet / Configuration / Task の関係を整理して、ビルド単位を見つける SourceSet と Configuration に変更が入りそうなとき モデルの基礎なので、Plugin 全体へ波及する 今後のことも考えて、なるべく早く追従する AGP が Kotlin Gradle Plugin を扱うようになった ただし KMP はまだどうなるか分からない
  53. Notice The Android robot is reproduced or modified from work

    created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Kodee by JetBrains s.r.o. is licensed under CC BY 4.0. Modified from the original. This deck was built with Claude Code (Anthropic) as an authoring tool. All structure, wording, and technical claims were written, verified, and edited by the author. Android™ is a trademark of Google LLC. Kotlin® is a trademark of the Kotlin Foundation. Gradle® and Gradle Build Tool™ are trademarks of Gradle, Inc. This session is not affiliated with, sponsored, or endorsed by Google LLC, JetBrains s.r.o., the Kotlin Foundation, or Gradle, Inc.
  54. EOF