mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 12:57:04 +05:30
gradle: migrate to build-logic
This commit is contained in:
parent
4cef244d71
commit
3097eaf82f
26 changed files with 501 additions and 182 deletions
|
@ -1,51 +1,20 @@
|
||||||
@file:OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
|
@file:OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
|
||||||
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
||||||
|
|
||||||
import com.android.build.api.artifact.SingleArtifact
|
|
||||||
import com.android.build.api.variant.BuiltArtifactsLoader
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Paths
|
|
||||||
import java.nio.file.StandardCopyOption
|
|
||||||
import java.util.Properties
|
|
||||||
import org.gradle.api.DefaultTask
|
|
||||||
import org.gradle.api.file.DirectoryProperty
|
|
||||||
import org.gradle.api.provider.Property
|
|
||||||
import org.gradle.api.tasks.CacheableTask
|
|
||||||
import org.gradle.api.tasks.InputFiles
|
|
||||||
import org.gradle.api.tasks.Internal
|
|
||||||
import org.gradle.api.tasks.PathSensitive
|
|
||||||
import org.gradle.api.tasks.PathSensitivity
|
|
||||||
import org.gradle.api.tasks.TaskAction
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
id("dev.msfjarvis.claw.android-application")
|
||||||
alias(libs.plugins.kotlin.android)
|
id("dev.msfjarvis.claw.rename-artifacts")
|
||||||
alias(libs.plugins.kotlin.kapt)
|
id("dev.msfjarvis.claw.kotlin-android")
|
||||||
|
id("dev.msfjarvis.claw.kotlin-kapt")
|
||||||
alias(libs.plugins.compose)
|
alias(libs.plugins.compose)
|
||||||
alias(libs.plugins.hilt)
|
alias(libs.plugins.hilt)
|
||||||
}
|
}
|
||||||
|
|
||||||
@CacheableTask
|
android {
|
||||||
abstract class CollectApksTask : DefaultTask() {
|
defaultConfig {
|
||||||
|
applicationId = "dev.msfjarvis.claw.android"
|
||||||
@get:InputFiles @get:PathSensitive(PathSensitivity.NONE) abstract val apkFolder: DirectoryProperty
|
versionCode = 1
|
||||||
@get:Input abstract val variantName: Property<String>
|
versionName = "1.0"
|
||||||
@get:Internal abstract val builtArtifactsLoader: Property<BuiltArtifactsLoader>
|
|
||||||
@get:OutputDirectory abstract val outputDirectory: DirectoryProperty
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
fun taskAction() {
|
|
||||||
val outputDir = outputDirectory.asFile.get()
|
|
||||||
outputDir.mkdirs()
|
|
||||||
val builtArtifacts =
|
|
||||||
builtArtifactsLoader.get().load(apkFolder.get()) ?: throw RuntimeException("Cannot load APKs")
|
|
||||||
builtArtifacts.elements.forEach { artifact ->
|
|
||||||
Files.copy(
|
|
||||||
Paths.get(artifact.outputFile),
|
|
||||||
outputDir.resolve("Claw-${variantName.get()}-${artifact.versionName}.apk").toPath(),
|
|
||||||
StandardCopyOption.REPLACE_EXISTING,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,55 +40,3 @@ dependencies {
|
||||||
implementation(libs.kotlinx.serialization.json)
|
implementation(libs.kotlinx.serialization.json)
|
||||||
implementation(libs.retrofit.kotlinxSerializationConverter) { isTransitive = false }
|
implementation(libs.retrofit.kotlinxSerializationConverter) { isTransitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdk = 31
|
|
||||||
defaultConfig {
|
|
||||||
applicationId = "dev.msfjarvis.claw.android"
|
|
||||||
minSdk = 23
|
|
||||||
targetSdk = 31
|
|
||||||
versionCode = 1
|
|
||||||
versionName = "1.0"
|
|
||||||
}
|
|
||||||
val keystoreConfigFile = rootProject.layout.projectDirectory.file("keystore.properties")
|
|
||||||
if (keystoreConfigFile.asFile.exists()) {
|
|
||||||
val contents = providers.fileContents(keystoreConfigFile).asText
|
|
||||||
val keystoreProperties = Properties()
|
|
||||||
keystoreProperties.load(contents.get().byteInputStream())
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildTypes.all { signingConfig = signingConfigs.getByName("release") }
|
|
||||||
}
|
|
||||||
buildFeatures { buildConfig = true }
|
|
||||||
buildTypes {
|
|
||||||
named("release") {
|
|
||||||
isMinifyEnabled = false
|
|
||||||
setProguardFiles(listOf("proguard-android-optimize.txt", "proguard-rules.pro"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
dependenciesInfo {
|
|
||||||
includeInBundle = false
|
|
||||||
includeInApk = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
androidComponents {
|
|
||||||
onVariants { variant ->
|
|
||||||
project.tasks.register<CollectApksTask>("collect${variant.name.capitalize()}Apks") {
|
|
||||||
variantName.set(variant.name)
|
|
||||||
apkFolder.set(variant.artifacts.get(SingleArtifact.APK))
|
|
||||||
builtArtifactsLoader.set(variant.artifacts.getBuiltArtifactsLoader())
|
|
||||||
outputDirectory.set(project.layout.projectDirectory.dir("outputs"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
||||||
|
|
||||||
plugins { alias(libs.plugins.kotlin.jvm) }
|
plugins {
|
||||||
|
kotlin("jvm")
|
||||||
|
id("dev.msfjarvis.claw.kotlin-library")
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(projects.model)
|
api(projects.model)
|
||||||
|
|
1
build-logic/.gitignore
vendored
Normal file
1
build-logic/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
24
build-logic/android-plugins/build.gradle.kts
Normal file
24
build-logic/android-plugins/build.gradle.kts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
plugins { `kotlin-dsl` }
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies { implementation(libs.build.agp) }
|
|
@ -0,0 +1,44 @@
|
||||||
|
package artifacts
|
||||||
|
|
||||||
|
import com.android.build.api.variant.BuiltArtifactsLoader
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Paths
|
||||||
|
import java.nio.file.StandardCopyOption
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.CacheableTask
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.InputFiles
|
||||||
|
import org.gradle.api.tasks.Internal
|
||||||
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
|
import org.gradle.api.tasks.PathSensitive
|
||||||
|
import org.gradle.api.tasks.PathSensitivity
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
/** Task to collect APKs in a given [outputDirectory]. */
|
||||||
|
@CacheableTask
|
||||||
|
abstract class CollectApksTask : DefaultTask() {
|
||||||
|
@get:InputFiles @get:PathSensitive(PathSensitivity.NONE) abstract val apkFolder: DirectoryProperty
|
||||||
|
|
||||||
|
@get:Input abstract val variantName: Property<String>
|
||||||
|
|
||||||
|
@get:Internal abstract val builtArtifactsLoader: Property<BuiltArtifactsLoader>
|
||||||
|
|
||||||
|
@get:OutputDirectory abstract val outputDirectory: DirectoryProperty
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun run() {
|
||||||
|
val outputDir = outputDirectory.asFile.get()
|
||||||
|
outputDir.mkdirs()
|
||||||
|
val builtArtifacts =
|
||||||
|
builtArtifactsLoader.get().load(apkFolder.get()) ?: throw RuntimeException("Cannot load APKs")
|
||||||
|
builtArtifacts.elements.forEach { artifact ->
|
||||||
|
Files.copy(
|
||||||
|
Paths.get(artifact.outputFile),
|
||||||
|
outputDir.resolve("Claw-${variantName.get()}-${artifact.versionName}.apk").toPath(),
|
||||||
|
StandardCopyOption.REPLACE_EXISTING,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package artifacts
|
||||||
|
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.StandardCopyOption
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.file.RegularFileProperty
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.InputFile
|
||||||
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
abstract class CollectBundleTask : DefaultTask() {
|
||||||
|
@get:InputFile abstract val bundleFile: RegularFileProperty
|
||||||
|
|
||||||
|
@get:Input abstract val variantName: Property<String>
|
||||||
|
|
||||||
|
@get:Input abstract val versionName: Property<String>
|
||||||
|
|
||||||
|
@get:OutputDirectory abstract val outputDirectory: DirectoryProperty
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun taskAction() {
|
||||||
|
val outputDir = outputDirectory.asFile.get()
|
||||||
|
outputDir.mkdirs()
|
||||||
|
Files.copy(
|
||||||
|
bundleFile.get().asFile.toPath(),
|
||||||
|
outputDir.resolve("Claw-${variantName.get()}-${versionName.get()}.aab").toPath(),
|
||||||
|
StandardCopyOption.REPLACE_EXISTING,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
import signing.configureBuildSigning
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.android.application")
|
||||||
|
id("dev.msfjarvis.claw.android-common")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
adbOptions.installOptions("--user 0")
|
||||||
|
|
||||||
|
dependenciesInfo {
|
||||||
|
includeInBundle = false
|
||||||
|
includeInApk = false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures { buildConfig = true }
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
named("release") {
|
||||||
|
setProguardFiles(
|
||||||
|
listOf(
|
||||||
|
"proguard-android-optimize.txt",
|
||||||
|
"proguard-rules.pro",
|
||||||
|
"proguard-rules-missing-classes.pro",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
named("debug") {
|
||||||
|
applicationIdSuffix = ".debug"
|
||||||
|
versionNameSuffix = "-debug"
|
||||||
|
isMinifyEnabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
project.configureBuildSigning()
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
import com.android.build.gradle.TestedExtension
|
||||||
|
|
||||||
|
extensions.configure<TestedExtension> {
|
||||||
|
setCompileSdkVersion(31)
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 31
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
named("main") { java.srcDirs("src/main/kotlin") }
|
||||||
|
named("test") { java.srcDirs("src/test/kotlin") }
|
||||||
|
named("androidTest") { java.srcDirs("src/androidTest/kotlin") }
|
||||||
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
resources.excludes.add("**/*.version")
|
||||||
|
resources.excludes.add("**/*.txt")
|
||||||
|
resources.excludes.add("**/*.kotlin_module")
|
||||||
|
resources.excludes.add("**/plugin.properties")
|
||||||
|
resources.excludes.add("**/META-INF/AL2.0")
|
||||||
|
resources.excludes.add("**/META-INF/LGPL2.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
testOptions {
|
||||||
|
animationsDisabled = true
|
||||||
|
unitTests.isReturnDefaultValues = true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.android.library")
|
||||||
|
id("dev.msfjarvis.claw.android-common")
|
||||||
|
}
|
||||||
|
|
||||||
|
android { defaultConfig { consumerProguardFiles("consumer-rules.pro") } }
|
|
@ -0,0 +1,22 @@
|
||||||
|
import artifacts.CollectApksTask
|
||||||
|
import artifacts.CollectBundleTask
|
||||||
|
import com.android.build.api.artifact.SingleArtifact
|
||||||
|
|
||||||
|
plugins { id("com.android.application") }
|
||||||
|
|
||||||
|
androidComponents {
|
||||||
|
onVariants { variant ->
|
||||||
|
project.tasks.register<CollectApksTask>("collect${variant.name.capitalize()}Apks") {
|
||||||
|
variantName.set(variant.name)
|
||||||
|
apkFolder.set(variant.artifacts.get(SingleArtifact.APK))
|
||||||
|
builtArtifactsLoader.set(variant.artifacts.getBuiltArtifactsLoader())
|
||||||
|
outputDirectory.set(project.layout.projectDirectory.dir("outputs"))
|
||||||
|
}
|
||||||
|
project.tasks.register<CollectBundleTask>("collect${variant.name.capitalize()}Bundle") {
|
||||||
|
variantName.set(variant.name)
|
||||||
|
versionName.set(android.defaultConfig.versionName)
|
||||||
|
bundleFile.set(variant.artifacts.get(SingleArtifact.BUNDLE))
|
||||||
|
outputDirectory.set(project.layout.projectDirectory.dir("outputs"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package signing
|
||||||
|
|
||||||
|
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||||
|
import java.util.Properties
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.provideDelegate
|
||||||
|
|
||||||
|
private const val KEYSTORE_CONFIG_PATH = "keystore.properties"
|
||||||
|
|
||||||
|
/** Configure signing for all build types. */
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
|
internal fun Project.configureBuildSigning() {
|
||||||
|
val keystoreConfigFile = rootProject.layout.projectDirectory.file(KEYSTORE_CONFIG_PATH)
|
||||||
|
if (keystoreConfigFile.asFile.exists()) {
|
||||||
|
extensions.configure<BaseAppModuleExtension> {
|
||||||
|
val contents = providers.fileContents(keystoreConfigFile).asText
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
keystoreProperties.load(contents.get().byteInputStream())
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val signingConfig = signingConfigs.getByName("release")
|
||||||
|
buildTypes.all { setSigningConfig(signingConfig) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
build-logic/kotlin-plugins/build.gradle.kts
Normal file
31
build-logic/kotlin-plugins/build.gradle.kts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
plugins { `kotlin-dsl` }
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.build.agp)
|
||||||
|
implementation(libs.build.kotlin.gradle)
|
||||||
|
implementation(libs.build.kotlin.serialization)
|
||||||
|
implementation(libs.build.spotless)
|
||||||
|
implementation(libs.build.vcu)
|
||||||
|
implementation(libs.build.versions)
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("android")
|
||||||
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
val additionalCompilerArgs =
|
||||||
|
listOf(
|
||||||
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
|
"-P",
|
||||||
|
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true",
|
||||||
|
)
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions {
|
||||||
|
allWarningsAsErrors = true
|
||||||
|
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||||
|
freeCompilerArgs = freeCompilerArgs + additionalCompilerArgs
|
||||||
|
languageVersion = "1.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
maxParallelForks = Runtime.getRuntime().availableProcessors() * 2
|
||||||
|
testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) }
|
||||||
|
doNotTrackState("We want tests to always run even if Gradle thinks otherwise")
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("android")
|
||||||
|
kotlin("kapt")
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
kapt {
|
||||||
|
javacOptions {
|
||||||
|
if (hasDaggerCompilerDependency()) {
|
||||||
|
// https://dagger.dev/dev-guide/compiler-options#fastinit-mode
|
||||||
|
option("-Adagger.fastInit=enabled")
|
||||||
|
// Enable the better, experimental error messages
|
||||||
|
// https://github.com/google/dagger/commit/0d2505a727b54f47b8677f42dd4fc5c1924e37f5
|
||||||
|
option("-Adagger.experimentalDaggerErrorMessages=enabled")
|
||||||
|
// Share test components for when we start leveraging Hilt for tests
|
||||||
|
// https://github.com/google/dagger/releases/tag/dagger-2.34
|
||||||
|
option("-Adagger.hilt.shareTestComponents=true")
|
||||||
|
// KAPT nests errors causing real issues to be suppressed in CI logs
|
||||||
|
option("-Xmaxerrs", 500)
|
||||||
|
// Enables per-module validation for faster error detection
|
||||||
|
// https://github.com/google/dagger/commit/325b516ac6a53d3fc973d247b5231fafda9870a2
|
||||||
|
option("-Adagger.moduleBindingValidation=ERROR")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// disable kapt tasks for unit tests
|
||||||
|
tasks.matching { it.name.startsWith("kapt") && it.name.endsWith("UnitTestKotlin") }.configureEach {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.hasDaggerCompilerDependency(): Boolean {
|
||||||
|
return configurations.any {
|
||||||
|
it.dependencies.any { dependency -> dependency.name == "hilt-compiler" }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins { id("dev.msfjarvis.claw.kotlin-common") }
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins { id("com.diffplug.spotless") }
|
||||||
|
|
||||||
|
val KTFMT_VERSION = "0.35"
|
||||||
|
|
||||||
|
spotless {
|
||||||
|
kotlin {
|
||||||
|
ktfmt(KTFMT_VERSION).googleStyle()
|
||||||
|
target("**/*.kt")
|
||||||
|
targetExclude("**/build/")
|
||||||
|
}
|
||||||
|
kotlinGradle {
|
||||||
|
ktfmt(KTFMT_VERSION).googleStyle()
|
||||||
|
target("**/*.kts")
|
||||||
|
targetExclude("**/build/")
|
||||||
|
}
|
||||||
|
format("xml") {
|
||||||
|
target("**/*.xml")
|
||||||
|
targetExclude("**/build/", ".idea/")
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
indentWithSpaces()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.github.ben-manes.versions")
|
||||||
|
id("nl.littlerobots.version-catalog-update")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isNonStable(version: String): Boolean {
|
||||||
|
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
|
||||||
|
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
|
||||||
|
val isStable = stableKeyword || regex.matches(version)
|
||||||
|
return isStable.not()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<DependencyUpdatesTask>().configureEach {
|
||||||
|
rejectVersionIf {
|
||||||
|
when (candidate.group) {
|
||||||
|
"com.android.application", "com.android.library" -> true
|
||||||
|
else -> isNonStable(candidate.version) && !isNonStable(currentVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkForGradleUpdate = false
|
||||||
|
checkBuildEnvironmentConstraints = true
|
||||||
|
outputFormatter = "json"
|
||||||
|
outputDir = "build/dependencyUpdates"
|
||||||
|
reportfileName = "report"
|
||||||
|
}
|
22
build-logic/settings.gradle.kts
Normal file
22
build-logic/settings.gradle.kts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
*/
|
||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
rootProject.name = "build-logic"
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal() {
|
||||||
|
content { includeModule("com.github.ben-manes", "gradle-versions-plugin") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
|
||||||
|
}
|
||||||
|
|
||||||
|
include("android-plugins")
|
||||||
|
|
||||||
|
include("kotlin-plugins")
|
|
@ -1,7 +1,5 @@
|
||||||
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
||||||
|
|
||||||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@ -9,44 +7,14 @@ buildscript {
|
||||||
content { includeModule("com.android.tools", "r8") }
|
content { includeModule("com.android.tools", "r8") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies { classpath(libs.r8) }
|
dependencies {
|
||||||
|
classpath(libs.r8)
|
||||||
|
classpath(libs.javapoet)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.spotless)
|
id("dev.msfjarvis.claw.spotless")
|
||||||
alias(libs.plugins.versions)
|
id("dev.msfjarvis.claw.versions")
|
||||||
alias(libs.plugins.vcu)
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
}
|
|
||||||
|
|
||||||
fun isNonStable(version: String): Boolean {
|
|
||||||
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
|
|
||||||
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
|
|
||||||
val isStable = stableKeyword || regex.matches(version)
|
|
||||||
return isStable.not()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<DependencyUpdatesTask>().configureEach {
|
|
||||||
rejectVersionIf {
|
|
||||||
when (candidate.group) {
|
|
||||||
"com.android.application", "com.android.library" -> true
|
|
||||||
else -> isNonStable(candidate.version) && !isNonStable(currentVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkForGradleUpdate = false
|
|
||||||
checkBuildEnvironmentConstraints = true
|
|
||||||
outputFormatter = "json"
|
|
||||||
outputDir = "build/dependencyUpdates"
|
|
||||||
reportfileName = "report"
|
|
||||||
}
|
|
||||||
|
|
||||||
spotless {
|
|
||||||
kotlin {
|
|
||||||
target("**/*.kt")
|
|
||||||
targetExclude("**/build/**")
|
|
||||||
ktfmt("0.35").googleStyle()
|
|
||||||
}
|
|
||||||
kotlinGradle {
|
|
||||||
target("**/*.gradle.kts")
|
|
||||||
ktfmt("0.35").googleStyle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
import org.jetbrains.compose.compose
|
import org.jetbrains.compose.compose
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.multiplatform)
|
kotlin("multiplatform")
|
||||||
alias(libs.plugins.android.library)
|
|
||||||
alias(libs.plugins.compose)
|
alias(libs.plugins.compose)
|
||||||
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
|
id("dev.msfjarvis.claw.android-library")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
@ -38,13 +39,8 @@ kotlin {
|
||||||
|
|
||||||
android {
|
android {
|
||||||
buildFeatures { androidResources = true }
|
buildFeatures { androidResources = true }
|
||||||
compileSdk = 31
|
|
||||||
sourceSets["main"].apply {
|
sourceSets["main"].apply {
|
||||||
manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
||||||
res.srcDirs("src/commonMain/resources")
|
res.srcDirs("src/commonMain/resources")
|
||||||
}
|
}
|
||||||
defaultConfig {
|
|
||||||
minSdk = 23
|
|
||||||
targetSdk = 31
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.multiplatform)
|
kotlin("multiplatform")
|
||||||
alias(libs.plugins.android.library)
|
|
||||||
alias(libs.plugins.sqldelight)
|
alias(libs.plugins.sqldelight)
|
||||||
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
|
id("dev.msfjarvis.claw.android-library")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
android()
|
android()
|
||||||
jvm("desktop") {
|
jvm("desktop")
|
||||||
compilations.all {
|
|
||||||
kotlinOptions.jvmTarget = "11"
|
|
||||||
kotlinOptions.freeCompilerArgs =
|
|
||||||
kotlinOptions.freeCompilerArgs + listOf("-Xopt-in=kotlin.RequiresOptIn")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceSets["androidMain"].apply {
|
sourceSets["androidMain"].apply {
|
||||||
dependencies { implementation(libs.sqldelight.androidDriver) }
|
dependencies { implementation(libs.sqldelight.androidDriver) }
|
||||||
dependsOn(sourceSets["androidAndroidTestRelease"])
|
dependsOn(sourceSets["androidAndroidTestRelease"])
|
||||||
|
@ -28,15 +23,7 @@ kotlin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android { sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") }
|
||||||
compileSdk = 31
|
|
||||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
|
||||||
defaultConfig {
|
|
||||||
minSdk = 23
|
|
||||||
targetSdk = 31
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sqldelight {
|
sqldelight {
|
||||||
database("LobstersDatabase") {
|
database("LobstersDatabase") {
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.jetbrains.compose.compose
|
||||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.multiplatform)
|
kotlin("multiplatform")
|
||||||
alias(libs.plugins.compose)
|
alias(libs.plugins.compose)
|
||||||
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.msfjarvis.claw"
|
group = "dev.msfjarvis.claw"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[versions]
|
[versions]
|
||||||
accompanist = "0.24.5-alpha"
|
accompanist = "0.24.5-alpha"
|
||||||
agp = "7.0.4"
|
|
||||||
aurora = "1.1.0"
|
aurora = "1.1.0"
|
||||||
coroutines = "1.6.1"
|
coroutines = "1.6.1"
|
||||||
hilt = "2.41"
|
hilt = "2.41"
|
||||||
|
@ -23,6 +22,12 @@ androidx-paging-compose = "androidx.paging:paging-compose:1.0.0-alpha14"
|
||||||
aurora-component = { module = "org.pushing-pixels:aurora-component", version.ref = "aurora" }
|
aurora-component = { module = "org.pushing-pixels:aurora-component", version.ref = "aurora" }
|
||||||
aurora-theming = { module = "org.pushing-pixels:aurora-theming", version.ref = "aurora" }
|
aurora-theming = { module = "org.pushing-pixels:aurora-theming", version.ref = "aurora" }
|
||||||
aurora-window = { module = "org.pushing-pixels:aurora-window", version.ref = "aurora" }
|
aurora-window = { module = "org.pushing-pixels:aurora-window", version.ref = "aurora" }
|
||||||
|
build-agp = "com.android.tools.build:gradle:7.0.4"
|
||||||
|
build-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
|
build-kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||||
|
build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.4.1"
|
||||||
|
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.3.1"
|
||||||
|
build-versions = "com.github.ben-manes:gradle-versions-plugin:0.42.0"
|
||||||
coil-compose = "io.coil-kt:coil-compose:2.0.0-rc02"
|
coil-compose = "io.coil-kt:coil-compose:2.0.0-rc02"
|
||||||
compose-richtext-markdown = { module = "com.halilibo.compose-richtext:richtext-commonmark", version.ref = "richtext" }
|
compose-richtext-markdown = { module = "com.halilibo.compose-richtext:richtext-commonmark", version.ref = "richtext" }
|
||||||
compose-richtext-material = { module = "com.halilibo.compose-richtext:richtext-ui-material", version.ref = "richtext" }
|
compose-richtext-material = { module = "com.halilibo.compose-richtext:richtext-ui-material", version.ref = "richtext" }
|
||||||
|
@ -30,6 +35,7 @@ compose-richtext-ui = { module = "com.halilibo.compose-richtext:richtext-ui", ve
|
||||||
copydown = "io.github.furstenheim:copy_down:1.0"
|
copydown = "io.github.furstenheim:copy_down:1.0"
|
||||||
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
||||||
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
||||||
|
javapoet = "com.squareup:javapoet:1.13.0"
|
||||||
kamel-image = "com.alialbaali.kamel:kamel-image:0.3.0"
|
kamel-image = "com.alialbaali.kamel:kamel-image:0.3.0"
|
||||||
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||||
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" }
|
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" }
|
||||||
|
@ -44,16 +50,6 @@ sqldelight-jvmDriver = { module = "com.squareup.sqldelight:sqlite-driver", versi
|
||||||
testing-mockWebServer = "com.squareup.okhttp3:mockwebserver3-junit4:5.0.0-alpha.6"
|
testing-mockWebServer = "com.squareup.okhttp3:mockwebserver3-junit4:5.0.0-alpha.6"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
|
||||||
android-library = { id = "com.android.library", version.ref = "agp" }
|
|
||||||
compose = "org.jetbrains.compose:1.1.1"
|
compose = "org.jetbrains.compose:1.1.1"
|
||||||
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
|
||||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
||||||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
|
||||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
|
||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
|
||||||
spotless = "com.diffplug.spotless:6.4.1"
|
|
||||||
sqldelight = "com.squareup.sqldelight:1.5.3"
|
sqldelight = "com.squareup.sqldelight:1.5.3"
|
||||||
vcu = "nl.littlerobots.version-catalog-update:0.3.1"
|
|
||||||
versions = "com.github.ben-manes.versions:0.42.0"
|
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.multiplatform)
|
kotlin("multiplatform")
|
||||||
alias(libs.plugins.kotlin.serialization)
|
kotlin("plugin.serialization")
|
||||||
alias(libs.plugins.android.library)
|
id("dev.msfjarvis.claw.kotlin-common")
|
||||||
|
id("dev.msfjarvis.claw.android-library")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
android()
|
android()
|
||||||
jvm { compilations.all { kotlinOptions.jvmTarget = "11" } }
|
jvm()
|
||||||
sourceSets["commonMain"].apply {
|
sourceSets["commonMain"].apply {
|
||||||
dependencies { implementation(libs.kotlinx.serialization.core) }
|
dependencies { implementation(libs.kotlinx.serialization.core) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android { sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") }
|
||||||
compileSdk = 31
|
|
||||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
|
||||||
defaultConfig {
|
|
||||||
minSdk = 23
|
|
||||||
targetSdk = 31
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
includeBuild("build-logic")
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") {
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue