From b0b9a3c8950f7703801eb653d268a74c14c38049 Mon Sep 17 00:00:00 2001 From: Sergey Sozinov <103035673+sergeysozinov@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:06:33 +0300 Subject: [PATCH] MBX-3117: Upgrade gradle to 8.7 --- build.gradle | 3 --- example/app/build.gradle | 10 +++++++--- example/build.gradle | 6 +++--- example/gradle/wrapper/gradle-wrapper.properties | 2 +- gradle.properties | 3 ++- gradle/libs.versions.toml | 16 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- mindbox-firebase/build.gradle | 6 ++++++ mindbox-firebase/src/main/AndroidManifest.xml | 3 +-- mindbox-huawei/build.gradle | 6 ++++++ mindbox-huawei/src/main/AndroidManifest.xml | 3 +-- modulesCommon.gradle | 14 ++++++-------- sdk/build.gradle | 11 +++++++++-- sdk/src/main/AndroidManifest.xml | 3 +-- .../monitoring/data/room/MonitoringDatabase.kt | 6 +++--- .../mobile_sdk/repository/MindboxDatabase.kt | 4 ++-- settings.gradle | 1 - 17 files changed, 57 insertions(+), 42 deletions(-) diff --git a/build.gradle b/build.gradle index 5b83a14c..79050b6b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() @@ -8,8 +7,6 @@ buildscript { } dependencies { classpath libs.bundles.buildscript.plugins - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/example/app/build.gradle b/example/app/build.gradle index b8ab0492..4c14b101 100644 --- a/example/app/build.gradle +++ b/example/app/build.gradle @@ -15,14 +15,15 @@ android { targetSdk 34 versionCode 1 versionName "1.0" + multiDexEnabled true } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } viewBinding { enabled = true @@ -63,4 +64,7 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.15.1' implementation 'androidx.activity:activity-ktx:1.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1' + + // Multidex + implementation "androidx.multidex:multidex:2.0.1" } diff --git a/example/build.gradle b/example/build.gradle index 72ae08ee..4eb2fec8 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -3,8 +3,8 @@ buildscript { maven { url 'https://developer.huawei.com/repo/' } } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30' + classpath 'com.android.tools.build:gradle:8.6.0' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22' classpath 'com.google.gms:google-services:4.4.0' classpath 'com.huawei.agconnect:agcp:1.9.1.300' } @@ -12,7 +12,7 @@ buildscript { plugins { - id 'com.android.application' version '8.2.1' apply false + id 'com.android.application' version '8.6.0' apply false id 'org.jetbrains.kotlin.android' version '1.9.22' apply false id 'com.google.gms.google-services' version '4.4.0' apply false } \ No newline at end of file diff --git a/example/gradle/wrapper/gradle-wrapper.properties b/example/gradle/wrapper/gradle-wrapper.properties index 98a5c9bc..659d321a 100644 --- a/example/gradle/wrapper/gradle-wrapper.properties +++ b/example/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Jan 19 10:44:26 MSK 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradle.properties b/gradle.properties index f5a415db..148fb388 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,5 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official # SDK version property -SDK_VERSION_NAME=2.11.1 \ No newline at end of file +SDK_VERSION_NAME=2.11.1 +android.nonTransitiveRClass = false \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 88a2e45a..c2a17100 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,9 +6,9 @@ target_sdk = "34" firebase_bom = "32.7.2" hms_push = "6.11.0.300" -room = "2.5.1" -kotlin = "1.8.21" -gradle_plugin = "7.4.2" +room = "2.6.1" +kotlin = "1.9.22" +gradle_plugin = "8.6.0" gms_play_services_basement = "18.1.0" gms_play_services_base = "18.0.1" gms_play_services_ads_identifier = "18.0.1" @@ -34,17 +34,17 @@ test_core = "1.5.0" turbine = "0.12.1" agcp = "1.6.0.300" -maven_plugin = "2.1" ktlint-plugin = "12.1.1" +ksp = "1.9.22-1.0.17" [bundles] buildscript-plugins = [ "android_tools_build_gradle", "kotlin_gradle_plugin", "google_services", - "maven_plugin", "agcp", - "ktlint_gradle_plugin" + "ktlint_gradle_plugin", + "ksp_gradle_plugin" ] test = [ @@ -103,6 +103,6 @@ kotlinx_coroutines_test = { group = "org.jetbrains.kotlinx", name = "kotlinx-cor android_tools_build_gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle_plugin" } kotlin_gradle_plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } google_services = { module = "com.google.gms:google-services", version.ref = "google_services" } -maven_plugin = { module = "com.github.dcendents:android-maven-gradle-plugin", version.ref = "maven_plugin" } agcp = { module = "com.huawei.agconnect:agcp", version.ref = "agcp" } -ktlint_gradle_plugin = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint-plugin" } \ No newline at end of file +ktlint_gradle_plugin = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint-plugin" } +ksp_gradle_plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ab0eee29..4a3ac66b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Nov 07 16:21:11 YEKT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/mindbox-firebase/build.gradle b/mindbox-firebase/build.gradle index 07825987..0be73ef2 100644 --- a/mindbox-firebase/build.gradle +++ b/mindbox-firebase/build.gradle @@ -1,6 +1,12 @@ apply from: "../modulesCommon.gradle" android { + namespace 'cloud.mindbox.mindbox_firebase' + + buildFeatures { + buildConfig = true + } + defaultConfig { consumerProguardFiles "consumer-rules.pro", "${rootProject.projectDir}/proguard/proguard-gson.pro", diff --git a/mindbox-firebase/src/main/AndroidManifest.xml b/mindbox-firebase/src/main/AndroidManifest.xml index e98acad4..69fc4129 100644 --- a/mindbox-firebase/src/main/AndroidManifest.xml +++ b/mindbox-firebase/src/main/AndroidManifest.xml @@ -1,4 +1,3 @@ - - + \ No newline at end of file diff --git a/mindbox-huawei/build.gradle b/mindbox-huawei/build.gradle index 2c6d78f2..1b003efb 100644 --- a/mindbox-huawei/build.gradle +++ b/mindbox-huawei/build.gradle @@ -1,6 +1,12 @@ apply from: "../modulesCommon.gradle" android { + namespace 'cloud.mindbox.mindbox_hms' + + buildFeatures { + buildConfig = true + } + defaultConfig { consumerProguardFiles "consumer-rules.pro", "${rootProject.projectDir}/proguard/proguard-gson.pro", diff --git a/mindbox-huawei/src/main/AndroidManifest.xml b/mindbox-huawei/src/main/AndroidManifest.xml index f201f7f9..69fc4129 100644 --- a/mindbox-huawei/src/main/AndroidManifest.xml +++ b/mindbox-huawei/src/main/AndroidManifest.xml @@ -1,4 +1,3 @@ - - + \ No newline at end of file diff --git a/modulesCommon.gradle b/modulesCommon.gradle index 3866c64f..da3099e5 100644 --- a/modulesCommon.gradle +++ b/modulesCommon.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' apply plugin: 'signing' apply plugin: 'maven-publish' apply plugin: 'org.jlleitschuh.gradle.ktlint' @@ -35,7 +34,6 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -44,20 +42,18 @@ android { jvmTarget = '1.8' } - task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs + publishing { + singleVariant("release") { + withSourcesJar() + } } - } afterEvaluate { - apply plugin: 'maven-publish' publishing { publications { release(MavenPublication) { from components.release - artifact androidSourcesJar groupId = 'cloud.mindbox' artifactId = ARTIFACT_ID version = SDK_VERSION_NAME @@ -71,6 +67,7 @@ afterEvaluate { url = 'https://github.com/mindbox-cloud/android-sdk/blob/master/LICENSE.md' } } + developers { developer { id = 'Mindbox' @@ -78,6 +75,7 @@ afterEvaluate { email = 'android-sdk@mindbox.ru' } } + scm { connection = 'scm:https://github.com/mindbox-cloud/android-sdk.git' developerConnection = 'scm:git://github.com/mindbox-cloud/android-sdk.git' diff --git a/sdk/build.gradle b/sdk/build.gradle index dac0207c..47c8ab13 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -1,5 +1,6 @@ apply plugin: "java-platform" apply from: "../modulesCommon.gradle" +apply plugin: 'com.google.devtools.ksp' javaPlatform { @@ -12,6 +13,12 @@ dependencies { } } android { + namespace 'cloud.mindbox.mobile_sdk' + + buildFeatures { + buildConfig = true + } + defaultConfig { consumerProguardFiles "consumer-rules.pro", "${rootProject.projectDir}/proguard/proguard-gson.pro", @@ -53,7 +60,7 @@ dependencies { // Database implementation libs.room.runtime implementation libs.room.ktx - kapt libs.room.compiler + ksp libs.room.compiler // Work Manager implementation libs.work.manager @@ -64,7 +71,7 @@ dependencies { // Glide implementation libs.glide - kapt libs.glide.compiler + ksp libs.glide.compiler // Test dependencies testImplementation libs.bundles.test diff --git a/sdk/src/main/AndroidManifest.xml b/sdk/src/main/AndroidManifest.xml index 3bff8177..822fd693 100644 --- a/sdk/src/main/AndroidManifest.xml +++ b/sdk/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/sdk/src/main/java/cloud/mindbox/mobile_sdk/monitoring/data/room/MonitoringDatabase.kt b/sdk/src/main/java/cloud/mindbox/mobile_sdk/monitoring/data/room/MonitoringDatabase.kt index de8f975e..627dee37 100644 --- a/sdk/src/main/java/cloud/mindbox/mobile_sdk/monitoring/data/room/MonitoringDatabase.kt +++ b/sdk/src/main/java/cloud/mindbox/mobile_sdk/monitoring/data/room/MonitoringDatabase.kt @@ -12,9 +12,9 @@ internal abstract class MonitoringDatabase : RoomDatabase() { companion object { val MIGRATION_1_2 = object : Migration(1, 2) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("DELETE FROM monitoring") - database.execSQL("ALTER TABLE monitoring RENAME TO mb_monitoring") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("DELETE FROM monitoring") + db.execSQL("ALTER TABLE monitoring RENAME TO mb_monitoring") } } } diff --git a/sdk/src/main/java/cloud/mindbox/mobile_sdk/repository/MindboxDatabase.kt b/sdk/src/main/java/cloud/mindbox/mobile_sdk/repository/MindboxDatabase.kt index b385ec67..8a3214a1 100644 --- a/sdk/src/main/java/cloud/mindbox/mobile_sdk/repository/MindboxDatabase.kt +++ b/sdk/src/main/java/cloud/mindbox/mobile_sdk/repository/MindboxDatabase.kt @@ -24,10 +24,10 @@ internal abstract class MindboxDatabase : RoomDatabase() { private val MIGRATION_1_2 = object : Migration(1, 2) { - override fun migrate(database: SupportSQLiteDatabase) { + override fun migrate(db: SupportSQLiteDatabase) { val query = "ALTER TABLE $CONFIGURATION_TABLE_NAME " + "ADD COLUMN shouldCreateCustomer INTEGER NOT NULL DEFAULT 1" - database.execSQL(query) + db.execSQL(query) } } diff --git a/settings.gradle b/settings.gradle index a25f4e80..4a4448d5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,4 @@ include ':sdk' include ':mindbox-huawei' include ':mindbox-firebase' -include ':app' rootProject.name = "AndroidSdk"