diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 6164d6939..82ca5c423 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: - java-version: 11 + distribution: 'corretto' + java-version: 17 + cache: 'gradle' - name: Build run: ./gradlew compileDebugAndroidTestSources check assemble ktlintCheck diff --git a/app/build.gradle b/app/build.gradle index 675b1dd01..4dd636989 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 = { -> @@ -14,12 +14,12 @@ def gitDescribe = { -> } android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + namespace 'com.stevesoltys.seedvault' + 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' @@ -31,7 +31,7 @@ android { } } - lintOptions { + lint { disable "DialogFragmentCallbacksDetector", "InvalidFragmentVersionForActivityResult", "CheckedExceptions" @@ -43,7 +43,7 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - languageVersion = "1.6" + languageVersion = "1.7" } testOptions { unitTests.all { diff --git a/app/src/androidTest/AndroidManifest.xml b/app/src/androidTest/AndroidManifest.xml index 7a6ca1e5c..7770cfb2a 100644 --- a/app/src/androidTest/AndroidManifest.xml +++ b/app/src/androidTest/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/build.gradle b/build.gradle index 6c90483f1..2a1fe90fe 100644 --- a/build.gradle +++ b/build.gradle @@ -2,40 +2,31 @@ 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() - 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.2.2' - } +plugins { + 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 + id 'org.jlleitschuh.gradle.ktlint' version '11.5.0' apply false } ext { - buildToolsVersion = '33.0.0' - compileSdkVersion = 33 - minSdkVersion = 32 - targetSdkVersion = 33 + compileSdk = 33 + minSdk = 32 + targetSdk = 33 } 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 85bf9bbb8..a3d885a23 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -3,17 +3,19 @@ * 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 - buildToolsVersion rootProject.ext.buildToolsVersion + namespace 'org.calyxos.backup.contacts' + 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/contactsbackup/src/androidTest/AndroidManifest.xml b/contactsbackup/src/androidTest/AndroidManifest.xml index 89634bebc..0443922bd 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 --> - + diff --git a/gradle.properties b/gradle.properties index 38138b6aa..c6adc6daf 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/dependencies.gradle b/gradle/dependencies.gradle index 29a1f0aae..cb1f6a1e0 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' } }, ] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6b46f3284..457baeb2e 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-8.2.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 +distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1 diff --git a/settings.gradle b/settings.gradle index 87893e088..ae9955661 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,20 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} +rootProject.name = 'Seedvault' 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 d8572d93b..ead579ac3 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -6,18 +6,18 @@ 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 { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + namespace 'de.grobox.storagebackuptester' + 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" @@ -37,17 +37,24 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" + 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/Android.bp b/storage/lib/Android.bp index aa1d6750e..227fecfb4 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 33adddc7c..861ca2ab8 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -6,19 +6,19 @@ 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 { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + namespace 'org.calyxos.backup.storage' + 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' @@ -38,13 +38,19 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() - languageVersion = "1.6" - freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn' + languageVersion = "1.7" + freeCompilerArgs += '-opt-in=kotlin.RequiresOptIn' freeCompilerArgs += '-Xexplicit-api=strict' } 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 -> @@ -56,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 689bda548..a310d6633 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