diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 18d8e5d..0000000 --- a/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext.versions = [ - minSdk: 23, - compileSdk: 34, - kotlin: '1.9.10', - composeUi: '1.5.2', - composeCompiler: '1.5.3', - composeUiMaterial3: '1.1.2', - activityCompose: '1.7.2', - appCompat: '1.6.1', - testParamInjector: '1.12', - recyclerView: '1.3.1', - ktx: '1.12.0', - paparazzi: '1.3.1', - roborazzi: '1.7.0-alpha-4', - ] - - repositories { - google() - mavenCentral() - } - - dependencies { - classpath "com.android.tools.build:gradle:8.1.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" - classpath "com.vanniktech:gradle-maven-publish-plugin:0.25.3" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.0" - classpath "app.cash.paparazzi:paparazzi-gradle-plugin:$versions.paparazzi" - classpath "io.github.takahirom.roborazzi:roborazzi-gradle-plugin:$versions.roborazzi" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} - -// Used on CI to prevent publishing of non-snapshot versions. -tasks.register("throwIfVersionIsNotSnapshot") { - def libraryVersion = project.findProperty("VERSION_NAME") as String - if (!libraryVersion.endsWith("SNAPSHOT")) { - throw IllegalStateException("Project isn't using a snapshot version = $libraryVersion") - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..0ce7a6f --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.maven.publish) apply false + alias(libs.plugins.dokka) apply false + alias(libs.plugins.paparazzi) apply false + alias(libs.plugins.roborazzi) apply false +} + + +tasks.register("clean") { + delete(rootProject.buildDir) +} + +// Used on CI to prevent publishing of non-snapshot versions. +tasks.register("throwIfVersionIsNotSnapshot") { + val libraryVersion = project.findProperty("VERSION_NAME") as String + if (!libraryVersion.endsWith("SNAPSHOT")) { + throw IllegalStateException("Project isn't using a snapshot version = $libraryVersion") + } +} diff --git a/cascade-compose/build.gradle b/cascade-compose/build.gradle deleted file mode 100644 index 58b3dc2..0000000 --- a/cascade-compose/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -plugins { - id "com.dropbox.dropshots" version "0.4.1" - id "wtf.emulator.gradle" version "0.15.1" -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'app.cash.paparazzi' -apply plugin: "io.github.takahirom.roborazzi" -apply plugin: 'com.vanniktech.maven.publish' - -android { - resourcePrefix "cascade_" - namespace "me.saket.cascade" - - compileSdkVersion versions.compileSdk - defaultConfig { - minSdkVersion versions.minSdk - targetSdk versions.compileSdk - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - buildFeatures { - compose = true - buildConfig = true - } - composeOptions { - kotlinCompilerExtensionVersion = versions.composeCompiler - } - kotlinOptions { - jvmTarget = "1.8" - } - lintOptions { - abortOnError true - } - testOptions { - animationsDisabled = true - unitTests.includeAndroidResources = true // Required by Robolectric. - } -} - -emulatorwtf { - devices = [ - [model: 'Pixel7', version: 31, atd: false], // ATD emulators don't have any soft keyboard. - ] - directoriesToPull = ["/sdcard/Download/"] - numFlakyTestAttempts = 2 // 3 runs in total. - fileCacheTtl = Duration.ofDays(30) - timeout = Duration.ofMinutes(15) // Note to self: this is per shard and not per test. - printOutput = true // Print report URL even for successful test runs. -} - -dependencies { - implementation "androidx.activity:activity-compose:$versions.activityCompose" - implementation "androidx.compose.ui:ui:$versions.composeUi" - implementation "androidx.compose.ui:ui-tooling:$versions.composeUi" - implementation "androidx.compose.foundation:foundation:$versions.composeUi" - implementation "androidx.compose.material3:material3:$versions.composeUiMaterial3" - - testImplementation "junit:junit:4.13.2" - testImplementation "com.google.testparameterinjector:test-parameter-injector:$versions.testParamInjector" - testImplementation "com.google.truth:truth:1.1.5" - - testImplementation "androidx.compose.ui:ui-test-junit4:$versions.composeUi" - testImplementation "org.robolectric:robolectric:4.10.3" - testImplementation "io.github.takahirom.roborazzi:roborazzi:$versions.roborazzi" - testImplementation "io.github.takahirom.roborazzi:roborazzi-junit-rule:$versions.roborazzi" - testImplementation "androidx.compose.material:material-icons-extended:$versions.composeUi" - testImplementation 'org.hamcrest:hamcrest-core:1.3' // Workaround for https://github.com/cashapp/paparazzi/issues/622. - debugImplementation "androidx.compose.ui:ui-test-manifest:$versions.composeUi" - - debugImplementation "androidx.appcompat:appcompat:$versions.appCompat" - androidTestImplementation "androidx.test:core-ktx:1.5.0" - androidTestImplementation "androidx.test:rules:1.5.0" - androidTestImplementation "androidx.test.ext:junit-ktx:1.1.5" - androidTestImplementation "androidx.compose.ui:ui-test-junit4:$versions.composeUi" - androidTestImplementation "com.google.testparameterinjector:test-parameter-injector:$versions.testParamInjector" - androidTestImplementation "androidx.compose.material:material-icons-extended:$versions.composeUi" -} diff --git a/cascade-compose/build.gradle.kts b/cascade-compose/build.gradle.kts new file mode 100644 index 0000000..248db2e --- /dev/null +++ b/cascade-compose/build.gradle.kts @@ -0,0 +1,90 @@ +import java.time.Duration + +plugins { + alias(libs.plugins.dropshots) + alias(libs.plugins.emulator) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.paparazzi) + alias(libs.plugins.roborazzi) + alias(libs.plugins.maven.publish) +} + +android { + resourcePrefix = "cascade_" + namespace = "me.saket.cascade" + + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildFeatures { + compose = true + buildConfig = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + } + kotlinOptions { + jvmTarget = "1.8" + } + lint { + abortOnError = true + } + testOptions { + animationsDisabled = true + unitTests { + isIncludeAndroidResources = true // Required by Robolectric. + } + } +} + +emulatorwtf { + devices.set( + listOf( + mapOf( + "model" to "Pixel7", + "version" to 31, + "atd" to false + ) + ) + ) // ATD emulators don't have any soft keyboard. + directoriesToPull.set(listOf("/sdcard/Download/")) + numFlakyTestAttempts.set(2) // 3 runs in total. + fileCacheTtl.set(Duration.ofDays(30)) + timeout.set(Duration.ofMinutes(15)) // Note to self: this is per shard and not per test. + printOutput.set(true) // Print report URL even for successful test runs. +} + +dependencies { + implementation(libs.activity.compose) + implementation(libs.compose.ui) + implementation(libs.compose.ui.tooling) + implementation(libs.compose.foundation) + implementation(libs.compose.material3) + + testImplementation(libs.junit) + testImplementation(libs.testparaminjector) + testImplementation(libs.truth) + + testImplementation(libs.compose.ui.test) + testImplementation(libs.robolectric) + testImplementation(libs.roborazzi) + testImplementation(libs.roborazzi.junit) + testImplementation(libs.compose.icons.extended) + testImplementation(libs.hamcrest) + + debugImplementation(libs.compose.ui.manifest) + + debugImplementation(libs.appcompat) + + androidTestImplementation(libs.test.core) + androidTestImplementation(libs.test.rules) + androidTestImplementation(libs.test.junit.ext) + androidTestImplementation(libs.compose.ui.test) + androidTestImplementation(libs.testparaminjector) + androidTestImplementation(libs.compose.icons.extended) +} diff --git a/cascade/build.gradle b/cascade/build.gradle deleted file mode 100644 index 8ad9711..0000000 --- a/cascade/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'com.vanniktech.maven.publish' - -android { - resourcePrefix "cascade_" - namespace "me.saket.cascade" - - compileSdkVersion versions.compileSdk - defaultConfig { minSdkVersion 21 } - - kotlinOptions { - jvmTarget = "1.8" - } - - lintOptions { - abortOnError true - } -} - -dependencies { - implementation "androidx.appcompat:appcompat:$versions.appCompat" - implementation "androidx.recyclerview:recyclerview:$versions.recyclerView" - implementation "androidx.core:core-ktx:$versions.ktx" -} diff --git a/cascade/build.gradle.kts b/cascade/build.gradle.kts new file mode 100644 index 0000000..5274e0a --- /dev/null +++ b/cascade/build.gradle.kts @@ -0,0 +1,30 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.maven.publish) +} + +android { + resourcePrefix = "cascade_" + namespace = "me.saket.cascade" + + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = 21 + } + + kotlinOptions { + jvmTarget = "1.8" + } + + lint { + abortOnError = true + } +} + +dependencies { + implementation(libs.appcompat) + implementation(libs.recyclerview) + implementation(libs.ktx) +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..53459ca --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,79 @@ +[versions] +android-gradle = "8.1.2" +minSdk = "23" +compileSdk = "34" +kotlin = "1.9.10" +composeUi = "1.5.2" +composeCompiler = "1.5.3" +composeUiMaterial3 = "1.1.2" +activityCompose = "1.7.2" +appCompat = "1.6.1" +testParamInjector = "1.12" +recyclerView = "1.3.1" +ktx = "1.12.0" +paparazzi = "1.3.1" +roborazzi = "1.7.0-alpha-4" +material = "1.9.0" +taptargetview = "1.13.3" +introshowcaseview = "1.0.7" +junit = "4.13.2" +truth = "1.1.5" +hamcrest = "1.3" +robolectric = "4.10.3" +testCore = "1.5.0" +testRules = "1.5.0" +testJunitExt = "1.1.5" +dropshots = "0.4.1" +emulator-gradle = "0.15.1" +maven-publish = "0.25.3" +dokka = "1.9.0" + +[libraries] +# Compose & AndroidX +activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" } +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "composeUi" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "composeUi" } +compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "composeUi" } +compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "composeUiMaterial3" } +compose-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "composeUi" } + +# AndroidX & Core +appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appCompat" } +ktx = { module = "androidx.core:core-ktx", version.ref = "ktx" } +recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerView" } + +# Material & UI +material = { module = "com.google.android.material:material", version.ref = "material" } +taptargetview = { module = "com.getkeepsafe.taptargetview:taptargetview", version.ref = "taptargetview" } +introshowcaseview = { module = "com.canopas.intro-showcase-view:introshowcaseview", version.ref = "introshowcaseview" } + +# Testing +junit = { module = "junit:junit", version.ref = "junit" } +truth = { module = "com.google.truth:truth", version.ref = "truth" } +hamcrest = { module = "org.hamcrest:hamcrest-core", version.ref = "hamcrest" } +testparaminjector = { module = "com.google.testparameterinjector:test-parameter-injector", version.ref = "testParamInjector" } +robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" } +test-core = { module = "androidx.test:core-ktx", version.ref = "testCore" } +test-rules = { module = "androidx.test:rules", version.ref = "testRules" } +test-junit-ext = { module = "androidx.test.ext:junit-ktx", version.ref = "testJunitExt" } + +# Compose Test +compose-ui-test = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "composeUi" } +compose-ui-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "composeUi" } + +# Roborazzi / Paparazzi +paparazzi = { module = "app.cash.paparazzi:paparazzi", version.ref = "paparazzi" } +roborazzi = { module = "io.github.takahirom.roborazzi:roborazzi", version.ref = "roborazzi" } +roborazzi-junit = { module = "io.github.takahirom.roborazzi:roborazzi-junit-rule", version.ref = "roborazzi" } + + +[plugins] +android-application = { id = "com.android.application", version.ref = "android-gradle" } +android-library = { id = "com.android.library", version.ref = "android-gradle" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" } +roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" } +dropshots = { id = "com.dropbox.dropshots", version.ref = "dropshots" } +emulator = { id = "wtf.emulator.gradle", version.ref = "emulator-gradle" } +maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } diff --git a/sample/build.gradle b/sample/build.gradle deleted file mode 100644 index 540f22d..0000000 --- a/sample/build.gradle +++ /dev/null @@ -1,53 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion versions.compileSdk - namespace "me.saket.cascade.sample" - - defaultConfig { - applicationId namespace - applicationId "me.saket.cascade.sample" - minSdkVersion 23 - targetSdkVersion versions.compileSdk - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled true - } - } - - buildFeatures.compose = true - composeOptions.kotlinCompilerExtensionVersion = versions.composeCompiler - - kotlinOptions { - jvmTarget = "1.8" - } - - compileOptions { - targetCompatibility 1.8 - sourceCompatibility 1.8 - } - - lintOptions { - abortOnError true - } -} - -dependencies { - implementation project(':cascade') - implementation project(':cascade-compose') - implementation "androidx.appcompat:appcompat:$versions.appCompat" - implementation "androidx.core:core-ktx:$versions.ktx" - implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.3' - implementation "androidx.recyclerview:recyclerview:$versions.recyclerView" - - implementation "androidx.activity:activity-compose:$versions.activityCompose" - implementation "com.google.android.material:material:1.9.0" - implementation "androidx.compose.material3:material3:$versions.composeUiMaterial3" - implementation "androidx.compose.material:material-icons-extended:$versions.composeUi" - implementation "com.canopas.intro-showcase-view:introshowcaseview:1.0.7" -} diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts new file mode 100644 index 0000000..302b4fe --- /dev/null +++ b/sample/build.gradle.kts @@ -0,0 +1,61 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + + +android { + namespace = "me.saket.cascade.sample" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + applicationId = "me.saket.cascade.sample" + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.compileSdk.get().toInt() + versionCode = 1 + versionName = "1.0" + } + + buildTypes { + release { + isMinifyEnabled = true + } + } + + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + } + + kotlinOptions { + jvmTarget = "1.8" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + lint { + abortOnError = true + } +} + +dependencies { + implementation(project(":cascade")) + implementation(project(":cascade-compose")) + + implementation(libs.appcompat) + implementation(libs.ktx) + implementation(libs.recyclerview) + + implementation(libs.activity.compose) + implementation(libs.material) + implementation(libs.compose.material3) + implementation(libs.compose.icons.extended) + implementation(libs.taptargetview) + implementation(libs.introshowcaseview) +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 571a4bc..0000000 --- a/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -include ':cascade' -include ':cascade-compose' -include ':sample' - -rootProject.name = "cascade" diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..9289f52 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +rootProject.name = "cascade" + +include(":cascade") +include(":cascade-compose") +include(":sample") + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + maven(url = "https://maven.emulator.wtf/releases/") { + content { includeGroup("wtf.emulator") } + } + google() + mavenCentral() + } +} + +pluginManagement { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +}