Skip to content

Migrate amazon & debugview modules to KTS #2327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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 api-tester/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ android {
}
customEntitlementComputation {
dimension "apis"
matchingFallbacks = ["defaults"]
Copy link
Member

@JayShortway JayShortway Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skydoves This fixes it locally for me. 🤞 The way I understand the error is that :feature:amazon, :ui:revenuecatui and :ui:debugview don't declare the customEntitlementsComputation flavor, and so api-tester's customEntitlementsComputation flavor cannot find the appropriate flavor of those dependencies.

This matchingFallbacks option tells it to fall back to the defaults flavor of the dependency if it doesn't have a customEntitlementsComputation flavor. (cc @tonidero)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Thanks so much for jumping in and fixing it directly, @JayShortway! 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice! So we do use this in these modules:

    defaultConfig {
        missingDimensionStrategy("apis", "defaults")
    }

But seems this is not picking that up... In any case, I think this is fine 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right! Should "apis" be included in matchingFallbacks you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm well I think apis is the "dimension", vs defaults/customEntitlementComputation which are the possible values of that dimension. I think matchingFallbacks requires the value of the dimension, if I understand correctly? So I think it should be enough as it is... Might be worth confirming it would still fail API tests for the custom entitlement computation flavor though, just in case

}
}

Expand Down
32 changes: 0 additions & 32 deletions feature/amazon/build.gradle

This file was deleted.

33 changes: 33 additions & 0 deletions feature/amazon/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

if (!(project.properties["ANDROID_VARIANT_TO_PUBLISH"] as String).contains("customEntitlementComputation")) {
apply(plugin = "com.vanniktech.maven.publish")
}

apply(from = "${rootProject.projectDir}/library.gradle")

android {
namespace = "com.revenuecat.purchases.amazon"

flavorDimensions += "apis"

productFlavors {
create("defaults") {
dimension = "apis"
isDefault = true
}
}

defaultConfig {
missingDimensionStrategy("apis", "defaults")
}
}

dependencies {
implementation(project(":purchases"))

implementation(libs.amazon.appstore.sdk)
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ kotlin = "1.8.22"
kotlinBom = "1.8.0"
# Can't update until we use more recent kotlin. 1.6.0 uses Kotlin 1.9.0
kotlinxSerializationJSON = "1.5.1"
kover = "0.7.0"
kover = "0.7.2"
legacyCoreUi = "1.0.0"
lifecycle = "2.5.0"
material = "1.6.0"
Expand Down
6 changes: 0 additions & 6 deletions library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ android {
}
}

project.afterEvaluate {
// Remove afterEvaluate
// after https://github.com/Kotlin/kotlinx-kover/issues/362 is fixed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

project.pluginManager.apply("org.jetbrains.kotlinx.kover")
}

def obtainMinSdkVersion() {
def result = minVersion

Expand Down
8 changes: 0 additions & 8 deletions purchases/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,3 @@ tasks.dokkaHtmlPartial.configure {
}
}
}

// Remove afterEvaluate
// after https://github.com/Kotlin/kotlinx-kover/issues/362 is fixed
afterEvaluate {
dependencies {
add("kover", project(":feature:amazon"))
}
}
67 changes: 0 additions & 67 deletions ui/debugview/build.gradle

This file was deleted.

70 changes: 70 additions & 0 deletions ui/debugview/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.paparazzi)
}

if (!(project.properties["ANDROID_VARIANT_TO_PUBLISH"] as String).contains("customEntitlementComputation")) {
apply(plugin = "com.vanniktech.maven.publish")
}

apply(from = "${rootProject.projectDir}/library.gradle")

android {
namespace = "com.revenuecat.purchases.ui.debugview"

flavorDimensions += "apis"
productFlavors {
create("defaults") {
dimension = "apis"
isDefault = true
}
}

defaultConfig {
minSdk = 21
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.4.8"
}
}

dependencies {
implementation(project(":purchases"))

implementation(libs.androidx.core)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.compose)

implementation(platform(libs.compose.bom))
implementation(libs.compose.ui)
implementation(libs.compose.ui.graphics)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.material)
implementation(libs.compose.material3)

debugImplementation(libs.compose.ui.tooling)
debugImplementation(libs.androidx.test.compose.manifest)

testImplementation(libs.androidx.appcompat)
testImplementation(libs.androidx.lifecycle.runtime.ktx)
testImplementation(libs.androidx.test.espresso.core)
testImplementation(libs.androidx.test.runner)
testImplementation(libs.androidx.test.rules)
testImplementation(libs.androidx.test.junit)

testImplementation(platform(libs.compose.bom))
testImplementation(libs.androidx.test.compose)

testImplementation(libs.assertJ)
testImplementation(libs.mockk.android)
testImplementation(libs.mockk.agent)

testImplementation(libs.androidx.legacy.core.ui)
}
2 changes: 1 addition & 1 deletion ui/debugview/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down