diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd6a61..680549b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ android { ### Other Changes +- **android:** Use `ANDROID_BUILD_TOOLS_VERSION` env variable for `buildToolsVersion` if the option is not configured (#132) - **android:** Remove the workaround for Explicit API enabling as the issue has been [fixed](https://youtrack.jetbrains.com/issue/KT-37652) in Kotlin 1.9 - **android:** Remove disabling of build features `aidl`, `renderScript` and `buildConfig` as they are already disabled by default in new versions of AGP - **kotlin:** Deprecate accessor `kotlinCompile`. diff --git a/infrastructure-android/src/main/kotlin/android/AndroidOptions.kt b/infrastructure-android/src/main/kotlin/android/AndroidOptions.kt index 9aadc38..ad65446 100644 --- a/infrastructure-android/src/main/kotlin/android/AndroidOptions.kt +++ b/infrastructure-android/src/main/kotlin/android/AndroidOptions.kt @@ -6,22 +6,30 @@ import org.gradle.api.tasks.TaskProvider /** Options for android projects. */ public interface AndroidOptions { - /** Minimal Android SDK to use across all android modules. */ + /** + * Minimal Android SDK to be used in all android modules. + * By default, SDK 23 is used. + */ public val minSdk: Property - /** Target Android SDK to use across all android modules. */ + /** + * Target Android SDK to be used in all android modules. + * By default, SDK 34 is used. + */ public val targetSdk: Property /** - * Compile Android SDK to use across all android modules. + * Compile Android SDK to be used in all android modules. * It can be version number ("33") or version code ("T"). * Uses [targetSdk] as compile SDK if not configured. */ public val compileSdk: Property /** - * Build Tools version to use across all android modules. - * Uses default version for current Android Gradle Plugin if not configured. + * Build Tools version to be used in all android modules. + * + * By default, uses the version from environment variable `ANDROID_BUILD_TOOLS_VERSION`, + * or default version for current Android Gradle Plugin if the variable is not present. */ public val buildToolsVersion: Property diff --git a/infrastructure-android/src/main/kotlin/android/AndroidOptionsImpl.kt b/infrastructure-android/src/main/kotlin/android/AndroidOptionsImpl.kt index 06eec9b..d4a359b 100644 --- a/infrastructure-android/src/main/kotlin/android/AndroidOptionsImpl.kt +++ b/infrastructure-android/src/main/kotlin/android/AndroidOptionsImpl.kt @@ -5,11 +5,15 @@ import com.redmadrobot.build.internal.InternalGradleInfrastructureApi import com.redmadrobot.build.kotlin.TestOptions import com.redmadrobot.build.kotlin.TestOptionsImpl import org.gradle.api.plugins.ExtensionAware +import org.gradle.api.provider.ProviderFactory import org.gradle.kotlin.dsl.create +import javax.inject.Inject @OptIn(InternalGradleInfrastructureApi::class) @Suppress("LeakingThis") -internal abstract class AndroidOptionsImpl : AndroidOptions, WithDefaults { +internal abstract class AndroidOptionsImpl @Inject constructor( + providers: ProviderFactory, +) : AndroidOptions, WithDefaults { private val testOptions: TestOptionsImpl private var areTestDefaultsSet = false @@ -25,6 +29,7 @@ internal abstract class AndroidOptionsImpl : AndroidOptions, WithDefaults taskProvider.name.endsWith("ReleaseUnitTest") }