diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index 2ace8d570..375668a3e 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -50,6 +50,10 @@ gradlePlugin { id = "com.blacksquircle.feature" implementationClass = "com.blacksquircle.ui.FeatureModulePlugin" } + register("com.blacksquircle.common") { + id = "com.blacksquircle.common" + implementationClass = "com.blacksquircle.ui.CommonModulePlugin" + } register("com.blacksquircle.filesystem") { id = "com.blacksquircle.filesystem" implementationClass = "com.blacksquircle.ui.FilesystemModulePlugin" diff --git a/build-logic/convention/src/main/kotlin/com/blacksquircle/ui/CommonModulePlugin.kt b/build-logic/convention/src/main/kotlin/com/blacksquircle/ui/CommonModulePlugin.kt new file mode 100644 index 000000000..8d7f21f67 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/blacksquircle/ui/CommonModulePlugin.kt @@ -0,0 +1,63 @@ +/* + * Copyright 2023 Squircle CE contributors. + * + * 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 + * + * http://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. + */ + +package com.blacksquircle.ui + +import com.android.build.gradle.LibraryExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +class CommonModulePlugin : Plugin { + + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + apply("org.jetbrains.kotlin.android") + apply("com.google.devtools.ksp") + apply("dagger.hilt.android.plugin") + } + + configure { + compileSdk = BuildConst.COMPILE_SDK + + defaultConfig { + minSdk = BuildConst.MIN_SDK + + consumerProguardFiles("consumer-rules.pro") + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "17" + } + } + sourceSets { + named("main") { + java.srcDir("src/main/kotlin") + } + } + } + } + } +} \ No newline at end of file diff --git a/common-core/build.gradle.kts b/common-core/build.gradle.kts index 88527335d..ff8f9d778 100644 --- a/common-core/build.gradle.kts +++ b/common-core/build.gradle.kts @@ -14,25 +14,14 @@ * limitations under the License. */ -import com.blacksquircle.ui.BuildConst - plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.ksp) - alias(libs.plugins.hilt) - id("com.blacksquircle.stub") + id("com.blacksquircle.common") } android { - compileSdk = BuildConst.COMPILE_SDK namespace = "com.blacksquircle.ui.core" defaultConfig { - minSdk = BuildConst.MIN_SDK - - consumerProguardFiles("consumer-rules.pro") - javaCompileOptions { annotationProcessorOptions { argument("room.schemaLocation", "$projectDir/schemas") @@ -41,17 +30,7 @@ android { } } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = "17" - } sourceSets { - named("main") { - java.srcDir("src/main/kotlin") - } named("androidTest") { assets.srcDir(files("$projectDir/schemas")) } diff --git a/common-ui/build.gradle.kts b/common-ui/build.gradle.kts index 817e81d8b..e4cce2c31 100644 --- a/common-ui/build.gradle.kts +++ b/common-ui/build.gradle.kts @@ -14,28 +14,14 @@ * limitations under the License. */ -import com.blacksquircle.ui.BuildConst plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - id("com.blacksquircle.stub") + id("com.blacksquircle.common") } android { - compileSdk = BuildConst.COMPILE_SDK namespace = "com.blacksquircle.ui.uikit" - defaultConfig { - minSdk = BuildConst.MIN_SDK - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = "17" - } buildFeatures { viewBinding = true } @@ -50,4 +36,8 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.materialdesign) implementation(libs.colorpicker) + + // DI + implementation(libs.hilt) + ksp(libs.hilt.compiler) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 296d51205..1fa833dfd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -agp = "8.1.3" +agp = "8.1.4" kotlin = "1.9.10" ksp = "1.9.10-1.0.13" kover = "0.7.4" core = "1.12.0" -activity = "1.8.0" +activity = "1.8.1" fragment = "1.6.2" splashscreen = "1.0.1" profile-installer = "1.3.1"