From 591e9dbc689f3f61f1959a5546dadb5b25ea2809 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 13:12:56 +0530 Subject: [PATCH 01/14] Bump kotlin to 1.7.20 based on Android 13 QPR2 release Signed-off-by: Aayush Gupta --- app/build.gradle | 2 +- build.gradle | 7 ++++--- storage/lib/build.gradle | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 675b1dd0..dbcd1ed1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - languageVersion = "1.6" + languageVersion = "1.7" } testOptions { unitTests.all { diff --git a/build.gradle b/build.gradle index 6c90483f..0bfb4e7a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,11 @@ buildscript { // 1.3.61 Android 11 // 1.4.30 Android 12 // 1.6.10 Android 13 + // 1.7.20 Android 13 (QPR2) // Check: - // https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-13.0.0_r3/build.txt - ext.aosp_kotlin_version = '1.6.10' // 1.6.10-release-923 in AOSP - ext.kotlin_version = '1.6.10' + // https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-13.0.0_r32/build.txt + ext.aosp_kotlin_version = '1.7.20' // 1.7.20-release-201 in AOSP + ext.kotlin_version = '1.7.20' repositories { mavenCentral() diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 33adddc7..3b69f1ea 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -38,7 +38,7 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - languageVersion = "1.6" + languageVersion = "1.7" freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn' freeCompilerArgs += '-Xexplicit-api=strict' } From b7c1459aca3b4ad243966dcdb1a452a73ec8d9a6 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 13:16:49 +0530 Subject: [PATCH 02/14] Bump to latest stable AGP and Gradle versions Signed-off-by: Aayush Gupta --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 0bfb4e7a..f8d361ff 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ buildscript { //noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17" - classpath 'com.android.tools.build:gradle:7.2.2' + classpath 'com.android.tools.build:gradle:7.4.2' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6b46f328..f94e57ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Fri Aug 19 10:56:09 IST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 +distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 From 1943595f11a1feb02b2bba725931f2e7901e22a5 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 13:45:48 +0530 Subject: [PATCH 03/14] Migrate to new plugins and dependency management system * Ensure every plugin is present in project's plugin block with version * Switch to full plugin id for jetbrains plugins * Move plugin and dependency repos to settings Signed-off-by: Aayush Gupta --- app/build.gradle | 6 +++--- build.gradle | 27 +++++++++------------------ contactsbackup/build.gradle | 6 ++++-- settings.gradle | 17 ++++++++++++++++- storage/demo/build.gradle | 4 ++-- storage/lib/build.gradle | 8 ++++---- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dbcd1ed1..54930f6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ plugins { - id "com.android.application" - id "kotlin-android" - id "org.jlleitschuh.gradle.ktlint" version "10.2.0" + id 'com.android.application' + id 'org.jetbrains.kotlin.android' + id 'org.jlleitschuh.gradle.ktlint' } def gitDescribe = { -> diff --git a/build.gradle b/build.gradle index f8d361ff..acad618b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,17 +7,16 @@ buildscript { // https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-13.0.0_r32/build.txt ext.aosp_kotlin_version = '1.7.20' // 1.7.20-release-201 in AOSP ext.kotlin_version = '1.7.20' +} - repositories { - mavenCentral() - google() - } - dependencies { - //noinspection DifferentKotlinGradleVersion - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17" - classpath 'com.android.tools.build:gradle:7.4.2' - } +plugins { + id 'com.android.application' version '7.4.2' apply false + id 'com.android.library' version '7.4.2' apply false + id 'com.google.protobuf' version '0.8.17' apply false + id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false + id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" apply false + id 'org.jetbrains.dokka' version "$kotlin_version" apply false + id 'org.jlleitschuh.gradle.ktlint' version '10.2.0' apply false } ext { @@ -29,14 +28,6 @@ ext { apply from: 'gradle/dependencies.gradle' -allprojects { - repositories { - mavenCentral() - google() - maven { url 'https://jitpack.io' } - } -} - task clean(type: Delete) { delete rootProject.buildDir } diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index 85bf9bbb..8675a947 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -3,8 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} android { compileSdkVersion rootProject.ext.compileSdkVersion diff --git a/settings.gradle b/settings.gradle index 87893e08..a7a9214d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,19 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} include ':app' include ':contactsbackup' include ':storage:lib' -include ':storage:demo' \ No newline at end of file +include ':storage:demo' diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index d8572d93..4fcee90e 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -6,8 +6,8 @@ plugins { id 'com.android.application' id 'com.google.protobuf' - id 'kotlin-android' - id 'kotlin-kapt' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.kapt' } android { diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 3b69f1ea..2e16e9ff 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -6,10 +6,10 @@ plugins { id 'com.android.library' id 'com.google.protobuf' - id 'kotlin-android' - id 'kotlin-kapt' - id "org.jlleitschuh.gradle.ktlint" version "10.2.0" - id 'org.jetbrains.dokka' version "$kotlin_version" + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.kapt' + id 'org.jetbrains.dokka' + id 'org.jlleitschuh.gradle.ktlint' } android { From 1d9cb146f83e3778f0cdf3ee0dca9c2b10dd8f8c Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 13:52:32 +0530 Subject: [PATCH 04/14] Set root project's name to Seedvault Signed-off-by: Aayush Gupta --- settings.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle b/settings.gradle index a7a9214d..ae995566 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,6 +13,7 @@ dependencyResolutionManagement { maven { url 'https://jitpack.io' } } } +rootProject.name = 'Seedvault' include ':app' include ':contactsbackup' include ':storage:lib' From 845709246f81ef6c5a0d8612bd82c840926f3cf4 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 14:24:24 +0530 Subject: [PATCH 05/14] Bump dependencies to Android 13 QPR2 release Signed-off-by: Aayush Gupta --- gradle/dependencies.gradle | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 29a1f0aa..cb1f6a1e 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -1,7 +1,7 @@ ext { // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#3901 - ext.room_version = "2.4.0-alpha05" - // https://android.googlesource.com/platform/external/protobuf/+/refs/tags/android-13.0.0_r3/java/pom.xml#7 + ext.room_version = "2.4.0-alpha05" // 2.5.0-alpha01 in AOSP but needs testing + // https://android.googlesource.com/platform/external/protobuf/+/refs/tags/android-13.0.0_r32/java/pom.xml#7 ext.protobuf_version = "3.9.1" // test dependencies below - these do not care about AOSP and can be freely updated @@ -39,58 +39,58 @@ ext.kotlin_libs = [ ], coroutines: [ dependencies.create('org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm') { - // https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-13.0.0_r3/CHANGES.md - version { strictly '1.5.2' } + // https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-13.0.0_r32/CHANGES.md + version { strictly '1.6.4' } }, dependencies.create('org.jetbrains.kotlinx:kotlinx-coroutines-android') { - // https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-13.0.0_r3/CHANGES.md - version { strictly '1.5.2' } + // https://android.googlesource.com/platform/external/kotlinx.coroutines/+/refs/tags/android-13.0.0_r32/CHANGES.md + version { strictly '1.6.4' } }, ], ] ext.std_libs = [ androidx_core: [ - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#1761 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#2275 dependencies.create('androidx.core:core') { - version { strictly '1.9.0-alpha03' } + version { strictly '1.9.0-alpha05' } // 1.9.0-alpha03 in AOSP but has SDK version issues }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#1727 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#2241 dependencies.create('androidx.core:core-ktx') { - version { strictly '1.9.0-alpha03' } + version { strictly '1.9.0-alpha05' } // 1.9.0-alpha03 in AOSP but has SDK version issues }, ], - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#2159 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#2705 androidx_fragment: dependencies.create('androidx.fragment:fragment-ktx') { - version { strictly '1.4.0-alpha09' } + version { strictly '1.5.0-alpha03' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#57 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#61 androidx_activity: dependencies.create('androidx.activity:activity-ktx') { - version { strictly '1.4.0-alpha02' } + version { strictly '1.5.0-alpha03' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#3597 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#4275 androidx_preference: dependencies.create('androidx.preference:preference') { version { strictly '1.2.0-alpha01' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#2754 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#3376 androidx_lifecycle_viewmodel_ktx: dependencies.create('androidx.lifecycle:lifecycle-viewmodel-ktx') { - version { strictly '2.4.0-alpha03' } // 2.4.0-alpha04 in AOSP but was never released + version { strictly '2.5.0-alpha03' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#2550 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#3134 androidx_lifecycle_livedata_ktx: dependencies.create('androidx.lifecycle:lifecycle-livedata-ktx') { - version { strictly '2.4.0-alpha03' } // 2.4.0-alpha04 in AOSP but was never released + version { strictly '2.5.0-alpha03' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/extras/constraint-layout-x/Android.bp#39 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/extras/constraint-layout-x/Android.bp#64 androidx_constraintlayout: dependencies.create('androidx.constraintlayout:constraintlayout') { - version { strictly '2.0.0-beta7' } + version { strictly '2.2.0-alpha05' } }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/androidx/Android.bp#1865 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/androidx/Android.bp#2411 androidx_documentfile: dependencies.create('androidx.documentfile:documentfile') { version { strictly '1.1.0-alpha01' } // 1.1.0-alpha02 in AOSP but not released yet }, - // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r3/current/extras/material-design-x/Android.bp#6 + // https://android.googlesource.com/platform/prebuilts/sdk/+/refs/tags/android-13.0.0_r32/current/extras/material-design-x/Android.bp#6 com_google_android_material: dependencies.create('com.google.android.material:material') { - version { strictly '1.6.0-alpha03' } // 1.6.0-alpha0301 in AOSP + version { strictly '1.7.0-alpha03' } }, ] From efee38ae39593c918393ae7a26a8ee5ce6ff91fe Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 18:39:21 +0530 Subject: [PATCH 06/14] Bump ktlint Gradle plugin to 11.3.1 Signed-off-by: Aayush Gupta --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index acad618b..578cddfb 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ plugins { id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" apply false id 'org.jetbrains.dokka' version "$kotlin_version" apply false - id 'org.jlleitschuh.gradle.ktlint' version '10.2.0' apply false + id 'org.jlleitschuh.gradle.ktlint' version '11.5.0' apply false } ext { From d5320918dccec56fe02ba11010648fdb25bc9ec2 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 15:50:03 +0530 Subject: [PATCH 07/14] Switch from -Xopt-in to -opt-in w: Argument -Xopt-in is deprecated. Please use -opt-in instead w: C:\Users\aayus\StudioProjects\seedvault\storage\demo\src\main\java\de\grobox\storagebackuptester\restore\DemoSnapshotFragment.kt: (34, 31): 'onBackPressed(): Unit' is deprecated. Overrides deprecated member in 'androidx.core.app.ComponentActivity'. Deprecated in Java w: Argument -Xopt-in is deprecated. Please use -opt-in instead w: C:\Users\aayus\StudioProjects\seedvault\storage\lib\src\main\java\org\calyxos\backup\storage\backup\BackupService.kt: (35, 9): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API. w: C:\Users\aayus\StudioProjects\seedvault\storage\lib\src\main\java\org\calyxos\backup\storage\restore\RestoreService.kt: (49, 9): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API. Signed-off-by: Aayush Gupta --- storage/demo/build.gradle | 2 +- storage/lib/Android.bp | 2 +- storage/lib/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index 4fcee90e..ef3625b7 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -37,7 +37,7 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" + freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } lintOptions { disable "DialogFragmentCallbacksDetector", diff --git a/storage/lib/Android.bp b/storage/lib/Android.bp index aa1d6750..227fecfb 100644 --- a/storage/lib/Android.bp +++ b/storage/lib/Android.bp @@ -40,7 +40,7 @@ android_library { enabled: false, }, kotlincflags: [ - "-Xopt-in=kotlin.RequiresOptIn", + "-opt-in=kotlin.RequiresOptIn", ], } diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 2e16e9ff..2b8db4d3 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -39,7 +39,7 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() languageVersion = "1.7" - freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn' + freeCompilerArgs += '-opt-in=kotlin.RequiresOptIn' freeCompilerArgs += '-Xexplicit-api=strict' } protobuf { From 64ecd5c061e0c034df654896ab75d761653b5fa6 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 2 Aug 2023 23:39:04 +0800 Subject: [PATCH 08/14] Drop buildToolsVersion If you're using Android plugin for Gradle 3.0.0 or higher, your project automatically uses a default version of the build tools that the plugin specifies Ref: https://developer.android.com/tools/releases/build-tools Signed-off-by: Aayush Gupta --- app/build.gradle | 1 - build.gradle | 1 - contactsbackup/build.gradle | 1 - storage/demo/build.gradle | 1 - storage/lib/build.gradle | 1 - 5 files changed, 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 54930f6c..dc8f2f55 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,7 +15,6 @@ def gitDescribe = { -> android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion 32 // leave at 32 for robolectric tests diff --git a/build.gradle b/build.gradle index 578cddfb..96e9d4ff 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,6 @@ plugins { } ext { - buildToolsVersion = '33.0.0' compileSdkVersion = 33 minSdkVersion = 32 targetSdkVersion = 33 diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index 8675a947..3ee22792 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -10,7 +10,6 @@ plugins { android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "org.calyxos.backup.contacts" diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index ef3625b7..9c983784 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -12,7 +12,6 @@ plugins { android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "de.grobox.storagebackuptester" diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 2b8db4d3..d5b4ca88 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -14,7 +14,6 @@ plugins { android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion From cba065fe5622078ce6a58a38e73016527f88818f Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 2 Aug 2023 23:45:52 +0800 Subject: [PATCH 09/14] Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta --- storage/lib/build.gradle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index d5b4ca88..a4d6e129 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -43,7 +43,13 @@ android { } protobuf { protoc { - artifact = "com.google.protobuf:protoc:$protobuf_version" + if ("aarch64" == System.getProperty("os.arch")) { + // mac m1 + artifact = "com.google.protobuf:protoc:$protobuf_version:osx-x86_64" + } else { + // other + artifact = "com.google.protobuf:protoc:$protobuf_version" + } } generateProtoTasks { all().each { task -> From b330b7baa6c0ebb6e6a702f0d74ffb30b222ec34 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 2 Aug 2023 23:49:20 +0800 Subject: [PATCH 10/14] Switch to new Sdk version properties Signed-off-by: Aayush Gupta --- app/build.gradle | 6 +++--- build.gradle | 6 +++--- contactsbackup/build.gradle | 6 +++--- storage/demo/build.gradle | 6 +++--- storage/lib/build.gradle | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dc8f2f55..c943e8ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,11 +14,11 @@ def gitDescribe = { -> } android { - compileSdkVersion rootProject.ext.compileSdkVersion + compileSdk rootProject.ext.compileSdk defaultConfig { - minSdkVersion 32 // leave at 32 for robolectric tests - targetSdkVersion rootProject.ext.targetSdkVersion + minSdk 32 // leave at 32 for robolectric tests + targetSdk rootProject.ext.targetSdk versionNameSuffix "-$gitDescribe" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments disableAnalytics: 'true' diff --git a/build.gradle b/build.gradle index 96e9d4ff..b25c5dd0 100644 --- a/build.gradle +++ b/build.gradle @@ -20,9 +20,9 @@ plugins { } ext { - compileSdkVersion = 33 - minSdkVersion = 32 - targetSdkVersion = 33 + compileSdk = 33 + minSdk = 32 + targetSdk = 33 } apply from: 'gradle/dependencies.gradle' diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index 3ee22792..f0f1f5e1 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -9,12 +9,12 @@ plugins { } android { - compileSdkVersion rootProject.ext.compileSdkVersion + compileSdk rootProject.ext.compileSdk defaultConfig { applicationId "org.calyxos.backup.contacts" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdk rootProject.ext.minSdk + targetSdk rootProject.ext.targetSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments disableAnalytics: 'true' diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index 9c983784..b42c797a 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -11,12 +11,12 @@ plugins { } android { - compileSdkVersion rootProject.ext.compileSdkVersion + compileSdk rootProject.ext.compileSdk defaultConfig { applicationId "de.grobox.storagebackuptester" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdk rootProject.ext.minSdk + targetSdk rootProject.ext.targetSdk versionCode 20 versionName "0.9.7" diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index a4d6e129..e2f032d5 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -13,11 +13,11 @@ plugins { } android { - compileSdkVersion rootProject.ext.compileSdkVersion + compileSdk rootProject.ext.compileSdk defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdk rootProject.ext.minSdk + targetSdk rootProject.ext.targetSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments disableAnalytics: 'true' From 8b63a0a7f909ce5234fb2035c96262bb8cbb66e7 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 2 Aug 2023 23:52:41 +0800 Subject: [PATCH 11/14] Set appropriate namespace in all modules Required by new AGP versions Signed-off-by: Aayush Gupta --- app/build.gradle | 1 + contactsbackup/build.gradle | 1 + storage/demo/build.gradle | 1 + storage/lib/build.gradle | 1 + 4 files changed, 4 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index c943e8ba..cdba3720 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,6 +14,7 @@ def gitDescribe = { -> } android { + namespace 'com.stevesoltys.seedvault' compileSdk rootProject.ext.compileSdk defaultConfig { diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index f0f1f5e1..a3d885a2 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -9,6 +9,7 @@ plugins { } android { + namespace 'org.calyxos.backup.contacts' compileSdk rootProject.ext.compileSdk defaultConfig { diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index b42c797a..75aa450e 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -11,6 +11,7 @@ plugins { } android { + namespace 'de.grobox.storagebackuptester' compileSdk rootProject.ext.compileSdk defaultConfig { diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index e2f032d5..3df7ed72 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -13,6 +13,7 @@ plugins { } android { + namespace 'org.calyxos.backup.storage' compileSdk rootProject.ext.compileSdk defaultConfig { From 4a3103558516ff17a5d45612fca6bdf56facb694 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 2 Aug 2023 23:57:53 +0800 Subject: [PATCH 12/14] Drop packageName from manifests for tests Tests are Gradle-only and keeping this in manifest results in namespace collision Ref: https://developer.android.com/build/configure-app-module#change-namespace-for-testing Signed-off-by: Aayush Gupta --- app/src/androidTest/AndroidManifest.xml | 3 +-- contactsbackup/src/androidTest/AndroidManifest.xml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/AndroidManifest.xml b/app/src/androidTest/AndroidManifest.xml index 7a6ca1e5..7770cfb2 100644 --- a/app/src/androidTest/AndroidManifest.xml +++ b/app/src/androidTest/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/contactsbackup/src/androidTest/AndroidManifest.xml b/contactsbackup/src/androidTest/AndroidManifest.xml index 89634beb..0443922b 100644 --- a/contactsbackup/src/androidTest/AndroidManifest.xml +++ b/contactsbackup/src/androidTest/AndroidManifest.xml @@ -3,8 +3,7 @@ SPDX-FileCopyrightText: 2020 The Calyx Institute SPDX-License-Identifier: Apache-2.0 --> - + From 6ca1f2792fc1c139777c0739cd089679314d18a7 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Thu, 3 Aug 2023 00:41:27 +0800 Subject: [PATCH 13/14] Bump to AGP and Gradle 8.x Disable new R8 mode and resource namespacing for now to avoid build failures. These needs to be worked on before they can be enabled. Signed-off-by: Aayush Gupta --- .github/workflows/client.yml | 2 +- app/build.gradle | 2 +- build.gradle | 6 +++--- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 4 ++-- storage/demo/build.gradle | 17 ++++++++++++----- storage/lib/build.gradle | 2 +- storage/lib/proguard-rules.pro | 3 +++ 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 6164d693..370d72d3 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -29,7 +29,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Build run: ./gradlew compileDebugAndroidTestSources check assemble ktlintCheck diff --git a/app/build.gradle b/app/build.gradle index cdba3720..4dd63698 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,7 @@ android { } } - lintOptions { + lint { disable "DialogFragmentCallbacksDetector", "InvalidFragmentVersionForActivityResult", "CheckedExceptions" diff --git a/build.gradle b/build.gradle index b25c5dd0..2a1fe90f 100644 --- a/build.gradle +++ b/build.gradle @@ -10,9 +10,9 @@ buildscript { } plugins { - id 'com.android.application' version '7.4.2' apply false - id 'com.android.library' version '7.4.2' apply false - id 'com.google.protobuf' version '0.8.17' apply false + id 'com.android.application' version '8.1.0' apply false + id 'com.android.library' version '8.1.0' apply false + id 'com.google.protobuf' version '0.9.4' apply false id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" apply false id 'org.jetbrains.dokka' version "$kotlin_version" apply false diff --git a/gradle.properties b/gradle.properties index 38138b6a..c6adc6da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,3 +3,5 @@ org.gradle.configureondemand=true android.useAndroidX=true android.enableJetifier=false kotlin.code.style=official +android.nonTransitiveRClass=false +android.enableR8.fullMode=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f94e57ef..457baeb2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Fri Aug 19 10:56:09 IST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 +distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1 diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index 75aa450e..ead579ac 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -39,15 +39,22 @@ android { jvmTarget = JavaVersion.VERSION_11.toString() freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } - lintOptions { + lint { disable "DialogFragmentCallbacksDetector", "InvalidFragmentVersionForActivityResult" } packagingOptions { - exclude 'META-INF/*.kotlin_module' - exclude 'META-INF/androidx.*.version' - exclude 'META-INF/services/kotlin*' - exclude 'kotlin/internal/internal.kotlin_builtins' + jniLibs { + excludes += ['META-INF/services/kotlin*'] + } + resources { + excludes += [ + 'META-INF/*.kotlin_module', + 'META-INF/androidx.*.version', + 'META-INF/services/kotlin*', + 'kotlin/internal/internal.kotlin_builtins' + ] + } } } diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 3df7ed72..861ca2ab 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -62,7 +62,7 @@ android { } } } - lintOptions { + lint { disable "DialogFragmentCallbacksDetector", "InvalidFragmentVersionForActivityResult", "CheckedExceptions" diff --git a/storage/lib/proguard-rules.pro b/storage/lib/proguard-rules.pro index 689bda54..a310d663 100644 --- a/storage/lib/proguard-rules.pro +++ b/storage/lib/proguard-rules.pro @@ -24,3 +24,6 @@ #-renamesourcefileattribute SourceFile -keep class org.calyxos.backup.storage.** {*;} + +# Ignore StringConcatFactory +-dontwarn java.lang.invoke.StringConcatFactory From 63bfb6be5568913e933e7d8a3911926dc963b837 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Thu, 3 Aug 2023 01:09:16 +0800 Subject: [PATCH 14/14] Update possible github actions Signed-off-by: Aayush Gupta --- .github/workflows/client.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 370d72d3..82ca5c42 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -7,29 +7,23 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - - name: Gradle dependency cache - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: ${{ runner.os }}-gradle- + - name: Checkout the code + uses: actions/checkout@v3 - name: Android build cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.android/build-cache key: ${{ runner.os }}-android restore-keys: ${{ runner.os }}-android - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: + distribution: 'corretto' java-version: 17 + cache: 'gradle' - name: Build run: ./gradlew compileDebugAndroidTestSources check assemble ktlintCheck