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

Migrate to Gradle version catalog #1059

Merged
merged 9 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
8 changes: 7 additions & 1 deletion api-tester/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
}

apply from: "$rootProject.projectDir/base-application.gradle"

android {
Expand All @@ -13,6 +18,7 @@ android {
dependencies {
implementation project(path: ':public')
implementation project(path: ':purchases')
implementation "androidx.annotation:annotation:$annotationVersion"
implementation project(path: ':feature:amazon')

implementation libs.androidx.annotation
}
4 changes: 0 additions & 4 deletions base-application.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
vegaro marked this conversation as resolved.
Show resolved Hide resolved

android {
compileSdkVersion compileVersion
buildToolsVersion buildToolsVersion
Expand Down
45 changes: 13 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
buildscript {
ext.kotlinVersion = "1.6.21"
ext.compileVersion = 33
ext.buildToolsVersion = "33.0.2"
ext.minVersion = 14
ext.billingVersion = "5.1.0"
ext.lifecycleVersion = "2.5.0"
ext.testLibrariesVersion = "1.4.0"
ext.testJUnitVersion = "1.1.3"
ext.robolectricVersion = "4.10.3"
ext.mockkVersion = "1.12.8"
ext.assertJVersion = "3.22.0"
ext.annotationVersion = "1.3.0"
ext.androidxCoreVersion = "1.8.0"
ext.mockwebserverVersion = "4.2.0"
ext.tinkVersion = "1.8.0"
ext.detektVersion = "1.23.0"
ext.coroutinesVersion = "1.6.4"

repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.vanniktech:gradle-maven-publish-plugin:0.22.0"
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
classpath "org.jetbrains.kotlinx:kover-gradle-plugin:0.7.0"
}
}

plugins {
id "io.gitlab.arturbosch.detekt" version "$detektVersion"
id "com.savvasdalkitsis.module-dependency-graph" version "0.9"
alias libs.plugins.mavenPublish apply false
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now we are adding both the application and library plugins here and applying them on the respective modules each. Is it necessary to specify both here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Think this is the equivalent of adding the AGP plugin. Removing either plugin gives the same error as removing the parcelize (The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.). Removing application gives the issue in the apps, I am getting it in api-tester, and removing the library one gives it in common.

I think these plugins need to be applied both in the base and in the module's build.gradle. I guess it makes sense for the android plugins, because at the end of the day the need to build an android project, and this is the build.gradle of the project, but I am still not sure about the parcelize one.

alias libs.plugins.kotlin.android apply false
alias libs.plugins.dokka
alias libs.plugins.kover apply false
alias libs.plugins.detekt
alias libs.plugins.dependencyGraph
// Removing from here gives an error
// The request for this plugin could not be satisfied because the plugin is already on the classpath with an
// unknown version, so compatibility cannot be checked.
alias libs.plugins.kotlin.parcelize apply false
}

dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion"
detektPlugins libs.detekt.formatting
}

allprojects {
Expand Down Expand Up @@ -85,8 +68,6 @@ task detektAllBaseline(type: io.gitlab.arturbosch.detekt.DetektCreateBaselineTas
exclude("**/test/**/*.kt")
}

apply plugin: 'org.jetbrains.dokka'
tonidero marked this conversation as resolved.
Show resolved Hide resolved

tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(file("docs/" + project.property("VERSION_NAME")))
includes.from("README.md")
Expand Down
27 changes: 15 additions & 12 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
plugins {
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
alias libs.plugins.mavenPublish
}

apply from: "$rootProject.projectDir/library.gradle"

android {
namespace 'com.revenuecat.purchases.common'

Expand All @@ -24,17 +31,13 @@ dependencies {
implementation project(":public")
implementation project(":utils")
implementation project(":strings")
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation "com.google.crypto.tink:tink-android:$tinkVersion"
implementation "com.android.billingclient:billing:$billingVersion"

implementation libs.kotlin.stdlib
tonidero marked this conversation as resolved.
Show resolved Hide resolved
implementation libs.androidx.core
implementation libs.tink
implementation libs.billing

testImplementation project(":test-utils")
testImplementation "androidx.test:core:$testLibrariesVersion"
testImplementation "androidx.test:runner:$testLibrariesVersion"
testImplementation "androidx.test:rules:$testLibrariesVersion"
testImplementation "androidx.test.ext:junit:$testJUnitVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserverVersion"
testImplementation libs.bundles.test
testImplementation libs.okhttp.mockwebserver
}
26 changes: 13 additions & 13 deletions examples/MagicWeather/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
}

android {
Expand Down Expand Up @@ -52,15 +52,15 @@ android {
}

dependencies {
implementation "com.revenuecat.purchases:purchases:$purchasesVersion"
implementation "com.revenuecat.purchases:purchases-store-amazon:$purchasesVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation libs.revenuecat
implementation libs.revenuecat.amazon
implementation libs.kotlin.stdlib
implementation libs.androidx.core
implementation libs.androidx.appcompat
implementation libs.material
implementation libs.androidx.constraintlayout
implementation libs.androidx.lifecycle.livedata
implementation libs.androidx.lifecycle.viewmodel
implementation libs.androidx.navigation.fragment
implementation libs.androidx.navigation.ui
}
20 changes: 5 additions & 15 deletions examples/MagicWeather/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.compileVersion = 31
ext.kotlinVersion = "1.6.21"
ext.purchasesVersion = "6.1.1"
ext.lifecycleVersion = "2.5.0"
ext.androidxCoreVersion = "1.8.0"
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
ext.compileVersion = 33
}

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
plugins {
alias libs.plugins.android.application apply false
alias libs.plugins.kotlin.android apply false
}

allprojects {
Expand Down
27 changes: 27 additions & 0 deletions examples/MagicWeather/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[versions]
agp = "8.0.0"
vegaro marked this conversation as resolved.
Show resolved Hide resolved
androidxNavigation = "2.5.3"
kotlin = "1.6.21"
purchases = "6.1.1"
vegaro marked this conversation as resolved.
Show resolved Hide resolved
lifecycle = "2.5.0"
androidxCore = "1.8.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

[libraries]
androidx-appcompat = "androidx.appcompat:appcompat:1.2.0"
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.0.4"
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidxCore" }
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "androidxNavigation" }
androidx-navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "androidxNavigation" }

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }

material = "com.google.android.material:material:1.3.0"

revenuecat = { module = "com.revenuecat.purchases:purchases", version.ref = "purchases" }
revenuecat-amazon = { module = "com.revenuecat.purchases:purchases-store-amazon", version.ref = "purchases" }
8 changes: 8 additions & 0 deletions examples/MagicWeather/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
}

include ':app'
rootProject.name = "MagicWeatherKotlin"
33 changes: 13 additions & 20 deletions examples/purchase-tester/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
apply from: "$rootProject.projectDir/base-application.gradle"

apply plugin: 'androidx.navigation.safeargs.kotlin'

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3'
}
plugins {
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
alias libs.plugins.androidx.navigation.safeargs
}

apply from: "$rootProject.projectDir/base-application.gradle"

android {
buildFeatures {
Expand Down Expand Up @@ -63,13 +56,13 @@ repositories {
dependencies {
implementation project(path: ':purchases')
implementation project(path: ':feature:amazon')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.material:material:1.6.0'
implementation "androidx.datastore:datastore-preferences:1.0.0"

implementation "androidx.navigation:navigation-fragment-ktx:2.5.3"
implementation "androidx.navigation:navigation-ui-ktx:2.5.3"
implementation libs.kotlin.stdlib
implementation libs.androidx.appcompat
implementation libs.androidx.constraintlayout
implementation libs.androidx.recyclerview
implementation libs.material
implementation libs.androidx.datastore.preferences
implementation libs.androidx.navigation.fragment
implementation libs.androidx.navigation.ui
}
28 changes: 13 additions & 15 deletions feature/amazon/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
plugins {
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
alias libs.plugins.kotlin.parcelize
alias libs.plugins.mavenPublish
}

apply from: "$rootProject.projectDir/library.gradle"

android {
namespace 'com.revenuecat.purchases.amazon'
}

ext {
amazonVersion = "3.0.3"
amazon2Version = "2.0.76"
amazon2FileName = "in-app-purchasing-${amazon2Version}.jar"
}
Expand All @@ -15,22 +22,13 @@ dependencies {
implementation project(":strings")
implementation project(":utils")

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "androidx.annotation:annotation:$annotationVersion"

implementation "com.amazon.device:amazon-appstore-sdk:$amazonVersion"
implementation libs.kotlin.stdlib
implementation libs.androidx.annotation
implementation libs.amazon.appstore.sdk

testImplementation "com.amazon.device:amazon-appstore-sdk:$amazonVersion"
testImplementation project(":test-utils")
testImplementation "androidx.test:core:$testLibrariesVersion"
testImplementation "androidx.test:core-ktx:$testLibrariesVersion"
testImplementation "androidx.test:runner:$testLibrariesVersion"
testImplementation "androidx.test:rules:$testLibrariesVersion"
testImplementation "androidx.test.ext:junit:$testJUnitVersion"
testImplementation "androidx.test.ext:junit-ktx:$testJUnitVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
testImplementation libs.amazon.appstore.sdk
testImplementation libs.bundles.test
}

// Not running with this flag causes verification issues due to the way the Amazon jar is compiled
Expand Down
27 changes: 13 additions & 14 deletions feature/google/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
plugins {
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
alias libs.plugins.mavenPublish
}

apply from: "$rootProject.projectDir/library.gradle"

android {
namespace 'com.revenuecat.purchases.google'
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])

implementation project(":common")
implementation project(":public")
implementation project(":strings")
implementation project(":utils")

implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "com.android.billingclient:billing:$billingVersion"
implementation libs.playServices.ads.identifier
implementation libs.androidx.core
implementation libs.kotlin.stdlib
implementation libs.billing

testImplementation project(":test-utils")
testImplementation "androidx.test:core:$testLibrariesVersion"
testImplementation "androidx.test:runner:$testLibrariesVersion"
testImplementation "androidx.test:rules:$testLibrariesVersion"
testImplementation "androidx.test.ext:junit:$testJUnitVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
testImplementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'

testImplementation libs.bundles.test
testImplementation libs.playServices.ads.identifier
}
21 changes: 12 additions & 9 deletions feature/identity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
plugins {
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
alias libs.plugins.mavenPublish
}

apply from: "$rootProject.projectDir/library.gradle"

android {
namespace 'com.revenuecat.purchases.identity'
}
Expand All @@ -10,13 +17,9 @@ dependencies {
implementation project(":public")
implementation project(":strings")
implementation project(":feature:subscriber-attributes")
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
testImplementation "androidx.test:core:$testLibrariesVersion"
testImplementation "androidx.test:runner:$testLibrariesVersion"
testImplementation "androidx.test:rules:$testLibrariesVersion"
testImplementation "androidx.test.ext:junit:$testJUnitVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"

implementation libs.kotlin.stdlib
implementation libs.androidx.core

testImplementation libs.bundles.test
}
Loading