Skip to content

Commit

Permalink
PoC for Emergetools snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tonidero committed Oct 31, 2023
1 parent 8997509 commit c21a8df
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 22 deletions.
4 changes: 2 additions & 2 deletions api-tester/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
Expand Down
6 changes: 3 additions & 3 deletions base-application.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}

buildFeatures {
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins {
// The request for this plugin could not be satisfied because the plugin is already on the classpath with an
// unknown version, so compatibility cannot be checked.
alias libs.plugins.kotlin.parcelize apply false
alias libs.plugins.ksp apply false
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions examples/CustomEntitlementComputationSample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
Expand Down
6 changes: 3 additions & 3 deletions examples/MagicWeather/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17.toString()
}
buildFeatures {
buildConfig true
Expand Down
24 changes: 20 additions & 4 deletions examples/paywall-tester/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp)
alias(libs.plugins.emergetools)
}

emerge {
// Emerge uses the EMERGE_API_TOKEN env variable by default, so no need to set this explicitly, this is just for example purposes
apiToken.set(System.getenv("EMERGE_API_TOKEN"))
}

apply from: "$rootProject.projectDir/base-application.gradle"
Expand Down Expand Up @@ -41,17 +48,17 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17.toString()
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.0-alpha02'
kotlinCompilerExtensionVersion '1.4.0'
}
packaging {
resources {
Expand All @@ -60,6 +67,10 @@ android {
}
}

kotlin {
jvmToolchain(17)
}

dependencies {
implementation project(path: ':purchases')
implementation project(path: ':feature:amazon')
Expand All @@ -81,4 +92,9 @@ dependencies {
implementation libs.compose.ui.google.fonts
debugImplementation libs.compose.ui.tooling
debugImplementation libs.androidx.test.compose.manifest

implementation "com.emergetools.snapshots:snapshots-annotations:0.8.1"

androidTestImplementation "com.emergetools.snapshots:snapshots:0.8.1"
ksp "com.emergetools.snapshots:snapshots-processor:0.8.1"
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ window = "1.1.0"
commonmark = "0.21.0"
activity-compose = "1.7.2"
fragment = "1.6.1"
emergetools = "2.1.3"
ksp = "1.8.0-1.0.9" # We are still using kotlin 1.8.0

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand All @@ -50,6 +52,8 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover"}
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparrazzi" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
emergetools = { id = "com.emergetools.android" , version.ref = "emergetools" }

[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
Expand Down
6 changes: 3 additions & 3 deletions library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui/debugview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.0-alpha02'
kotlinCompilerExtensionVersion '1.4.0'
}
}

Expand Down
13 changes: 11 additions & 2 deletions ui/revenuecatui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ plugins {
alias libs.plugins.kotlin.android
alias libs.plugins.kotlin.serialization
alias libs.plugins.kotlin.parcelize
alias libs.plugins.ksp
}


if (!project.getProperties()["ANDROID_VARIANT_TO_PUBLISH"].contains("customEntitlementComputation")) {
apply plugin: "com.vanniktech.maven.publish"
}
Expand Down Expand Up @@ -33,7 +33,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.0-alpha02'
kotlinCompilerExtensionVersion '1.4.0'
}
packaging {
resources {
Expand All @@ -42,6 +42,10 @@ android {
}
}

kotlin {
jvmToolchain(17)
}

dependencies {
implementation project(path: ':purchases')

Expand Down Expand Up @@ -69,6 +73,11 @@ dependencies {
debugImplementation libs.compose.ui.tooling
debugImplementation libs.androidx.test.compose.manifest

androidTestImplementation "com.emergetools.snapshots:snapshots:0.8.1"
// For Compose @Preview snapshot generation from the main source set:
ksp "com.emergetools.snapshots:snapshots-processor:0.8.1"
kspAndroidTest "com.emergetools.snapshots:snapshots-processor:0.8.1"

testImplementation libs.bundles.test
testImplementation libs.coroutines.test
testImplementation libs.kotlinx.serialization.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private fun CheckmarkBox(isSelected: Boolean, colors: TemplateConfiguration.Colo
@Preview(showBackground = true, locale = "en-rUS")
@Preview(showBackground = true, locale = "es-rES")
@Composable
private fun Template2PaywallPreview() {
fun Template2PaywallPreview() {
InternalPaywall(
options = PaywallOptions.Builder(dismissRequest = {}).build(),
viewModel = MockViewModel(offering = TestData.template2Offering),
Expand All @@ -323,7 +323,7 @@ private fun Template2PaywallPreview() {
@Preview(showBackground = true, locale = "en-rUS")
@Preview(showBackground = true, locale = "es-rES")
@Composable
private fun Template2PaywallFooterPreview() {
fun Template2PaywallFooterPreview() {
InternalPaywall(
options = PaywallOptions.Builder(dismissRequest = {}).build(),
viewModel = MockViewModel(mode = PaywallMode.FOOTER, offering = TestData.template2Offering),
Expand Down

0 comments on commit c21a8df

Please sign in to comment.