rem: Remove build-logic module

This commit is contained in:
LooKeR 2025-01-23 00:16:56 +05:30
parent 729f252cfd
commit a0587c3670
No known key found for this signature in database
GPG Key ID: 6B59369FDB608FB9
18 changed files with 55 additions and 456 deletions

View File

@ -1,20 +1,46 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
alias(libs.plugins.looker.android.application)
alias(libs.plugins.looker.hilt.work)
alias(libs.plugins.looker.lint)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ktlint)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.looker.serialization)
}
android {
val latestVersionName = "0.6.4"
namespace = "com.looker.droidify"
buildToolsVersion = "35.0.0"
compileSdk = 35
defaultConfig {
minSdk = 23
targetSdk = 35
applicationId = "com.looker.droidify"
versionCode = 640
versionName = latestVersionName
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-Xcontext-receivers"
)
}
androidResources {
generateLocaleConfig = true
}
@ -55,7 +81,7 @@ android {
buildConfigField(
type = "String",
name = "VERSION_NAME",
value = "\"v${DefaultConfig.versionName}\""
value = "\"v$latestVersionName\""
)
}
}
@ -80,8 +106,7 @@ android {
}
dependencies {
implementation(libs.monitor)
coreLibraryDesugaring(libs.desugaring)
implementation(libs.material)
implementation(libs.core.ktx)
@ -91,31 +116,41 @@ dependencies {
implementation(libs.lifecycle.viewModel)
implementation(libs.recyclerview)
implementation(libs.sqlite.ktx)
implementation(libs.coil.kt)
implementation(libs.datetime)
implementation(libs.jackson.core)
implementation(libs.image.viewer)
implementation(libs.coil.kt)
implementation(libs.datastore.core)
implementation(libs.datastore.proto)
implementation(libs.kotlin.stdlib)
implementation(libs.datetime)
implementation(libs.coroutines.core)
implementation(libs.coroutines.android)
implementation(libs.coroutines.guava)
implementation(libs.libsu.core)
implementation(libs.shizuku.api)
api(libs.shizuku.provider)
implementation(libs.jackson.core)
implementation(libs.serialization)
implementation(libs.ktor.core)
implementation(libs.ktor.okhttp)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testImplementation(libs.ktor.mock)
testImplementation(libs.coroutines.test)
testImplementation(kotlin("test"))
testRuntimeOnly(libs.junit.platform)
implementation(libs.work.ktx)
implementation(libs.hilt.core)
implementation(libs.hilt.android)
implementation(libs.hilt.ext.work)
ksp(libs.hilt.compiler)
ksp(libs.hilt.ext.compiler)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.bundles.test.unit)
testRuntimeOnly(libs.junit.platform)
androidTestImplementation(platform(libs.junit.bom))
androidTestImplementation(libs.bundles.test.android)

View File

@ -1,3 +0,0 @@
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true

View File

@ -1,15 +0,0 @@
dependencyResolutionManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
rootProject.name = "build-logic"
include(":structure")

View File

@ -1,62 +0,0 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
`kotlin-dsl`
}
group = "buildlogic"
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}
dependencies {
compileOnly(libs.android.gradlePlugin)
compileOnly(libs.kotlin.gradlePlugin)
compileOnly(libs.kotlin.ktlint)
compileOnly(libs.ksp.gradlePlugin)
}
gradlePlugin {
plugins {
register("lintPlugin") {
id = "looker.lint"
implementationClass = "AndroidLintPlugin"
}
register("serializationPlugin") {
id = "looker.serialization"
implementationClass = "AndroidSerializationPlugin"
}
register("hiltPlugin") {
id = "looker.hilt"
implementationClass = "AndroidHiltPlugin"
}
register("hiltWorkPlugin") {
id = "looker.hilt.work"
implementationClass = "AndroidHiltWorkerPlugin"
}
register("roomPlugin") {
id = "looker.room"
implementationClass = "AndroidRoomPlugin"
}
register("androidApplicationPlugin") {
id = "looker.android.application"
implementationClass = "AndroidApplicationPlugin"
}
register("androidLibraryPlugin") {
id = "looker.android.library"
implementationClass = "AndroidLibraryPlugin"
}
register("jvmLibraryPlugin") {
id = "looker.jvm.library"
implementationClass = "JvmLibraryPlugin"
}
}
}

View File

@ -1,33 +0,0 @@
import com.android.build.api.dsl.ApplicationExtension
import com.looker.droidify.configureKotlinAndroid
import com.looker.droidify.kotlin2
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
class AndroidApplicationPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
}
extensions.configure<ApplicationExtension> {
configureKotlinAndroid(this)
buildToolsVersion = DefaultConfig.buildTools
defaultConfig {
targetSdk = DefaultConfig.compileSdk
applicationId = DefaultConfig.appId
versionCode = DefaultConfig.versionCode
versionName = DefaultConfig.versionName
}
}
dependencies {
add("implementation", kotlin2("stdlib", libs))
}
}
}
}

View File

@ -1,26 +0,0 @@
import com.android.build.gradle.api.AndroidBasePlugin
import com.looker.droidify.getLibrary
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
class AndroidHiltPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.google.devtools.ksp")
dependencies {
add("ksp", libs.getLibrary("hilt.compiler"))
add("implementation", libs.getLibrary("hilt.core"))
}
/** Add support for Android modules, based on [AndroidBasePlugin] */
pluginManager.withPlugin("com.android.base") {
pluginManager.apply("dagger.hilt.android.plugin")
dependencies {
add("implementation", libs.getLibrary("hilt.android"))
}
}
}
}
}

View File

@ -1,21 +0,0 @@
import com.looker.droidify.getLibrary
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
class AndroidHiltWorkerPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("looker.hilt")
}
dependencies {
add("implementation", libs.getLibrary("work.ktx"))
add("implementation", libs.getLibrary("hilt.ext.work"))
add("ksp", libs.getLibrary("hilt.ext.compiler"))
}
}
}
}

View File

@ -1,40 +0,0 @@
import com.android.build.api.variant.LibraryAndroidComponentsExtension
import com.android.build.gradle.LibraryExtension
import com.looker.droidify.configureKotlinAndroid
import com.looker.droidify.kotlin2
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
class AndroidLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.library")
apply("org.jetbrains.kotlin.android")
}
extensions.configure<LibraryExtension> {
configureKotlinAndroid(this)
defaultConfig.targetSdk = DefaultConfig.compileSdk
buildTypes {
create("alpha") {
initWith(getByName("debug"))
isMinifyEnabled = false
}
}
}
extensions.configure<LibraryAndroidComponentsExtension> {
beforeVariants {
it.enableAndroidTest = it.enableAndroidTest
&& project.projectDir.resolve("src/androidTest").exists()
}
}
dependencies {
add("implementation", kotlin2("stdlib", libs))
}
}
}
}

View File

@ -1,27 +0,0 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
class AndroidLintPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jlleitschuh.gradle.ktlint")
}
extensions.configure<KtlintExtension> {
android.set(true)
ignoreFailures.set(true)
debug.set(true)
reporters {
reporter(ReporterType.HTML)
}
filter {
exclude("**/generated/**")
}
}
}
}
}

View File

@ -1,46 +0,0 @@
import com.google.devtools.ksp.gradle.KspExtension
import com.looker.droidify.getLibrary
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.process.CommandLineArgumentProvider
import java.io.File
class AndroidRoomPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.google.devtools.ksp")
extensions.configure<KspExtension> {
// The schemas directory contains a schema file for each version of the Room database.
// This is required to enable Room auto migrations.
// See https://developer.android.com/reference/kotlin/androidx/room/AutoMigration.
arg(RoomSchemaArgProvider(File(projectDir, "schemas")))
}
dependencies {
add("implementation", libs.getLibrary("room.ktx"))
add("implementation", libs.getLibrary("room.runtime"))
add("ksp", libs.getLibrary("room.compiler"))
}
}
}
/**
* https://issuetracker.google.com/issues/132245929
* [Export schemas](https://developer.android.com/training/data-storage/room/migrating-db-versions#export-schemas)
*/
class RoomSchemaArgProvider(
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
val schemaDir: File,
) : CommandLineArgumentProvider {
override fun asArguments() = listOf("room.schemaLocation=${schemaDir.path}")
}
}

View File

@ -1,19 +0,0 @@
import com.looker.droidify.getLibrary
import com.looker.droidify.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
class AndroidSerializationPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jetbrains.kotlin.plugin.serialization")
}
dependencies {
add("implementation", libs.getLibrary("serialization"))
}
}
}
}

View File

@ -1 +0,0 @@
object DefaultConfig { // Update [release_build.yml] along with this const val buildTools: String = "35.0.0" const val appId = "com.looker.droidify" const val compileSdk = 35 const val minSdk = 23 // Check for TODOs before update const val versionCode = 640 const val versionName = "0.6.4" }

View File

@ -1,14 +0,0 @@
import com.looker.droidify.configureKotlinJvm
import org.gradle.api.Plugin
import org.gradle.api.Project
class JvmLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jetbrains.kotlin.jvm")
}
configureKotlinJvm()
}
}
}

View File

@ -1,77 +0,0 @@
package com.looker.droidify
import DefaultConfig
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
// Taken from NIA sample app by Google
/**
* Configure base Kotlin with Android options
*/
internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = DefaultConfig.compileSdk
defaultConfig {
minSdk = DefaultConfig.minSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
// Up to Java 11 APIs are available through desugaring
// https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true
}
}
configureKotlin<KotlinAndroidProjectExtension>()
dependencies {
add("coreLibraryDesugaring", libs.getLibrary("desugaring"))
}
}
internal fun Project.configureKotlinJvm() {
extensions.configure<JavaPluginExtension> {
// Up to Java 11 APIs are available through desugaring
// https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
configureKotlin<KotlinJvmProjectExtension>()
}
/**
* Configure base Kotlin options
*/
private inline fun <reified T : KotlinBaseExtension> Project.configureKotlin() = configure<T> {
when (this) {
is KotlinAndroidProjectExtension -> compilerOptions
is KotlinJvmProjectExtension -> compilerOptions
else -> TODO("Unsupported project extension $this ${T::class}")
}.apply {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs = listOf(
"-opt-in=kotlin.RequiresOptIn",
// Enable experimental coroutines APIs, including Flow
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-Xcontext-receivers"
)
}
}

View File

@ -1,19 +0,0 @@
package com.looker.droidify
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.kotlin
val Project.libs
get(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
fun VersionCatalog.getLibrary(alias: String): Provider<MinimalExternalModuleDependency> =
findLibrary(alias).get()
fun DependencyHandler.kotlin2(module: String, catalog: VersionCatalog): Any =
kotlin(module, version = catalog.findVersion("kotlin").get().strictVersion)

View File

@ -1,7 +1,6 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false

View File

@ -1,4 +1,3 @@
# Taken from NIA sample app by Google
[versions]
desugaring = "2.1.4"
agp = "8.8.0"
@ -10,10 +9,8 @@ datastore = "1.1.2"
fragment = "1.8.5"
espresso = "3.6.1"
lifecycle = "2.8.7"
navigation = "2.8.5"
recycler-view = "1.4.0"
sqlite = "2.4.0"
test-core = "1.6.1"
test-ext = "1.2.1"
test-rules = "1.6.1"
test-runner = "1.6.2"
@ -23,7 +20,6 @@ coil = "2.7.0"
leakcanary = "2.14"
hilt = "2.55"
hiltExt = "1.2.0"
junit4 = "4.13.2"
jackson = "2.18.2"
kotlin = "2.1.0"
coroutines = "1.10.1"
@ -37,7 +33,6 @@ room = "2.6.1"
shizuku = "13.0.0"
image-viewer = "v1.0.1"
junit-jupiter = "5.11.4"
monitor = "1.7.2"
[libraries]
desugaring = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugaring" }
@ -50,12 +45,8 @@ datastore-core = { group = "androidx.datastore", name = "datastore-preferences",
datastore-proto = { group = "androidx.datastore", name = "datastore", version.ref = "datastore" }
lifecycle-runtime= { group = "androidx.lifecycle", name = "lifecycle-runtime", version.ref = "lifecycle" }
lifecycle-viewModel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "lifecycle" }
navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "navigation" }
navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "navigation" }
navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "navigation" }
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recycler-view" }
sqlite-ktx = { group = "androidx.sqlite", name = "sqlite-ktx", version.ref = "sqlite" }
test-core = { group = "androidx.test", name = "core", version.ref = "test-core" }
test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
test-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "test-ext" }
test-rules = { group = "androidx.test", name = "rules", version.ref = "test-rules" }
@ -64,16 +55,14 @@ test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator",
work-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "work" }
work-testing = { group = "androidx.work", name = "work-testing", version.ref = "work" }
coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" }
coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" }
hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltExt" }
hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltExt" }
hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" }
leakcanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakcanary" }
junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
@ -95,35 +84,15 @@ junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit-jupi
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter" }
junit-platform = { group = "org.junit.platform", name = "junit-platform-launcher" }
# Dependencies of the included build-logic
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-ktlint = { group = "org.jlleitschuh.gradle", name = "ktlint-gradle", version.ref = "ktlint" }
ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
monitor = { group = "androidx.test", name = "monitor", version.ref = "monitor" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
# Plugins defined by this project
looker-android-application = { id = "looker.android.application", version = "unspecified" }
looker-android-library = { id = "looker.android.library", version = "unspecified" }
looker-jvm-library = { id = "looker.jvm.library", version = "unspecified" }
looker-hilt = { id = "looker.hilt", version = "unspecified" }
looker-hilt-work = { id = "looker.hilt.work", version = "unspecified" }
looker-lint = { id = "looker.lint", version = "unspecified" }
looker-room = { id = "looker.room", version = "unspecified" }
looker-serialization = { id = "looker.serialization", version = "unspecified" }
[bundles]
test-unit = ["coroutines-test", "kotlin-test"]
test-unit = ["junit-jupiter", "ktor-mock", "coroutines-test", "kotlin-test"]
test-android = ["test-runner", "test-rules", "test-ext", "test-espresso-core", "coroutines-test", "kotlin-test"]
test-ui = ["test-runner", "test-rules", "test-espresso-core", "test-uiautomator", "coroutines-test", "kotlin-test"]

View File

@ -1,5 +1,4 @@
pluginManagement {
includeBuild("build-logic")
repositories {
google()
mavenCentral()