diff --git a/adaptive/build.gradle b/adaptive/build.gradle deleted file mode 100644 index 981f66236..000000000 --- a/adaptive/build.gradle +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'org.jetbrains.dokka' - id 'me.tylerbwong.gradle.metalava' -} - -kotlin { - explicitApi() -} - -android { - namespace "com.google.accompanist.adaptive" - - compileSdkVersion 33 - - defaultConfig { - minSdkVersion 21 - // targetSdkVersion has no effect for libraries. This is only used for the test APK - targetSdkVersion 33 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - buildFeatures { - buildConfig false - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() - } - - lintOptions { - textReport true - textOutput 'stdout' - // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks - checkReleaseBuilds false - } - - packagingOptions { - // Some of the META-INF files conflict with coroutines-test. Exclude them to enable - // our test APK to build (has no effect on our AARs) - excludes += "/META-INF/AL2.0" - excludes += "/META-INF/LGPL2.1" - } - - testOptions { - unitTests { - includeAndroidResources = true - } - animationsDisabled true - } - - sourceSets { - test { - java.srcDirs += 'src/sharedTest/kotlin' - res.srcDirs += 'src/sharedTest/res' - } - androidTest { - java.srcDirs += 'src/sharedTest/kotlin' - res.srcDirs += 'src/sharedTest/res' - } - } -} - -metalava { - sourcePaths.setFrom("src/main") - filename.set("api/current.api") - reportLintsAsErrors.set(true) -} - -dependencies { - api libs.compose.foundation.foundation - api libs.compose.ui.ui - api libs.androidx.window - - implementation libs.napier - implementation libs.kotlin.coroutines.android - - // ====================== - // Test dependencies - // ====================== - - androidTestImplementation project(':internal-testutils') - testImplementation project(':internal-testutils') - - androidTestImplementation project(':testharness') - testImplementation project(':testharness') - - androidTestImplementation libs.junit - testImplementation libs.junit - - androidTestImplementation libs.truth - testImplementation libs.truth - - androidTestImplementation libs.compose.ui.test.junit4 - testImplementation libs.compose.ui.test.junit4 - - androidTestImplementation libs.compose.ui.test.manifest - testImplementation libs.compose.ui.test.manifest - - androidTestImplementation libs.androidx.test.runner - testImplementation libs.androidx.test.runner - - androidTestImplementation libs.androidx.window.testing - testImplementation libs.androidx.window.testing - - testImplementation libs.robolectric -} - -apply plugin: "com.vanniktech.maven.publish" diff --git a/adaptive/build.gradle.kts b/adaptive/build.gradle.kts new file mode 100644 index 000000000..0b8181c87 --- /dev/null +++ b/adaptive/build.gradle.kts @@ -0,0 +1,133 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@file:Suppress("UnstableApiUsage") + +plugins { + id(libs.plugins.android.library.get().pluginId) + id(libs.plugins.android.kotlin.get().pluginId) + id(libs.plugins.jetbrains.dokka.get().pluginId) + id(libs.plugins.gradle.metalava.get().pluginId) + id(libs.plugins.vanniktech.maven.publish.get().pluginId) +} + +kotlin { + explicitApi() +} + +android { + namespace = "com.google.accompanist.adaptive" + + compileSdk = 33 + + defaultConfig { + minSdk = 21 + // targetSdkVersion has no effect for libraries. This is only used for the test APK + targetSdk = 33 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + buildFeatures { + buildConfig = false + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + } + + lint { + textReport = true + textOutput = File("stdout") + // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks + checkReleaseBuilds = false + } + + packagingOptions { + // Some of the META-INF files conflict with coroutines-test. Exclude them to enable + // our test APK to build (has no effect on our AARs) + resources { + excludes += listOf("/META-INF/AL2.0", "/META-INF/LGPL2.1") + } + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + } + animationsDisabled = true + } + + sourceSets { + named("test") { + java.srcDirs("src/sharedTest/kotlin") + res.srcDirs("src/sharedTest/res") + } + named("androidTest") { + java.srcDirs("src/sharedTest/kotlin") + res.srcDirs("src/sharedTest/res") + } + } +} + +metalava { + sourcePaths.setFrom("src/main") + filename.set("api/current.api") + reportLintsAsErrors.set(true) +} + +dependencies { + api(libs.compose.foundation.foundation) + api(libs.compose.ui.ui) + api(libs.androidx.window) + + implementation(libs.napier) + implementation(libs.kotlin.coroutines.android) + + // ====================== + // Test dependencies + // ====================== + + androidTestImplementation(project(":internal-testutils")) + testImplementation(project(":internal-testutils")) + + androidTestImplementation(project(":testharness")) + testImplementation(project(":testharness")) + + androidTestImplementation(libs.junit) + testImplementation(libs.junit) + + androidTestImplementation(libs.truth) + testImplementation(libs.truth) + + androidTestImplementation(libs.compose.ui.test.junit4) + testImplementation(libs.compose.ui.test.junit4) + + androidTestImplementation(libs.compose.ui.test.manifest) + testImplementation(libs.compose.ui.test.manifest) + + androidTestImplementation(libs.androidx.test.runner) + testImplementation(libs.androidx.test.runner) + + androidTestImplementation(libs.androidx.window.testing) + testImplementation(libs.androidx.window.testing) + + testImplementation(libs.robolectric) +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ccf86d8fe..9a482aaaa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,8 @@ composeCompiler = "1.4.3" composeMaterial3 = "1.0.1" composesnapshot = "-" # a single character = no snapshot +dokka = "1.5.0" + # gradlePlugin and lint need to be updated together gradlePlugin = "7.4.1" lintMinCompose = "30.0.0" @@ -19,6 +21,9 @@ androidxtest = "1.4.0" androidxnavigation = "2.6.0-alpha08" androidxWindow = "1.0.0" +metalava = "0.3.2" +vanniktechPublish = "0.17.0" + [libraries] compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } compose-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" } @@ -36,8 +41,8 @@ compose-animation-animation = { module = "androidx.compose.animation:animation", snapper = "dev.chrisbanes.snapper:snapper:0.2.2" android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin" } -gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.17.0" -metalavaGradle = "me.tylerbwong.gradle.metalava:plugin:0.3.2" +gradleMavenPublishPlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "vanniktechPublish" } +metalavaGradle = { module = "me.tylerbwong.gradle.metalava:plugin", version.ref = "metalava" } glide = "com.github.bumptech.glide:glide:4.12.0" @@ -50,7 +55,7 @@ kotlin-metadataJvm = "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.3.0" kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } -dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0" +dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } okhttp-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okhttp-mockWebServer = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } @@ -99,3 +104,10 @@ android-tools-lint-api = { module = "com.android.tools.lint:lint-api", version.r android-tools-lint-tests = { module = "com.android.tools.lint:lint-tests", version.ref = "lintMinCompose" } squareup-mockwebserver = "com.squareup.okhttp3:mockwebserver:4.9.3" + +[plugins] +android-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +android-library = { id = "com.android.library", version.ref = "gradlePlugin" } +jetbrains-dokka = {id = "org.jetbrains.dokka", version.ref = "dokka" } +gradle-metalava = {id = "me.tylerbwong.gradle.metalava", version.ref = "metalava" } +vanniktech-maven-publish = {id = "com.vanniktech.maven.publish", version.ref = "vanniktechPublish"} \ No newline at end of file