Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial work on migrating plugins to catalogs. #3737

Merged
merged 5 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
29 changes: 14 additions & 15 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@ import com.github.triplet.gradle.androidpublisher.ResolutionStrategy
import com.google.gms.googleservices.GoogleServicesPlugin.GoogleServicesPluginConfig

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("kotlin-parcelize")
id("com.google.firebase.appdistribution")
id("com.github.triplet.play")
id("com.google.gms.google-services")
kotlin("kapt")
id("dagger.hilt.android.plugin")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.firebase.appdistribution)
alias(libs.plugins.play.publisher)
alias(libs.plugins.google.services)
alias(libs.plugins.hilt)
}

android {
namespace = "io.homeassistant.companion.android"

compileSdk = 33
compileSdk = libs.versions.androidSdk.compile.get().toInt()

ndkVersion = "21.3.6528147"

useLibrary("android.car")

defaultConfig {
applicationId = "io.homeassistant.companion.android"
minSdk = 21
targetSdk = 33
minSdk = libs.versions.androidSdk.min.get().toInt()
targetSdk = libs.versions.androidSdk.target.get().toInt()

versionName = project.version.toString()
versionCode = System.getenv("VERSION_CODE")?.toIntOrNull() ?: 1
Expand All @@ -50,12 +49,12 @@ android {
}

kotlinOptions {
jvmTarget = "11"
jvmTarget = libs.versions.javaVersion.get()
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility(libs.versions.javaVersion.get())
targetCompatibility(libs.versions.javaVersion.get())
}

firebaseAppDistribution {
Expand Down
23 changes: 11 additions & 12 deletions automotive/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import com.github.triplet.gradle.androidpublisher.ResolutionStrategy
import com.google.gms.googleservices.GoogleServicesPlugin.GoogleServicesPluginConfig

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("kotlin-parcelize")
id("com.github.triplet.play")
id("com.google.gms.google-services")
kotlin("kapt")
id("dagger.hilt.android.plugin")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.play.publisher)
alias(libs.plugins.google.services)
alias(libs.plugins.hilt)
}

android {
Expand All @@ -24,7 +23,7 @@ android {
defaultConfig {
applicationId = "io.homeassistant.companion.android"
minSdk = 29
targetSdk = 33
targetSdk = libs.versions.androidSdk.target.get().toInt()

versionName = project.version.toString()
// We add 2 because the app, wear (+1) and automotive versions need to have different version codes.
Expand Down Expand Up @@ -85,12 +84,12 @@ android {
}

kotlinOptions {
jvmTarget = "11"
jvmTarget = libs.versions.javaVersion.get()
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility(libs.versions.javaVersion.get())
targetCompatibility(libs.versions.javaVersion.get())
}

signingConfigs {
Expand Down
28 changes: 11 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.ktlint)
}

buildscript {
repositories {
google()
gradlePluginPortal()
}
dependencies {
classpath(libs.android.plugin)
classpath(libs.kotlin.gradle.plugin)
classpath(libs.google.services)
classpath(libs.firebase.appdistribution.gradle)
classpath(libs.android.junit5)
classpath(libs.play.publisher)
classpath(libs.hilt.android.gradle.plugin)
}
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.kotlin.android).apply(false)
alias(libs.plugins.google.services).apply(false)
alias(libs.plugins.firebase.appdistribution).apply(false)
alias(libs.plugins.play.publisher).apply(false)
alias(libs.plugins.hilt).apply(false)
alias(libs.plugins.kotlin.kapt).apply(false)
alias(libs.plugins.kotlin.parcelize).apply(false)
}

allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId)

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = libs.versions.javaVersion.get()
}
}
}
Expand Down
17 changes: 8 additions & 9 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-kapt")
kotlin("kapt")
id("dagger.hilt.android.plugin")
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.hilt)
}

val homeAssistantAndroidPushUrl: String by project
Expand All @@ -18,7 +17,7 @@ android {
compileSdk = 33
JBassett marked this conversation as resolved.
Show resolved Hide resolved

defaultConfig {
minSdk = 21
minSdk = libs.versions.androidSdk.min.get().toInt()
buildConfigField("String", "PUSH_URL", "\"$homeAssistantAndroidPushUrl\"")
buildConfigField("String", "RATE_LIMIT_URL", "\"$homeAssistantAndroidRateLimitUrl\"")
buildConfigField("String", "VERSION_NAME", "\"$versionName-$versionCode\"")
Expand All @@ -36,12 +35,12 @@ android {
}

kotlinOptions {
jvmTarget = "11"
jvmTarget = libs.versions.javaVersion.get()
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility(libs.versions.javaVersion.get())
targetCompatibility(libs.versions.javaVersion.get())
}

lint {
Expand Down
22 changes: 14 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ accompanist = "0.30.1"
activity-compose = "1.7.2"
androidBeaconLibrary = "2.19.6"
androidJunit5 = "1.9.3.0"
androidPlugin = "8.0.2"
androidPlugin = "8.1.0"
androidSdk-compile = "33"
androidSdk-min = "23"
androidSdk-target = "33"
appcompat = "1.6.1"
biometric = "1.1.0"
blurView = "version-1.6.6"
Expand All @@ -27,6 +30,7 @@ healthServicesClient = "1.0.0-rc01"
hilt = "2.47"
iconics = "5.4.0"
jackson-module-kotlin = "2.13.5"
javaVersion = "11"
kotlinx-coroutines = "1.7.3"
kotlin = "1.8.22"
ktlint = "11.5.0"
Expand Down Expand Up @@ -58,16 +62,23 @@ wear-remote-interactions = "1.0.0"
workRuntimeKtx = "2.8.1"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidPlugin" }
android-library = { id = "com.android.library", version.ref = "androidPlugin" }
firebase-appdistribution = { id = "com.google.firebase.appdistribution", version.ref = "firebaseAppdistributionGradle" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
play-publisher = { id = "com.github.triplet.play", version.ref = "playPublisher" }

[libraries]
accompanist-themeadapter-material = { module = "com.google.accompanist:accompanist-themeadapter-material", version.ref = "accompanist" }
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activity-compose" }
android-beacon-library = { module = "org.altbeacon:android-beacon-library", version.ref = "androidBeaconLibrary" }
android-plugin = { module = "com.android.tools.build:gradle", version.ref = "androidPlugin" }
android-junit5 = { module = "de.mannodermaus.gradle.plugins:android-junit5", version.ref = "androidJunit5" }
androidx-health-services-client = { module = "androidx.health:health-services-client", version.ref = "healthServicesClient" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
Expand Down Expand Up @@ -102,20 +113,16 @@ extension-cronet = { module = "com.google.android.exoplayer:extension-cronet", v
exoplayer-ui = { module = "com.google.android.exoplayer:exoplayer-ui", version.ref = "exoplayer" }
exoplayer-hls = { module = "com.google.android.exoplayer:exoplayer-hls", version.ref = "exoplayer" }
exoplayer-core = { module = "com.google.android.exoplayer:exoplayer-core", version.ref = "exoplayer" }
firebase-appdistribution-gradle = { module = "com.google.firebase:firebase-appdistribution-gradle", version.ref = "firebaseAppdistributionGradle" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
firebase-messaging = { module = "com.google.firebase:firebase-messaging" }
fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment-ktx" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
google-services = { module = "com.google.gms:google-services", version.ref = "googleServices" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
iconics-compose = { module = "com.mikepenz:iconics-compose", version.ref = "iconics" }
iconics-core = { module = "com.mikepenz:iconics-core", version.ref = "iconics" }
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson-module-kotlin" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
Expand All @@ -126,7 +133,6 @@ logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", ver
navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
material = { module = "com.google.android.material:material", version.ref = "material" }
play-publisher = { module = "com.github.triplet.gradle:play-publisher", version.ref = "playPublisher" }
play-services-threadnetwork = { module = "com.google.android.gms:play-services-threadnetwork", version.ref = "play-services-threadnetwork" }
play-services-home = { module = "com.google.android.gms:play-services-home", version.ref = "play-services-home" }
play-services-location = { module = "com.google.android.gms:play-services-location", version.ref = "play-services-location" }
Expand Down
25 changes: 8 additions & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
import org.gradle.kotlin.dsl.support.serviceOf

include(":common", ":app", ":wear", ":automotive")

rootProject.name = "home-assistant-android"

plugins {
id("com.gradle.enterprise").version("3.7")
id("org.ajoberstar.reckon.settings").version("0.18.0")
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
}

// It should be easier to read an environment variable here once github.com/gradle/configuration-cache/issues/211 is resolved.
val isCI = serviceOf<ProviderFactory>()
.environmentVariable("CI")
.forUseAtConfigurationTime().map { it == "true" }
.getOrElse(false)

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlwaysIf(isCI)
isUploadInBackground = !isCI
}
plugins {
// So we can't reach the libs.plugins.* aliases from here so we need to declare them the old way...
dshokouhi marked this conversation as resolved.
Show resolved Hide resolved
id("org.ajoberstar.reckon.settings").version("0.18.0")
}

extensions.configure<org.ajoberstar.reckon.gradle.ReckonExtension> {
Expand Down
21 changes: 10 additions & 11 deletions wear/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("com.github.triplet.play")
kotlin("kapt")
id("dagger.hilt.android.plugin")
id("com.google.gms.google-services")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.play.publisher)
alias(libs.plugins.hilt)
alias(libs.plugins.google.services)
}

android {
Expand All @@ -16,7 +15,7 @@ android {
defaultConfig {
applicationId = "io.homeassistant.companion.android"
minSdk = 26
targetSdk = 32
targetSdk = libs.versions.androidSdk.target.get().toInt()
JBassett marked this conversation as resolved.
Show resolved Hide resolved

versionName = project.version.toString()
// We add 1 because the app and wear versions need to have different version codes.
Expand Down Expand Up @@ -61,12 +60,12 @@ android {
}

kotlinOptions {
jvmTarget = "11"
jvmTarget = libs.versions.javaVersion.get()
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility(libs.versions.javaVersion.get())
targetCompatibility(libs.versions.javaVersion.get())
}

lint {
Expand Down