diff --git a/build.gradle b/build.gradle deleted file mode 100644 index f523b842b..000000000 --- a/build.gradle +++ /dev/null @@ -1,91 +0,0 @@ -apply from: 'dependencies.gradle' -apply plugin: "com.github.ben-manes.versions" - -buildscript { - ext { - kotlinVersion = '1.5.21' - - versions = [:] - libraries = [:] - constants = [ - minSdk : 21, - targetSdk : 30, - compileSdk : 30 - ] - } - - repositories { - google() - mavenCentral() - maven { url 'https://jitpack.io' } - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.0.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0" - classpath "com.github.ben-manes:gradle-versions-plugin:0.38.0" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.32" - classpath "org.jetbrains.dokka:android-documentation-plugin:1.4.32" - classpath "com.vanniktech:gradle-maven-publish-plugin:0.14.2" - } -} - -apply plugin: "org.jetbrains.dokka" - -allprojects { - repositories { - google() - mavenCentral() - } - - tasks.withType(org.jetbrains.dokka.gradle.DokkaTaskPartial).configureEach { - dokkaSourceSets.named("main") { - configuration { - jdkVersion.set(8) - skipDeprecated.set(true) - skipEmptyPackages.set(true) - reportUndocumented.set(false) - } - } - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -apply plugin: "com.vanniktech.android.junit.jacoco" -junitJacoco { - // WARNING! Don't upgrade unless https://github.com/Malinskiy/danger-jacoco/issues/10 is fixed - jacocoVersion = '0.8.2' - excludes = [ - // Defaults - '**/androidx/**/*.*', - '**/*$$*', - '**/BuildConfig.*', - '**/Manifest*.*', - '**/*$Lambda$*.*', // Jacoco can not handle several "$" in class name. - '**/*$inlined$*.*', // Kotlin specific, Jacoco can not handle several "$" in class name. - '**/com/instacart/formula/test/**/*.*' - ] - ignoreProjects = [ - "samples/*" - ] - includeNoLocationClasses = true - includeInstrumentationCoverageInMergedReport = true -} - -apply from: 'gradle/merge-reports.gradle' - -tasks.register("install") { - def publishTasks = [] - project.subprojects.forEach { project -> - def installTask = project.tasks.findByName("install") ?: project.tasks.findByName("publishToMavenLocal") - if (installTask != null) { - publishTasks.add(installTask) - } - } - dependsOn publishTasks -} - diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..aaa8d002b --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,55 @@ +buildscript { + + repositories { + google() + mavenCentral() + maven(url = "https://jitpack.io") + } + + dependencies { + classpath(libs.android.gradle) + classpath(libs.kotlin.gradle) + classpath(libs.jacoco.gradle) + classpath(libs.version.gradle) + classpath(libs.dokka.gradle) + classpath(libs.dokka.android.gradle) + classpath(libs.maven.publish.gradle) + } +} + +apply(plugin = "com.github.ben-manes.versions") +apply(plugin = "org.jetbrains.dokka") +apply(from = "gradle/jacoco.gradle") +apply(from = "gradle/merge-reports.gradle") + +allprojects { + repositories { + google() + mavenCentral() + } + + tasks.withType().configureEach { + dokkaSourceSets.named("main") { + jdkVersion.set(8) + skipDeprecated.set(true) + skipEmptyPackages.set(true) + reportUndocumented.set(false) + } + } +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} + +tasks.register("install") { + val publishTasks = mutableListOf() + project.subprojects.forEach { project -> + val installTask = project.tasks.findByName("install") ?: project.tasks.findByName("publishToMavenLocal") + if (installTask != null) { + publishTasks.add(installTask) + } + } + dependsOn(publishTasks) +} + diff --git a/dependencies.gradle b/dependencies.gradle deleted file mode 100644 index 8e3513438..000000000 --- a/dependencies.gradle +++ /dev/null @@ -1,90 +0,0 @@ -ext { - androidXVersion = '1.2.0' - androidTestVersion = "1.4.0" - androidJUnitVersion = "1.1.0" - lifecycleVersion = '2.2.0' - lifecycleKtxVersion = '2.4.0-alpha03' - - espressoVersion = "3.4.0" - junitVersion = "4.13.2" - mockitoVersion = "3.12.4" - mockitoKotlinVersion = "1.6.0" - okhttpVersion = "3.13.1" - robolectricVersion = "4.6.1" - truthVersion = "1.1.3" - composeVersion = "1.0.1" - kotlinCoroutinesVersion = "1.5.2" - lintVersion = "30.0.0" - autoServiceVersion = "1.0-rc7" - - libraries = [ - androidx : [ - annotation : "androidx.annotation:annotation:$androidXVersion", - appcompat : "androidx.appcompat:appcompat:1.3.1", - browser : "androidx.browser:browser:$androidXVersion", - core : [ - ktx: "androidx.core:core-ktx:1.6.0" - ], - activity : [ - compose : "androidx.activity:activity-compose:1.3.1", - ktx : "androidx.activity:activity-ktx:1.3.1" - ], - compose : [ - foundation : "androidx.compose.foundation:foundation:$composeVersion", - material : "androidx.compose.material:material:$composeVersion", - rxjava3 : "androidx.compose.runtime:runtime-rxjava3:$composeVersion", - ui : "androidx.compose.ui:ui:$composeVersion", - uiTooling : "androidx.compose.ui:ui-tooling:$composeVersion", - - ], - collection : [ - ktx: "androidx.collection:collection-ktx:$androidXVersion" - ], - constraintlayout: "androidx.constraintlayout:constraintlayout:2.1.0", - lifecycle : [ - runtime : "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion", - extensions: "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion", - runtimektx : "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleKtxVersion", - extensionsktx: "androidx.lifecycle:lifecycle-extensions-ktx:$lifecycleKtxVersion", - ], - recyclerview : "androidx.recyclerview:recyclerview:$androidXVersion", - fragment : [ - ktx: "androidx.fragment:fragment-ktx:1.2.1" - ], - test : [ - core : "androidx.test:core:$androidTestVersion", - espresso: [ - core : "androidx.test.espresso:espresso-core:$espressoVersion", - contrib: "androidx.test.espresso:espresso-contrib:$espressoVersion", - intents: "androidx.test.espresso:espresso-intents:$espressoVersion" - ], - ext : [ - junit: "androidx.test.ext:junit:$androidJUnitVersion" - ], - rules : "androidx.test:rules:$androidTestVersion", - runner : "androidx.test:runner:$androidTestVersion" - ] - ], - auto: [ - service: "com.google.auto.service:auto-service:${autoServiceVersion}", - serviceAnnotations: "com.google.auto.service:auto-service-annotations:${autoServiceVersion}", - ], - junit : "junit:junit:$junitVersion", - kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion", - coroutines : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion", - kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion", - lint: [ - core: "com.android.tools.lint:lint:${lintVersion}", - api: "com.android.tools.lint:lint-api:${lintVersion}", - checks: "com.android.tools.lint:lint-checks:${lintVersion}", - tests: "com.android.tools.lint:lint-tests:${lintVersion}", - ], - robolectric : "org.robolectric:robolectric:$robolectricVersion", - rxjava : "io.reactivex.rxjava3:rxjava:3.1.1", - rxandroid : "io.reactivex.rxjava3:rxandroid:3.0.0", - rxrelays : "com.jakewharton.rxrelay3:rxrelay:3.0.1", - truth : "com.google.truth:truth:$truthVersion", - coroutinesTest : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion" - - ] -} diff --git a/gradle/jacoco.gradle b/gradle/jacoco.gradle new file mode 100644 index 000000000..2eaf7b6a5 --- /dev/null +++ b/gradle/jacoco.gradle @@ -0,0 +1,21 @@ +apply plugin: "com.vanniktech.android.junit.jacoco" + +junitJacoco { + // WARNING! Don"t upgrade unless https://github.com/Malinskiy/danger-jacoco/issues/10 is fixed + jacocoVersion = '0.8.2' + excludes = [ + // Defaults + '**/androidx/**/*.*', + '**/*$$*', + '**/BuildConfig.*', + '**/Manifest*.*', + '**/*$Lambda$*.*', // Jacoco can not handle several "$" in class name. + '**/*$inlined$*.*', // Kotlin specific, Jacoco can not handle several "$" in class name. + '**/com/instacart/formula/test/**/*.*' + ] + ignoreProjects = [ + "samples/*" + ] + includeNoLocationClasses = true + includeInstrumentationCoverageInMergedReport = true +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8dd66fdfe..dee1810cc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,7 @@ [versions] +android-gradle = "7.0.4" +dokka-gradle = "1.4.32" + minSdk = "21" compileSdk = "30" targetSdk = "30" @@ -17,6 +20,14 @@ lint = "30.0.0" autoService = "1.0-rc7" [libraries] +android-gradle = { module = "com.android.tools.build:gradle", version.ref = "android-gradle" } +kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka-gradle" } +dokka-android-gradle = { module = "org.jetbrains.dokka:android-documentation-plugin", version.ref = "dokka-gradle" } +maven-publish-gradle = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.14.2" } +version-gradle = { module = "com.github.ben-manes:gradle-versions-plugin", version = "0.38.0" } +jacoco-gradle = { module = "com.vanniktech:gradle-android-junit-jacoco-plugin", version = "0.16.0" } + kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } diff --git a/settings.gradle.kts b/settings.gradle.kts index aede3a0a8..2046f0c77 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,17 +1,21 @@ enableFeaturePreview("VERSION_CATALOGS") -include(":formula") -include(":formula-android") -include(":formula-android-compose") -include(":formula-android-tests") -include(":formula-lint") -include(":formula-rxjava3") -include(":formula-coroutines") -include(":formula-test") -include(":samples:composition") -include(":samples:counter") -include(":samples:custom-network-state-stream") -include(":samples:stopwatch") -include(":samples:stopwatch-coroutines") -include(":samples:stopwatch-compose") -include(":samples:todoapp") +include( + ":formula", + ":formula-android", + ":formula-android-compose", + ":formula-android-tests", + ":formula-lint", + ":formula-rxjava3", + ":formula-coroutines", + ":formula-test", +) +include( + ":samples:composition", + ":samples:counter", + ":samples:custom-network-state-stream", + ":samples:stopwatch", + ":samples:stopwatch-coroutines", + ":samples:stopwatch-compose", + ":samples:todoapp" +)