Skip to content

Commit

Permalink
Fixed finalizeDSL block preventing property changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Oct 20, 2023
1 parent 7df194a commit 73eb111
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
8 changes: 5 additions & 3 deletions demo-project/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ plugins {
alias(libs.plugins.kotlin.android)
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))

android {
namespace = "com.example.myapplication"
compileSdk = libs.versions.android.sdk.get().toInt()
buildFeatures.viewBinding = true

compileSdk = libs.versions.android.compileSDK.get().toInt()
defaultConfig {
applicationId = "com.example.myapplication"
minSdk = 21
minSdk = libs.versions.android.minSDK.get().toInt()

versionCode = 1
versionName = "1.0"

Expand Down
2 changes: 2 additions & 0 deletions demo-project/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
jacoco
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))

dependencies {
testImplementation(libs.junit)
}
6 changes: 4 additions & 2 deletions demo-project/login/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ plugins {
alias(libs.plugins.kotlin.android)
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))

android {
namespace = "com.example.login"
compileSdk = libs.versions.android.sdk.get().toInt()
buildFeatures.viewBinding = true
testFixtures.enable = true

compileSdk = libs.versions.android.compileSDK.get().toInt()
defaultConfig {
minSdk = 21
minSdk = libs.versions.android.minSDK.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
Expand Down
8 changes: 7 additions & 1 deletion demo-project/ui-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ plugins {
alias(libs.plugins.kotlin.android)
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))

android {
namespace = "com.example.app.test"
compileSdk = libs.versions.android.sdk.get().toInt()

compileSdk = libs.versions.android.compileSDK.get().toInt()
defaultConfig {
minSdk = libs.versions.android.minSDK.get().toInt()
}

targetProjectPath = projects.demoProject.app.dependencyProject.path

Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[versions]
kotlin = "1.9.10"
agp = "8.1.2"
android-sdk = "34"
android-minSDK = "21"
android-compileSDK = "34"
androidx-lifecycle = "2.6.2"
androidx-navigation = "2.7.4"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

package io.github.gmazzo.android.test.aggregation

import org.gradle.api.DomainObjectSet
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.kotlin.dsl.aggregateTestCoverage
import org.gradle.kotlin.dsl.apply
Expand All @@ -13,7 +13,7 @@ import org.gradle.kotlin.dsl.typeOf

internal abstract class AndroidTestBaseAggregationPlugin : Plugin<Project> {

internal abstract val extendedProperties: ListProperty<Property<*>>
abstract val extendedProperties: DomainObjectSet<Property<*>>

override fun apply(target: Project): Unit = with(target) {
apply(plugin = "com.android.base")
Expand All @@ -34,8 +34,7 @@ internal abstract class AndroidTestBaseAggregationPlugin : Plugin<Project> {
}

androidComponents.finalizeDsl {
extendedProperties.finalizeValue()
extendedProperties.get().forEach { it.finalizeValue() }
extendedProperties.all { finalizeValue() }
}
}

Expand Down

0 comments on commit 73eb111

Please sign in to comment.