Skip to content
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

[Adaptive] Migrate gradle module til Kotlin DSL #1579

Merged
merged 3 commits into from
Apr 27, 2023
Merged
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
132 changes: 0 additions & 132 deletions adaptive/build.gradle

This file was deleted.

133 changes: 133 additions & 0 deletions adaptive/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not quite sure about this, should this be set to the build folder maybe? 🤔

// 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)
}
18 changes: 15 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" }
Expand All @@ -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"

Expand All @@ -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" }
Expand Down Expand Up @@ -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"}