Skip to content

Commit

Permalink
Migrate to Gradle version catalog (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre authored Jun 14, 2024
1 parent 55d9e5e commit 649e984
Show file tree
Hide file tree
Showing 18 changed files with 266 additions and 279 deletions.
6 changes: 2 additions & 4 deletions accessibility-statement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* Software description: Android library of reusable graphical components
*/

import com.orange.ods.gradle.Dependencies

plugins {
id("library")
}
Expand All @@ -34,8 +32,8 @@ android {
}

dependencies {
api(Dependencies.constraintLayout)
implementation(Dependencies.coreKtx)
api(libs.androidx.constraintlayout)
implementation(libs.androidx.core.ktx)
}

mavenCentralPublish {
Expand Down
76 changes: 37 additions & 39 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,30 @@
*/
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.orange.ods.gradle.Dependencies
import com.orange.ods.gradle.Environment
import com.orange.ods.gradle.Versions
import com.orange.ods.gradle.findTypedProperty

plugins {
id("com.android.application")
id("com.google.gms.google-services")
id("kotlin-android")
id("kotlin-parcelize")
id("com.google.firebase.appdistribution")
id("com.google.firebase.crashlytics")
id("firebase")
id("dagger.hilt.android.plugin")
id("org.jetbrains.kotlin.plugin.compose")
id("kotlin-kapt") // This must be the last statement in the plugins {} to avoid "options not recognized" warning
id(libs.plugins.android.application.get().pluginId) // https://github.com/gradle/gradle/issues/20084#issuecomment-1060822638
alias(libs.plugins.compose.compiler)
alias(libs.plugins.firebase.appdistribution)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.google.services)
alias(libs.plugins.hilt)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.kotlin.parcelize.get().pluginId)
id(libs.plugins.kotlin.kapt.get().pluginId) // This must be the last statement in the plugins {} to avoid "options not recognized" warning
}

android {
namespace = "com.orange.ods.app"

compileSdk = Versions.compileSdk
compileSdk = libs.versions.androidCompileSdk.get().toInt()

defaultConfig {
minSdk = Versions.minSdk
targetSdk = Versions.targetSdk
minSdk = libs.versions.androidMinSdk.get().toInt()
targetSdk = libs.versions.androidTargetSdk.get().toInt()
val versionCodeProperty = project.findTypedProperty<String>("versionCode")
versionCode = versionCodeProperty?.toInt() ?: 11
versionName = version.toString()
Expand Down Expand Up @@ -129,34 +127,34 @@ android {
dependencies {
implementation(project(":lib"))
implementation(project(":lib-xml"))
implementation(project(":theme-innovation-cup"))
implementation(project(":module-about"))
implementation(project(":module-more-apps"))
implementation(project(":theme-innovation-cup"))

implementation(Dependencies.accompanistSystemUiController)
implementation(Dependencies.activityCompose)
implementation(Dependencies.appCompat)
implementation(Dependencies.browser)
implementation(Dependencies.coil)
implementation(Dependencies.coilCompose)
implementation(platform(Dependencies.composeBom))
implementation(Dependencies.composeMaterial3)
implementation(Dependencies.composeUi)
debugImplementation(Dependencies.composeUiTooling)
implementation(Dependencies.composeUiToolingPreview)
implementation(Dependencies.coreKtx)
implementation(Dependencies.dataStorePreferences)
implementation(platform(Dependencies.firebaseBom))
implementation(Dependencies.firebaseCrashlytics)
implementation(Dependencies.hiltAndroid)
kapt(Dependencies.hiltCompiler)
implementation(Dependencies.kotlinReflect)
implementation(Dependencies.lifecycleRuntimeKtx)
implementation(Dependencies.lifecycleViewModelKtx)
implementation(Dependencies.material)
implementation(Dependencies.navigationCompose)
implementation(Dependencies.timber)
implementation(Dependencies.webkit)
implementation(libs.accompanist.systemuicontroller)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.browser)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.ui)
debugImplementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.webkit)
implementation(libs.coil)
implementation(libs.coil.compose)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.crashlytics.ktx)
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
implementation(libs.kotlin.reflect)
implementation(libs.material)
implementation(libs.timber)
}

tasks.register<Copy>("copyChangelog") {
Expand Down
29 changes: 5 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,11 @@

plugins {
id("release")
}

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath(com.orange.ods.gradle.Dependencies.androidGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.kotlinGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.firebaseAppDistributionGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.firebaseCrashlyticsGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.googleServicesGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.hiltAndroidGradlePlugin)
classpath(com.orange.ods.gradle.Dependencies.composeCompilerGradlePlugin)
}
}

allprojects {
repositories {
google()
mavenCentral()
}
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.firebase.appdistribution) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.hilt) apply false
}

tasks.register<Delete>("clean") {
Expand Down
7 changes: 4 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ kotlin {
}

dependencies {
implementation("com.android.tools.build:gradle:8.5.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") // https://issuetracker.google.com/issues/176079157#comment14
implementation("com.squareup:javapoet:1.13.0") // https://github.com/google/dagger/issues/3282
implementation(libs.android.gradle.plugin)
implementation(libs.javapoet) // https://github.com/google/dagger/issues/3282
implementation(libs.kotlin.gradle.plugin) // https://issuetracker.google.com/issues/176079157#comment14
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) // https://github.com/gradle/gradle/issues/15383
}
19 changes: 19 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Software Name: Orange Design System
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
66 changes: 0 additions & 66 deletions buildSrc/src/main/kotlin/com/orange/ods/gradle/Dependencies.kt

This file was deleted.

51 changes: 0 additions & 51 deletions buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt

This file was deleted.

8 changes: 5 additions & 3 deletions buildSrc/src/main/kotlin/library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
*/

import com.orange.ods.gradle.MavenCentralPublishPluginExtension
import com.orange.ods.gradle.Versions
import org.gradle.accessors.dm.LibrariesForLibs

private val libs = the<LibrariesForLibs>() // https://github.com/gradle/gradle/issues/15383

plugins {
id("com.android.library")
Expand All @@ -20,10 +22,10 @@ plugins {
}

android {
compileSdk = Versions.compileSdk
compileSdk = libs.versions.androidCompileSdk.get().toInt()

defaultConfig {
minSdk = Versions.minSdk
minSdk = libs.versions.androidMinSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFile("consumer-rules.pro")
}
Expand Down
12 changes: 5 additions & 7 deletions composable-processor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@
* Software description: Android library of reusable graphical components
*/

import com.orange.ods.gradle.Dependencies

plugins {
kotlin("jvm")
id("com.google.devtools.ksp") version "2.0.0-1.0.22"
id(libs.plugins.kotlin.jvm.get().pluginId) // https://github.com/gradle/gradle/issues/20084#issuecomment-1060822638
alias(libs.plugins.ksp)
}

sourceSets.main {
java.srcDirs("src/main/kotlin")
}

dependencies {
implementation(Dependencies.ksp)
implementation(Dependencies.kotlinPoet)
implementation(Dependencies.kotlinPoetKsp)
implementation(libs.kotlinpoet)
implementation(libs.kotlinpoet.ksp)
implementation(libs.ksp)
}
Loading

0 comments on commit 649e984

Please sign in to comment.