Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ gradle-android = ["gradle-android-sdk-common", "gradle-android-build", "gradle-a

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
publisher = { id = "io.deepmedia.tools.deployer", version.ref = "publisher" }
android-library = { id = "com.android.library", version.ref = "agp" }
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ internal fun Project.createProductFlavorConfigurations(
val buildTypedSubFlavor = nameOf(subFlavor, variant.buildType.orEmpty())
log.d { "Creating buildTyped sub product flavor configuration ${buildTypedSubFlavor.greasify()}..." }
val config = createGrease(buildTypedSubFlavor, isTransitive)
config.attributes {
attribute(BuildTypeAttr.ATTRIBUTE, objects.named(BuildTypeAttr::class, variant.buildType.orEmpty()))
}
config.extendsFromSafely(grease(isTransitive), log)
config.extendsFromSafely(greaseOf(variant.buildType.orEmpty(), isTransitive), log)
config.extendsFromSafely(greaseOf(subFlavor, isTransitive), log)
config.extendsFromSafely(flavorConfiguration, log)
}
Expand Down Expand Up @@ -153,6 +157,9 @@ internal fun Project.createVariantConfigurations(
) = androidComponent.onVariants { variant ->
log.d { "Creating variant configuration ${variant.name.greasify()}..." }
val config = createGrease(variant.name, isTransitive)
config.attributes {
attribute(BuildTypeAttr.ATTRIBUTE, objects.named(BuildTypeAttr::class, variant.buildType.orEmpty()))
}
config.extendsFromSafely(grease(isTransitive), log)
config.extendsFromSafely(greaseOf(variant.buildType.orEmpty(), isTransitive), log)
variant.flavorName?.let { flavor ->
Expand Down
5 changes: 5 additions & 0 deletions tests/sample-dependency-pure/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

android {
Expand All @@ -8,6 +9,10 @@ android {
defaultConfig {
minSdk = 21
}

kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
Expand Down
4 changes: 1 addition & 3 deletions tests/sample-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,5 @@ dependencies {
// Manifest changes, layout resources
grease("com.otaliastudios:cameraview:2.7.2")

// Doesn't work. TODO: we need to configure grease configurations so that in case of multiple matching
// variants, they prefer one where com.android.build.api.attributes.BuildTypeAttr is set to release
// grease(project(":sample-dependency-pure"))
grease(project(":sample-dependency-pure"))
}