fix(deps): update android.gradle.plugin to v9 (major) (#6021)
* Update android.gradle.plugin to v9 * Separate extensions between app and library ones `CommonExtension` has been split and its properties are now duplicated in `ApplicationExtension` and `LibraryExtension` without a shared interface, so we now need to duplicate the helper extension functions * Bump Gradle wrapper to `9.3.1` * Remove `kotlin-android` plugin usage: it's no longer needed * Enable `resValues` build feature for the modules that have resources in custom variants like gplay, debug, etc. Otherwise this now fails saying the resources are there but the feature is disabled * Remove `retrofit` dependency from `:features:call:impl` It wasn't in use and the build was failing * Update kotlin to v2.4.0 * Update plugin paparazzi to v2.0.0-alpha05 * Update gradle wrapper to 9.5.1 ./gradlew wrapper --gradle-version 9.5.1 --gradle-distribution-sha256-sum bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f * Update com.android.tools.build:gradle to 9.2.1 * Update plugin sonarqube to v7.3.1.8318 * Kotlin 2.4.0 * Context parameters are enabled by default in Kotlin 2.4.0 * Fix code issue * Fix record screenshot issue * Workaround for https://github.com/cashapp/paparazzi/issues/2342 * Workaround for another issue with Paparazzi * Remove unused import * Update screenshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: Benoit Marty <benoitm@element.io> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
@@ -9,67 +9,111 @@
|
||||
package extension
|
||||
|
||||
import Versions
|
||||
import com.android.build.api.dsl.CommonExtension
|
||||
import com.android.build.api.dsl.ApplicationDefaultConfig
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import com.android.build.api.dsl.CompileOptions
|
||||
import com.android.build.api.dsl.LibraryDefaultConfig
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
import com.android.build.api.dsl.Lint
|
||||
import isEnterpriseBuild
|
||||
import org.gradle.api.Project
|
||||
import java.io.File
|
||||
|
||||
fun CommonExtension<*, *, *, *, *, *>.androidConfig(project: Project) {
|
||||
defaultConfig {
|
||||
compileSdk = Versions.COMPILE_SDK
|
||||
minSdk = Versions.minSdk
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
fun ApplicationExtension.androidAppConfig(project: Project) {
|
||||
compileSdk = Versions.COMPILE_SDK
|
||||
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
generatedDensities()
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = Versions.javaVersion
|
||||
targetCompatibility = Versions.javaVersion
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isReturnDefaultValues = true
|
||||
}
|
||||
defaultConfig(::defaultApplicationConfig)
|
||||
compileOptions(::defaultCompileOptions)
|
||||
testOptions(::defaultTestOptions)
|
||||
|
||||
lint {
|
||||
lintConfig = File("${project.rootDir}/tools/lint/lint.xml")
|
||||
if (isEnterpriseBuild) {
|
||||
// Disable check on ObsoleteSdkInt for Enterprise builds
|
||||
// since the min sdk is higher for Enterprise builds
|
||||
disable.add("ObsoleteSdkInt")
|
||||
}
|
||||
checkDependencies = false
|
||||
abortOnError = true
|
||||
ignoreTestSources = true
|
||||
ignoreTestFixturesSources = true
|
||||
checkGeneratedSources = false
|
||||
project.defaultLintOptions(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun CommonExtension<*, *, *, *, *, *>.composeConfig() {
|
||||
fun LibraryExtension.androidLibraryConfig(project: Project) {
|
||||
compileSdk = Versions.COMPILE_SDK
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources.excludes.apply {
|
||||
add("META-INF/AL2.0")
|
||||
add("META-INF/LGPL2.1")
|
||||
}
|
||||
}
|
||||
defaultConfig(::defaultLibraryConfig)
|
||||
compileOptions(::defaultCompileOptions)
|
||||
testOptions(::defaultTestOptions)
|
||||
|
||||
lint {
|
||||
// Extra rules for compose
|
||||
// Disabled until lint stops inspecting generated ksp files...
|
||||
// error.add("ComposableLambdaParameterNaming")
|
||||
error.add("ComposableLambdaParameterPosition")
|
||||
ignoreTestFixturesSources = true
|
||||
checkGeneratedSources = false
|
||||
project.defaultLintOptions(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun ApplicationExtension.composeAppConfig() {
|
||||
buildFeatures(::defaultComposeBuildFeatures)
|
||||
packaging(::defaultPackagingOptions)
|
||||
lint(::defaultComposeLintOptions)
|
||||
}
|
||||
|
||||
fun LibraryExtension.composeLibraryConfig() {
|
||||
buildFeatures(::defaultComposeBuildFeatures)
|
||||
packaging(::defaultPackagingOptions)
|
||||
lint(::defaultComposeLintOptions)
|
||||
}
|
||||
|
||||
fun defaultApplicationConfig(applicationDefaultConfig: ApplicationDefaultConfig) = applicationDefaultConfig.apply {
|
||||
minSdk = Versions.minSdk
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
generatedDensities()
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultLibraryConfig(libraryDefaultConfig: LibraryDefaultConfig) = libraryDefaultConfig.apply {
|
||||
minSdk = Versions.minSdk
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
generatedDensities()
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultCompileOptions(compileOptions: CompileOptions) = compileOptions.apply {
|
||||
sourceCompatibility = Versions.javaVersion
|
||||
targetCompatibility = Versions.javaVersion
|
||||
}
|
||||
|
||||
fun defaultTestOptions(testOptions: com.android.build.api.dsl.TestOptions) = testOptions.apply {
|
||||
unitTests.isReturnDefaultValues = true
|
||||
}
|
||||
|
||||
fun defaultComposeBuildFeatures(buildFeatures: com.android.build.api.dsl.BuildFeatures) = buildFeatures.apply {
|
||||
compose = true
|
||||
}
|
||||
|
||||
fun defaultPackagingOptions(packagingOptions: com.android.build.api.dsl.Packaging) = packagingOptions.apply {
|
||||
resources.excludes.apply {
|
||||
add("META-INF/AL2.0")
|
||||
add("META-INF/LGPL2.1")
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultComposeLintOptions(lint: Lint) = lint.apply {
|
||||
// Extra rules for compose
|
||||
// Disabled until lint stops inspecting generated ksp files...
|
||||
// error.add("ComposableLambdaParameterNaming")
|
||||
error.add("ComposableLambdaParameterPosition")
|
||||
ignoreTestFixturesSources = true
|
||||
checkGeneratedSources = false
|
||||
}
|
||||
|
||||
fun Project.defaultLintOptions(lint: Lint) = lint.apply {
|
||||
lintConfig = File("${project.rootDir}/tools/lint/lint.xml")
|
||||
if (isEnterpriseBuild) {
|
||||
// Disable check on ObsoleteSdkInt for Enterprise builds
|
||||
// since the min sdk is higher for Enterprise builds
|
||||
disable.add("ObsoleteSdkInt")
|
||||
}
|
||||
checkDependencies = false
|
||||
abortOnError = true
|
||||
ignoreTestSources = true
|
||||
ignoreTestFixturesSources = true
|
||||
checkGeneratedSources = false
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
/**
|
||||
* This will generate the plugin "io.element.android-compose-application" to use by app
|
||||
*/
|
||||
import extension.androidConfig
|
||||
import extension.androidAppConfig
|
||||
import extension.commonDependencies
|
||||
import extension.composeConfig
|
||||
import extension.composeAppConfig
|
||||
import extension.composeDependencies
|
||||
import extension.setupKover
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
@@ -19,14 +19,13 @@ import org.gradle.accessors.dm.LibrariesForLibs
|
||||
val libs = the<LibrariesForLibs>()
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
id("com.autonomousapps.dependency-analysis")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
android {
|
||||
androidConfig(project)
|
||||
composeConfig()
|
||||
androidAppConfig(project)
|
||||
composeAppConfig()
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
/**
|
||||
* This will generate the plugin "io.element.android-compose-library", used in android library with compose modules.
|
||||
*/
|
||||
import extension.androidConfig
|
||||
import extension.androidLibraryConfig
|
||||
import extension.commonDependencies
|
||||
import extension.composeConfig
|
||||
import extension.composeLibraryConfig
|
||||
import extension.composeDependencies
|
||||
import extension.setupKover
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
@@ -19,14 +19,13 @@ import org.gradle.accessors.dm.LibrariesForLibs
|
||||
val libs = the<LibrariesForLibs>()
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
id("com.autonomousapps.dependency-analysis")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
android {
|
||||
androidConfig(project)
|
||||
composeConfig()
|
||||
androidLibraryConfig(project)
|
||||
composeLibraryConfig()
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/**
|
||||
* This will generate the plugin "io.element.android-library", used in android library without compose modules.
|
||||
*/
|
||||
import extension.androidConfig
|
||||
import extension.androidLibraryConfig
|
||||
import extension.commonDependencies
|
||||
import extension.setupKover
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
@@ -17,12 +17,11 @@ import org.gradle.accessors.dm.LibrariesForLibs
|
||||
val libs = the<LibrariesForLibs>()
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
id("com.autonomousapps.dependency-analysis")
|
||||
}
|
||||
|
||||
android {
|
||||
androidConfig(project)
|
||||
androidLibraryConfig(project)
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user