Skip to content

Commit

Permalink
CommonModulePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
massivemadness committed Nov 19, 2023
1 parent f774f69 commit 252637e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 39 deletions.
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Project> {

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<LibraryExtension> {
compileSdk = BuildConst.COMPILE_SDK

defaultConfig {
minSdk = BuildConst.MIN_SDK

consumerProguardFiles("consumer-rules.pro")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
}
}
sourceSets {
named("main") {
java.srcDir("src/main/kotlin")
}
}
}
}
}
}
23 changes: 1 addition & 22 deletions common-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"))
}
Expand Down
20 changes: 5 additions & 15 deletions common-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -50,4 +36,8 @@ dependencies {
implementation(libs.androidx.appcompat)
implementation(libs.materialdesign)
implementation(libs.colorpicker)

// DI
implementation(libs.hilt)
ksp(libs.hilt.compiler)
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 252637e

Please sign in to comment.