Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import com.project.starter.easylauncher.filter.ColorRibbonFilter
plugins {
id("hedvig.android.application")
id("hedvig.gradle.plugin")
alias(libs.plugins.appIconBannerGenerator) // Automatically adds the "DEBUG" banner on the debug app icon
alias(libs.plugins.crashlytics)
alias(libs.plugins.datadog)
alias(libs.plugins.googleServices)
alias(libs.plugins.license)
id("com.starter.easylauncher") // Automatically adds the "DEBUG" banner on the debug app icon
id("com.google.firebase.crashlytics")
id("com.datadoghq.dd-sdk-android-gradle-plugin")
id("com.google.gms.google-services")
id("com.jaredsburrows.license")
}

hedvig {
Expand Down
2 changes: 1 addition & 1 deletion app/authlib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("hedvig.multiplatform.library")
id("hedvig.gradle.plugin")
alias(libs.plugins.kmpNativeCoroutines)
id("com.rickclephas.kmp.nativecoroutines")
}

hedvig {
Expand Down
2 changes: 1 addition & 1 deletion app/core/core-datastore-public/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("hedvig.multiplatform.library")
id("hedvig.multiplatform.library.android")
id("hedvig.gradle.plugin")
alias(libs.plugins.kmpNativeCoroutines)
id("com.rickclephas.kmp.nativecoroutines")
}

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions app/core/core-resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import java.io.FileInputStream
import java.util.Properties

plugins {
alias(libs.plugins.composeKotlinCompilerGradlePlugin)
alias(libs.plugins.composeJetbrainsCompilerGradlePlugin)
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.compose")
id("hedvig.multiplatform.library")
id("hedvig.multiplatform.library.android")
id("hedvig.android.lokalise")
Expand Down
2 changes: 1 addition & 1 deletion app/featureflags/feature-flags/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("hedvig.multiplatform.library")
id("hedvig.multiplatform.library.android")
id("hedvig.gradle.plugin")
alias(libs.plugins.kmpNativeCoroutines)
id("com.rickclephas.kmp.nativecoroutines")
}

hedvig {
Expand Down
6 changes: 3 additions & 3 deletions app/umbrella/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import org.gradle.api.internal.catalog.DelegatingProjectDependency
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

plugins {
alias(libs.plugins.composeKotlinCompilerGradlePlugin)
alias(libs.plugins.composeJetbrainsCompilerGradlePlugin)
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.compose")
id("hedvig.multiplatform.library")
id("hedvig.multiplatform.library.android")
id("hedvig.gradle.plugin")
alias(libs.plugins.kmpNativeCoroutines)
id("com.rickclephas.kmp.nativecoroutines")
}

kotlin {
Expand Down
36 changes: 28 additions & 8 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,34 @@ kotlin {
}

dependencies {
compileOnly(libs.android.gradlePlugin)
compileOnly(libs.androidMultiplatform.gradlePlugin)
compileOnly(libs.apollo.gradlePlugin)
compileOnly(libs.compose.compilerGradlePlugin)
compileOnly(libs.compose.gradlePlugin)
compileOnly(libs.kotlin.gradlePlugin)
compileOnly(libs.kotlinter.gradlePlugin)
compileOnly(libs.room.gradlePlugin)
// build-logic owns the whole build's plugin classpath. Every plugin the build applies is an
// `implementation` dependency here (not `compileOnly`), so it lives on this classloader: the
// `hedvig.settings` precompiled settings plugin loads them, the convention plugins' handler code
// (ApolloHandler, ComposeHandler, ...) can reference their types at runtime, and both settings and
// project scripts apply them by id without a version, keeping the catalog the single source of truth.
// Kotlin compiler plugins (metro, kmpNativeCoroutines, ksp) must sit on the same classloader as the
// Kotlin plugin, which is exactly here. Add new build plugins to this list. AGP carries the
// com.android.{application,library,lint,kotlin.multiplatform.library} ids and KGP carries
// org.jetbrains.kotlin.{android,jvm,multiplatform}, so only the remaining ids need their own marker.
implementation(libs.android.gradlePlugin)
implementation(libs.kotlin.gradlePlugin)
implementation(libs.compose.compilerGradlePlugin)
implementation(libs.compose.gradlePlugin)
implementation(libs.kotlinSerialization.gradlePlugin)
implementation(libs.apollo.gradlePlugin)
implementation(libs.kotlinter.gradlePlugin)
implementation(libs.room.gradlePlugin)
implementation(libs.gradleDevelocity.gradlePlugin)
implementation(libs.ksp.gradlePlugin)
implementation(libs.metro.gradlePlugin)
implementation(libs.kmpNativeCoroutines.gradlePlugin)
implementation(libs.cacheFix.gradlePlugin)
implementation(libs.crashlytics.gradlePlugin)
implementation(libs.datadog.gradlePlugin)
implementation(libs.googleServices.gradlePlugin)
implementation(libs.license.gradlePlugin)
implementation(libs.appIconBannerGenerator.gradlePlugin)
implementation(libs.squareSortDependencies.gradlePlugin)

// Enables using type-safe accessors to reference plugins from the [plugins] block defined in version catalogs.
// Context: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Precompiled settings convention plugin. Applied from the root settings.gradle.kts as
// `id("hedvig.settings")`.
//
// Applying a build-logic plugin here puts build-logic's whole plugin classpath (see build.gradle.kts)
// on the settings classloader, which is the parent of every project's classloader. That is what lets
// project scripts apply plugins by id without a version, so plugin versions live only in
// gradle/libs.versions.toml. A settings `plugins {}` block cannot do this itself: it has no
// version-catalog accessors and accepts only literals, which would mean duplicating every version.
//
// Only plugins that operate on Settings belong in the block below; everything else is applied by the
// projects that need it.
plugins {
id("com.gradle.develocity")
}
28 changes: 4 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.androidLibraryMultiplatform) apply false
alias(libs.plugins.apollo) apply false
alias(libs.plugins.appIconBannerGenerator) apply false
alias(libs.plugins.cacheFix) apply false
alias(libs.plugins.composeJetbrainsCompilerGradlePlugin) apply false
alias(libs.plugins.composeKotlinCompilerGradlePlugin) apply false
alias(libs.plugins.crashlytics) apply false
alias(libs.plugins.datadog) apply false
// Every other plugin's classpath is supplied by the `hedvig.settings` convention plugin (see
// build-logic/convention/build.gradle.kts), so project scripts apply them by id without a version.
// Only plugins applied to the root project itself are declared here.
alias(libs.plugins.dependencyAnalysis)
alias(libs.plugins.doctor)
alias(libs.plugins.googleServices) apply false
alias(libs.plugins.kmpNativeCoroutines) apply false
alias(libs.plugins.kotlinJvm) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinter) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.license) apply false
alias(libs.plugins.lintGradlePlugin) apply false
alias(libs.plugins.metro) apply false
alias(libs.plugins.room) apply false
alias(libs.plugins.serialization) apply false
alias(libs.plugins.squareSortDependencies) apply false
id("hedvig.gradle.plugin") apply false
alias(libs.plugins.doctor)
}

apply {
Expand Down
31 changes: 22 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ datadog-sdk-trace-otel = { module = "com.datadoghq:dd-sdk-android-trace-otel", v
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version = "34.16.0" }
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" }
firebase-crashlytics-buildtools = { group = "com.google.firebase", name = "firebase-crashlytics-buildtools", version.ref = "firebaseCrashlyticsBuildtools" }
firebase-messaging = { module = "com.google.firebase:firebase-messaging" }
jetbrains-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "jetbrains-compose" }
jetbrains-compose-animation = { module = "org.jetbrains.compose.animation:animation", version.ref = "jetbrains-animation" }
Expand Down Expand Up @@ -241,23 +242,35 @@ uri-kmp = { module = "com.eygraber:uri-kmp", version.ref = "uriKmp" }
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
zXing = { module = "com.google.zxing:core", version.ref = "zXing" }
zoomable = { module = "com.mxalbert.zoomable:zoomable", version.ref = "zoomable" }
# Plugin libraries for build-logic's convention plugins to use to resolve the types/tasks coming from these plugins
# lint dependencies
lintApi = { module = "com.android.tools.lint:lint-api", version.ref = "lintApi" }

# temporary bug workaround
androidx-kmp-preview-bug1-workaround = { module = "androidx.customview:customview-poolingcontainer", version = "1.1.0" }
androidx-kmp-preview-bug2-workaround = { module = "androidx.emoji2:emoji2", version = "1.6.0" }

# Everything below is a Gradle plugin artifact rather than a dependency of the app. build-logic declares
# these so the plugins land on its classpath and the build can apply them by id, without a version.
android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
androidMultiplatform-gradlePlugin = { module = "com.android.kotlin.multiplatform.library:com.android.kotlin.multiplatform.library.gradle.plugin", version.ref = "androidGradlePlugin" }
apollo-gradlePlugin = { module = "com.apollographql.apollo:apollo-gradle-plugin", version.ref = "apollo" }
appIconBannerGenerator-gradlePlugin = { module = "com.starter.easylauncher:com.starter.easylauncher.gradle.plugin", version.ref = "easylauncher" }
cacheFix-gradlePlugin = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version.ref = "cacheFix" }
compose-compilerGradlePlugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }
compose-gradlePlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "jetbrains-compose" }
firebase-crashlytics-buildtools = { group = "com.google.firebase", name = "firebase-crashlytics-buildtools", version.ref = "firebaseCrashlyticsBuildtools" }
crashlytics-gradlePlugin = { module = "com.google.firebase.crashlytics:com.google.firebase.crashlytics.gradle.plugin", version.ref = "crashlytics" }
datadog-gradlePlugin = { module = "com.datadoghq.dd-sdk-android-gradle-plugin:com.datadoghq.dd-sdk-android-gradle-plugin.gradle.plugin", version.ref = "datadogPlugin" }
googleServices-gradlePlugin = { module = "com.google.gms.google-services:com.google.gms.google-services.gradle.plugin", version.ref = "googleServices" }
gradleDevelocity-gradlePlugin = { module = "com.gradle.develocity:com.gradle.develocity.gradle.plugin", version.ref = "gradleDevelocity" }
kmpNativeCoroutines-gradlePlugin = { module = "com.rickclephas.kmp.nativecoroutines:com.rickclephas.kmp.nativecoroutines.gradle.plugin", version.ref = "kmpNativeCoroutines" }
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinSerialization-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
kotlinter-gradlePlugin = { module = "org.jmailen.gradle:kotlinter-gradle", version.ref = "kotlinter" }
ksp-gradlePlugin = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
license-gradlePlugin = { module = "com.jaredsburrows.license:com.jaredsburrows.license.gradle.plugin", version.ref = "license" }
metro-gradlePlugin = { module = "dev.zacsweers.metro:dev.zacsweers.metro.gradle.plugin", version.ref = "metro" }
room-gradlePlugin = { module = "androidx.room:room-gradle-plugin", version.ref = "room" }

# lint dependencies
lintApi = { module = "com.android.tools.lint:lint-api", version.ref = "lintApi" }

# temporary bug workaround
androidx-kmp-preview-bug1-workaround = { module = "androidx.customview:customview-poolingcontainer", version = "1.1.0" }
androidx-kmp-preview-bug2-workaround = { module = "androidx.emoji2:emoji2", version = "1.6.0" }
squareSortDependencies-gradlePlugin = { module = "com.squareup.sort-dependencies:com.squareup.sort-dependencies.gradle.plugin", version.ref = "squareSortDependencies" }

[bundles]
kmpPreviewBugWorkaround = ["androidx-kmp-preview-bug1-workaround", "androidx-kmp-preview-bug2-workaround"]
Expand Down
4 changes: 2 additions & 2 deletions hedvig-lint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("hedvig.gradle.plugin")
`java-library`
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.lintGradlePlugin)
id("org.jetbrains.kotlin.jvm")
id("com.android.lint")
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencyResolutionManagement {
}

plugins {
id("com.gradle.develocity") version "4.5.0"
id("hedvig.settings")
}

develocity {
Expand Down
Loading