mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 03:17:03 +05:30
Merge #68
68: Convert Gradle build configuration to Kotlin r=msfjarvis a=msfjarvis First steps toward #67 bors r+ Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
commit
10630944d3
19 changed files with 514 additions and 230 deletions
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
|
@ -12,6 +12,7 @@
|
|||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/buildSrc" />
|
||||
<option value="$PROJECT_DIR$/lobsters-api" />
|
||||
<option value="$PROJECT_DIR$/model" />
|
||||
</set>
|
||||
|
|
110
app/build.gradle
110
app/build.gradle
|
@ -1,110 +0,0 @@
|
|||
plugins {
|
||||
id "kotlin-kapt"
|
||||
id "dagger.hilt.android.plugin"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
final def keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||
android {
|
||||
adbOptions {
|
||||
installOptions = ["--user 0"]
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "dev.msfjarvis.lobsters"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro"
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions.coreLibraryDesugaringEnabled = true
|
||||
|
||||
buildFeatures.compose = true
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerVersion "${kotlin_version}"
|
||||
kotlinCompilerExtensionVersion "${compose_version}"
|
||||
}
|
||||
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
final def keystoreProperties = new Properties()
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias keystoreProperties["keyAlias"]
|
||||
keyPassword keystoreProperties["keyPassword"]
|
||||
storeFile rootProject.file(keystoreProperties["storeFile"])
|
||||
storePassword keystoreProperties["storePassword"]
|
||||
}
|
||||
}
|
||||
buildTypes.debug.signingConfig = signingConfigs.release
|
||||
buildTypes.release.signingConfig = signingConfigs.release
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += [
|
||||
"-Xallow-jvm-ir-dependencies",
|
||||
"-Xskip-prerelease-check",
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-Xopt-in=androidx.compose.material.ExperimentalMaterialApi",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
kapt "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$roomigrant_version"
|
||||
kapt "com.google.dagger:hilt-compiler:$hilt_dagger_version"
|
||||
kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version"
|
||||
kapt "androidx.room:room-compiler:$room_version"
|
||||
implementation(project(":lobsters-api"))
|
||||
implementation(project(":model"))
|
||||
implementation "androidx.core:core-ktx:$core_version"
|
||||
implementation "androidx.activity:activity-ktx:$activity_version"
|
||||
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
||||
implementation "androidx.browser:browser:$browser_version"
|
||||
implementation "androidx.compose.foundation:foundation:$compose_version"
|
||||
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
|
||||
implementation "androidx.compose.foundation:foundation-text:$compose_version"
|
||||
implementation "androidx.compose.runtime:runtime:$compose_version"
|
||||
implementation "androidx.compose.material:material:$compose_version"
|
||||
implementation "androidx.compose.compiler:compiler:$compose_version"
|
||||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-text:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-text-android:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-unit:$compose_version"
|
||||
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
implementation "androidx.navigation:navigation-compose:$nav_compose_version"
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
implementation "androidx.room:room-ktx:$room_version"
|
||||
implementation "androidx.ui:ui-tooling:$compose_version"
|
||||
implementation "com.github.MatrixDev.Roomigrant:RoomigrantLib:$roomigrant_version"
|
||||
implementation "com.google.android.material:material:$material_version"
|
||||
implementation "com.google.dagger:hilt-android:$hilt_dagger_version"
|
||||
implementation "com.squareup.moshi:moshi:$moshi_version"
|
||||
implementation "dev.chrisbanes.accompanist:accompanist-coil:$accompanist_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
implementation "saschpe.android:customtabs:$customtabs_version"
|
||||
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_dagger_version"
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
androidTestImplementation "androidx.ui:ui-test:$compose_version"
|
||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_version"
|
||||
}
|
100
app/build.gradle.kts
Normal file
100
app/build.gradle.kts
Normal file
|
@ -0,0 +1,100 @@
|
|||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
kotlin("android")
|
||||
kotlin("kapt")
|
||||
id("dagger.hilt.android.plugin")
|
||||
`lobsters-plugin`
|
||||
`core-library-desugaring`
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { setUrl("https://jitpack.io") }
|
||||
}
|
||||
|
||||
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||
|
||||
android {
|
||||
adbOptions.installOptions("--user 0")
|
||||
defaultConfig {
|
||||
applicationId = "dev.msfjarvis.lobsters"
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions.annotationProcessorOptions {
|
||||
argument("room.schemaLocation", "${projectDir}/schemas")
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
named("release") {
|
||||
isMinifyEnabled = true
|
||||
setProguardFiles(listOf("proguard-android-optimize.txt", "proguard-rules.pro"))
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures.compose = true
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerVersion = "1.4.10"
|
||||
kotlinCompilerExtensionVersion = Dependencies.COMPOSE_VERSION
|
||||
}
|
||||
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
val keystoreProperties = Properties()
|
||||
keystoreProperties.load(keystorePropertiesFile.inputStream())
|
||||
signingConfigs {
|
||||
register("release") {
|
||||
keyAlias = keystoreProperties["keyAlias"] as String
|
||||
keyPassword = keystoreProperties["keyPassword"] as String
|
||||
storeFile = rootProject.file(keystoreProperties["storeFile"] as String)
|
||||
storePassword = keystoreProperties["storePassword"] as String
|
||||
}
|
||||
}
|
||||
listOf("release", "debug").map {
|
||||
buildTypes.getByName(it).signingConfig = signingConfigs.getByName(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
kapt(Dependencies.ThirdParty.Roomigrant.compiler)
|
||||
kapt(Dependencies.AndroidX.Hilt.daggerCompiler)
|
||||
kapt(Dependencies.AndroidX.Hilt.daggerHiltCompiler)
|
||||
kapt(Dependencies.AndroidX.Room.compiler)
|
||||
implementation(project(":lobsters-api"))
|
||||
implementation(project(":model"))
|
||||
implementation(Dependencies.AndroidX.coreKtx)
|
||||
implementation(Dependencies.AndroidX.activityKtx)
|
||||
implementation(Dependencies.AndroidX.appCompat)
|
||||
implementation(Dependencies.AndroidX.browser)
|
||||
implementation(Dependencies.AndroidX.Compose.foundation)
|
||||
implementation(Dependencies.AndroidX.Compose.foundationLayout)
|
||||
implementation(Dependencies.AndroidX.Compose.foundationText)
|
||||
implementation(Dependencies.AndroidX.Compose.runtime)
|
||||
implementation(Dependencies.AndroidX.Compose.material)
|
||||
implementation(Dependencies.AndroidX.Compose.compiler)
|
||||
implementation(Dependencies.AndroidX.Compose.ui)
|
||||
implementation(Dependencies.AndroidX.Compose.uiTooling)
|
||||
implementation(Dependencies.AndroidX.Compose.uiText)
|
||||
implementation(Dependencies.AndroidX.Compose.uiTextAndroid)
|
||||
implementation(Dependencies.AndroidX.Compose.uiUnit)
|
||||
implementation(Dependencies.AndroidX.Hilt.hiltLifecycleViewmodel)
|
||||
implementation(Dependencies.AndroidX.Lifecycle.runtimeKtx)
|
||||
implementation(Dependencies.AndroidX.Lifecycle.viewmodelKtx)
|
||||
implementation(Dependencies.AndroidX.Compose.navigation)
|
||||
implementation(Dependencies.AndroidX.Room.runtime)
|
||||
implementation(Dependencies.AndroidX.Room.ktx)
|
||||
implementation(Dependencies.ThirdParty.Roomigrant.runtime)
|
||||
implementation(Dependencies.AndroidX.material)
|
||||
implementation(Dependencies.AndroidX.Hilt.dagger)
|
||||
implementation(Dependencies.ThirdParty.Moshi.lib)
|
||||
implementation(Dependencies.ThirdParty.accompanist)
|
||||
implementation(Dependencies.Kotlin.Coroutines.android)
|
||||
implementation(Dependencies.ThirdParty.customtabs)
|
||||
androidTestImplementation(Dependencies.Testing.daggerHilt)
|
||||
testImplementation(Dependencies.Testing.junit)
|
||||
androidTestImplementation(Dependencies.Testing.uiTest)
|
||||
}
|
98
build.gradle
98
build.gradle
|
@ -1,98 +0,0 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext {
|
||||
accompanist_version = "0.3.2"
|
||||
activity_version = "1.2.0-beta01"
|
||||
agp_version = "4.2.0-alpha15"
|
||||
appcompat_version = "1.3.0-alpha02"
|
||||
browser_version = "1.3.0-beta01"
|
||||
compose_version = "1.0.0-alpha06"
|
||||
core_version = "1.5.0-alpha04"
|
||||
coroutines_version = "1.4.0"
|
||||
customtabs_version = "3.0.2"
|
||||
dagger_version = "2.29.1"
|
||||
desugar_version = "1.0.10"
|
||||
hilt_androidx_version = "1.0.0-alpha02"
|
||||
hilt_dagger_version = "2.29.1-alpha"
|
||||
junit_version = "4.13.1"
|
||||
kotlin_version = "1.4.10"
|
||||
lifecycle_version = "2.3.0-beta01"
|
||||
material_version = "1.3.0-alpha03"
|
||||
moshi_version = "1.11.0"
|
||||
nav_compose_version = "1.0.0-alpha01"
|
||||
okhttp_version = "3.14.9"
|
||||
retrofit_version = "2.9.0"
|
||||
room_version = "2.3.0-alpha03"
|
||||
roomigrant_version = "0.2.0"
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$agp_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_dagger_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.github.ben-manes.versions") version "0.33.0"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
if (name == "app") {
|
||||
apply plugin: "com.android.application"
|
||||
} else {
|
||||
apply plugin: "com.android.library"
|
||||
}
|
||||
apply plugin: "kotlin-android"
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
force "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
||||
force "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
}
|
||||
}
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
tasks {
|
||||
wrapper {
|
||||
gradleVersion = "6.7"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
}
|
18
build.gradle.kts
Normal file
18
build.gradle.kts
Normal file
|
@ -0,0 +1,18 @@
|
|||
buildscript {
|
||||
apply(from = "buildSrc/buildDependencies.gradle")
|
||||
val build: Map<Any, Any> by extra
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath(build.getValue("androidGradlePlugin"))
|
||||
classpath(build.getValue("daggerGradlePlugin"))
|
||||
classpath(build.getValue("kotlinGradlePlugin"))
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.github.ben-manes.versions") version "0.34.0"
|
||||
`lobsters-plugin`
|
||||
}
|
1
buildSrc/.gitignore
vendored
Normal file
1
buildSrc/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
34
buildSrc/build.gradle.kts
Normal file
34
buildSrc/build.gradle.kts
Normal file
|
@ -0,0 +1,34 @@
|
|||
apply(from = "buildDependencies.gradle")
|
||||
val build: Map<Any, Any> by extra
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
kotlinDslPluginOptions {
|
||||
experimentalWarning.set(false)
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
register("lobsters") {
|
||||
id = "lobsters-plugin"
|
||||
implementationClass = "LobstersPlugin"
|
||||
}
|
||||
register("coreLibraryDesugaring") {
|
||||
id = "core-library-desugaring"
|
||||
implementationClass = "CoreLibraryDesugaringPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(build.getValue("kotlinGradlePlugin"))
|
||||
implementation(build.getValue("daggerGradlePlugin"))
|
||||
implementation(build.getValue("androidGradlePlugin"))
|
||||
}
|
11
buildSrc/buildDependencies.gradle
Normal file
11
buildSrc/buildDependencies.gradle
Normal file
|
@ -0,0 +1,11 @@
|
|||
rootProject.ext.versions = [
|
||||
agp: '4.2.0-alpha16',
|
||||
daggerHilt: '2.29.1-alpha',
|
||||
kotlin: '1.4.10',
|
||||
]
|
||||
|
||||
rootProject.ext.build = [
|
||||
androidGradlePlugin: "com.android.tools.build:gradle:${versions.agp}",
|
||||
daggerGradlePlugin: "com.google.dagger:hilt-android-gradle-plugin:${versions.daggerHilt}",
|
||||
kotlinGradlePlugin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
|
||||
]
|
98
buildSrc/src/main/java/BaseProjectConfig.kt
Normal file
98
buildSrc/src/main/java/BaseProjectConfig.kt
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
import com.android.build.gradle.TestedExtension
|
||||
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Delete
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
import org.gradle.api.tasks.wrapper.Wrapper
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
/**
|
||||
* Configure root project.
|
||||
* Note that classpath dependencies still need to be defined in the `buildscript` block in the top-level build.gradle.kts file.
|
||||
*/
|
||||
internal fun Project.configureForRootProject() {
|
||||
// register task for cleaning the build directory in the root project
|
||||
tasks.register("clean", Delete::class.java) {
|
||||
delete(rootProject.buildDir)
|
||||
}
|
||||
tasks.withType<Wrapper> {
|
||||
gradleVersion = "6.7"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
distributionSha256Sum = "0080de8491f0918e4f529a6db6820fa0b9e818ee2386117f4394f95feb1d5583"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure all projects including the root project
|
||||
*/
|
||||
internal fun Project.configureForAllProjects() {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { setUrl("https://jitpack.io") }
|
||||
}
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
freeCompilerArgs = freeCompilerArgs + additionalCompilerArgs
|
||||
languageVersion = "1.4"
|
||||
}
|
||||
}
|
||||
tasks.withType<Test> {
|
||||
maxParallelForks = Runtime.getRuntime().availableProcessors() * 2
|
||||
testLogging {
|
||||
events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Apply configuration options for Android Application projects.
|
||||
*/
|
||||
@Suppress("UnstableApiUsage")
|
||||
internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: Project) {
|
||||
project.tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = freeCompilerArgs + listOf(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-Xopt-in=androidx.compose.material.ExperimentalMaterialApi"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply baseline configurations for all Android projects (Application and Library).
|
||||
*/
|
||||
@Suppress("UnstableApiUsage")
|
||||
internal fun TestedExtension.configureCommonAndroidOptions() {
|
||||
compileSdkVersion(30)
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion(23)
|
||||
targetSdkVersion(30)
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude("**/*.version")
|
||||
exclude("**/*.txt")
|
||||
exclude("**/*.kotlin_module")
|
||||
exclude("**/plugin.properties")
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
testOptions.animationsDisabled = true
|
||||
}
|
34
buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt
Normal file
34
buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt
Normal file
|
@ -0,0 +1,34 @@
|
|||
import com.android.build.gradle.AppPlugin
|
||||
import com.android.build.gradle.LibraryPlugin
|
||||
import com.android.build.gradle.TestedExtension
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
/**
|
||||
* A plugin that enables Java 8 desugaring for consuming new Java language APIs.
|
||||
*
|
||||
* Apply this plugin to the build.gradle.kts file in Android Application or Android Library projects:
|
||||
* ```
|
||||
* plugins {
|
||||
* `core-library-desugaring`
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class CoreLibraryDesugaringPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.plugins.withType<AppPlugin> {
|
||||
project.extensions.getByType<TestedExtension>().configure(project)
|
||||
}
|
||||
|
||||
project.plugins.withType<LibraryPlugin> {
|
||||
project.extensions.getByType<TestedExtension>().configure(project)
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestedExtension.configure(project: Project) {
|
||||
compileOptions.isCoreLibraryDesugaringEnabled = true
|
||||
project.dependencies.add("coreLibraryDesugaring", Dependencies.AndroidX.coreLibraryDesugaring)
|
||||
}
|
||||
}
|
111
buildSrc/src/main/java/Dependencies.kt
Normal file
111
buildSrc/src/main/java/Dependencies.kt
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
private const val ANDROIDX_HILT_VERSION = "1.0.0-alpha02"
|
||||
private const val DAGGER_HILT_VERSION = "2.29.1-alpha"
|
||||
|
||||
object Dependencies {
|
||||
const val COMPOSE_VERSION = "1.0.0-alpha06"
|
||||
object Kotlin {
|
||||
object Coroutines {
|
||||
|
||||
private const val version = "1.4.1"
|
||||
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
|
||||
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
|
||||
}
|
||||
}
|
||||
|
||||
object AndroidX {
|
||||
|
||||
const val activityKtx = "androidx.activity:activity-ktx:1.2.0-beta01"
|
||||
const val appCompat = "androidx.appcompat:appcompat:1.3.0-alpha02"
|
||||
const val browser = "androidx.browser:browser:1.3.0-beta01"
|
||||
const val coreKtx = "androidx.core:core-ktx:1.5.0-alpha04"
|
||||
const val coreLibraryDesugaring = "com.android.tools:desugar_jdk_libs:1.0.10"
|
||||
const val material = "com.google.android.material:material:1.3.0-alpha03"
|
||||
|
||||
object Compose {
|
||||
|
||||
const val compiler = "androidx.compose.compiler:compiler:$COMPOSE_VERSION"
|
||||
const val foundation = "androidx.compose.foundation:foundation:$COMPOSE_VERSION"
|
||||
const val foundationLayout = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION"
|
||||
const val foundationText = "androidx.compose.foundation:foundation-text:$COMPOSE_VERSION"
|
||||
const val material = "androidx.compose.material:material:$COMPOSE_VERSION"
|
||||
const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha01"
|
||||
const val runtime = "androidx.compose.runtime:runtime:$COMPOSE_VERSION"
|
||||
const val ui = "androidx.compose.ui:ui:$COMPOSE_VERSION"
|
||||
const val uiText = "androidx.compose.ui:ui-text:$COMPOSE_VERSION"
|
||||
const val uiTextAndroid = "androidx.compose.ui:ui-text-android:$COMPOSE_VERSION"
|
||||
const val uiUnit = "androidx.compose.ui:ui-unit:$COMPOSE_VERSION"
|
||||
const val uiTooling = "androidx.ui:ui-tooling:$COMPOSE_VERSION"
|
||||
}
|
||||
|
||||
object Hilt {
|
||||
const val dagger = "com.google.dagger:hilt-android:$DAGGER_HILT_VERSION"
|
||||
const val daggerCompiler = "com.google.dagger:hilt-compiler:$DAGGER_HILT_VERSION"
|
||||
const val daggerHiltCompiler = "androidx.hilt:hilt-compiler:$ANDROIDX_HILT_VERSION"
|
||||
const val hiltLifecycleViewmodel =
|
||||
"androidx.hilt:hilt-lifecycle-viewmodel:$ANDROIDX_HILT_VERSION"
|
||||
}
|
||||
|
||||
object Lifecycle {
|
||||
|
||||
private const val version = "2.3.0-beta01"
|
||||
const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version"
|
||||
const val viewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
|
||||
}
|
||||
|
||||
object Room {
|
||||
|
||||
private const val version = "2.3.0-alpha03"
|
||||
const val compiler = "androidx.room:room-compiler:$version"
|
||||
const val ktx = "androidx.room:room-ktx:$version"
|
||||
const val runtime = "androidx.room:room-runtime:$version"
|
||||
}
|
||||
}
|
||||
|
||||
object ThirdParty {
|
||||
|
||||
const val accompanist = "dev.chrisbanes.accompanist:accompanist-coil:0.3.2"
|
||||
const val customtabs = "saschpe.android:customtabs:3.0.2"
|
||||
|
||||
object Moshi {
|
||||
|
||||
private const val version = "1.11.0"
|
||||
const val codegen = "com.squareup.moshi:moshi-kotlin-codegen:$version"
|
||||
const val lib = "com.squareup.moshi:moshi:$version"
|
||||
}
|
||||
|
||||
object Retrofit {
|
||||
|
||||
private const val version = "2.9.0"
|
||||
const val lib = "com.squareup.retrofit2:retrofit:$version"
|
||||
const val moshi = "com.squareup.retrofit2:converter-moshi:$version"
|
||||
}
|
||||
|
||||
object Roomigrant {
|
||||
|
||||
private const val version = "0.2.0"
|
||||
const val compiler = "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$version"
|
||||
const val runtime = "com.github.MatrixDev.Roomigrant:RoomigrantLib:$version"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object Testing {
|
||||
|
||||
const val daggerHilt = "com.google.dagger:hilt-android-testing:$DAGGER_HILT_VERSION"
|
||||
const val junit = "junit:junit:4.13.1"
|
||||
const val mockWebServer = "com.squareup.okhttp3:mockwebserver:3.14.9"
|
||||
const val uiTest = "androidx.ui:ui-test:$COMPOSE_VERSION"
|
||||
|
||||
object AndroidX {
|
||||
|
||||
private const val version = "1.3.1-alpha02"
|
||||
const val runner = "androidx.test:runner:$version"
|
||||
const val rules = "androidx.test:rules:$version"
|
||||
}
|
||||
}
|
||||
}
|
17
buildSrc/src/main/java/KaptConfigs.kt
Normal file
17
buildSrc/src/main/java/KaptConfigs.kt
Normal file
|
@ -0,0 +1,17 @@
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.jetbrains.kotlin.gradle.plugin.KaptExtension
|
||||
|
||||
/**
|
||||
* Apply default kapt configs to the [Project].
|
||||
*/
|
||||
internal fun Project.configureKapt() {
|
||||
extensions.configure<KaptExtension> {
|
||||
javacOptions {
|
||||
option("-Adagger.fastInit=enabled")
|
||||
option("-Adagger.experimentalDaggerErrorMessages=enabled")
|
||||
option("-Xmaxerrs", 500)
|
||||
option("-Adagger.moduleBindingValidation=ERROR")
|
||||
}
|
||||
}
|
||||
}
|
9
buildSrc/src/main/java/KotlinCompilerArgs.kt
Normal file
9
buildSrc/src/main/java/KotlinCompilerArgs.kt
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
internal val additionalCompilerArgs = listOf(
|
||||
"-Xallow-jvm-ir-dependencies",
|
||||
"-Xskip-prerelease-check"
|
||||
)
|
52
buildSrc/src/main/java/LobstersPlugin.kt
Normal file
52
buildSrc/src/main/java/LobstersPlugin.kt
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
import com.android.build.gradle.TestedExtension
|
||||
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||
import com.android.build.gradle.internal.plugins.AppPlugin
|
||||
import com.android.build.gradle.internal.plugins.LibraryPlugin
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaLibraryPlugin
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin
|
||||
|
||||
class LobstersPlugin : Plugin<Project> {
|
||||
|
||||
override fun apply(project: Project) {
|
||||
project.configureForAllProjects()
|
||||
|
||||
if (project.isRoot) {
|
||||
project.configureForRootProject()
|
||||
}
|
||||
|
||||
project.plugins.all {
|
||||
when (this) {
|
||||
is JavaPlugin,
|
||||
is JavaLibraryPlugin -> {
|
||||
project.tasks.withType<JavaCompile> {
|
||||
options.compilerArgs.add("-Xlint:unchecked")
|
||||
options.isDeprecation = true
|
||||
}
|
||||
}
|
||||
is LibraryPlugin -> {
|
||||
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
||||
}
|
||||
is AppPlugin -> {
|
||||
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
||||
project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project)
|
||||
}
|
||||
is Kapt3GradleSubplugin -> {
|
||||
project.configureKapt()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val Project.isRoot get() = this == this.rootProject
|
1
gradle/wrapper/gradle-wrapper.properties
vendored
1
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=0080de8491f0918e4f529a6db6820fa0b9e818ee2386117f4394f95feb1d5583
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
plugins {
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":model")
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
||||
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
|
||||
kaptTest "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
||||
//noinspection GradleDependency
|
||||
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
|
||||
}
|
16
lobsters-api/build.gradle.kts
Normal file
16
lobsters-api/build.gradle.kts
Normal file
|
@ -0,0 +1,16 @@
|
|||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
kotlin("kapt")
|
||||
`lobsters-plugin`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":model"))
|
||||
implementation(Dependencies.ThirdParty.Retrofit.lib)
|
||||
implementation(Dependencies.ThirdParty.Retrofit.moshi)
|
||||
kaptTest(Dependencies.ThirdParty.Moshi.codegen)
|
||||
testImplementation(Dependencies.Testing.junit)
|
||||
testImplementation(Dependencies.Kotlin.Coroutines.core)
|
||||
testImplementation(Dependencies.Testing.mockWebServer)
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
plugins {
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
|
||||
implementation "com.squareup.moshi:moshi:$moshi_version"
|
||||
}
|
11
model/build.gradle.kts
Normal file
11
model/build.gradle.kts
Normal file
|
@ -0,0 +1,11 @@
|
|||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
kotlin("kapt")
|
||||
`lobsters-plugin`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
kapt(Dependencies.ThirdParty.Moshi.codegen)
|
||||
implementation(Dependencies.ThirdParty.Moshi.lib)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue