Skip to content

Commit

Permalink
Merge pull request #4 from boranfrkn/HiltAndComposeConventionPlugins
Browse files Browse the repository at this point in the history
HiltAndConventionPlugins
  • Loading branch information
boranfrkn authored Aug 18, 2023
2 parents edcaf14 + 3441410 commit d77fc42
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 98 deletions.
8 changes: 1 addition & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndorid)
alias(libs.plugins.kapt)
alias(libs.plugins.hilt)
id("hilt-convention")
}

android {
Expand Down Expand Up @@ -38,14 +38,8 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
kapt {
correctErrorTypes = true
}
}

dependencies {
implementation(libs.hiltAndroid)
kapt(libs.hiltCompiler)

implementation(projects.characters)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.furkanboran.build_logic

import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.plugins.ExtensionAware
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.plugin.KaptExtension

val Project.libs
get(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")

fun Project.kapt(block: KaptExtension.() -> Unit): Unit =
(this as ExtensionAware).extensions.configure("kapt", block)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import com.furkanboran.build_logic.libs

plugins {
id("library-convention")
}

android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

dependencies {
add("implementation", platform(libs.findLibrary("composeBom").get()))
add("implementation", libs.findLibrary("ui").get())
add("implementation", libs.findLibrary("uiGraphics").get())
add("implementation", libs.findLibrary("uiToolingPreview").get())
add("implementation", libs.findLibrary("material3").get())
add("debugImplementation", libs.findLibrary("uiTooling").get())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import com.furkanboran.build_logic.libs

plugins {
kotlin("kapt")
}

dependencies {
add("implementation", libs.findLibrary("hiltAndroid").get())
add("kapt", libs.findLibrary("hiltCompiler").get())
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ android {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
23 changes: 1 addition & 22 deletions character-card/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("library-convention")
id("compose-convention")
alias(libs.plugins.kotlinAndorid)
}

Expand All @@ -20,32 +21,10 @@ android {
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

dependencies {

implementation(libs.coreKtx)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activityCompose)
implementation(platform(libs.composeBom))
implementation(libs.ui)
implementation(libs.uiGraphics)
implementation(libs.uiToolingPreview)
implementation(libs.material3)
implementation(libs.coil)
debugImplementation(libs.uiTooling)
}
12 changes: 2 additions & 10 deletions characters/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
id("library-convention")
id("compose-convention")
id("hilt-convention")
alias(libs.plugins.kotlinAndorid)
alias(libs.plugins.kapt)
alias(libs.plugins.hilt)
}

Expand Down Expand Up @@ -41,16 +42,7 @@ dependencies {
implementation(libs.coreKtx)
implementation(libs.lifecycleRuntimeKtx)
implementation(libs.activityCompose)
implementation(platform(libs.composeBom))
implementation(libs.ui)
implementation(libs.uiGraphics)
implementation(libs.uiToolingPreview)
implementation(libs.material3)
implementation(libs.paging)
implementation(libs.hiltAndroid)
kapt(libs.hiltCompiler)
androidTestImplementation(platform(libs.composeBom))
debugImplementation(libs.uiTooling)
debugImplementation(libs.uiTestManifest)

implementation(projects.characterCard)
Expand Down
24 changes: 1 addition & 23 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
plugins {
id("library-convention")
alias(libs.plugins.kotlinAndorid)
alias(libs.plugins.kapt)
alias(libs.plugins.hilt)
id("hilt-convention")
}

android {
namespace = "boranfrkn.disneycharacters.core"
compileSdk = 33

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
Expand All @@ -25,16 +15,4 @@ android {
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

dependencies {
implementation(libs.hiltAndroid)
kapt(libs.hiltCompiler)
}
18 changes: 1 addition & 17 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
plugins {
id("library-convention")
id("hilt-convention")
alias(libs.plugins.kotlinAndorid)
alias(libs.plugins.kapt)
alias(libs.plugins.hilt)
}

android {
namespace = "boranfrkn.disneycharacters.data"

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
Expand All @@ -22,26 +16,16 @@ android {
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

dependencies {

implementation(libs.coreKtx)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.retrofit)
implementation(libs.retrofitGson)
implementation(libs.okHttpLogging)
implementation(libs.paging)
implementation(libs.hiltAndroid)
kapt(libs.hiltCompiler)

implementation(projects.core)
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ uiGraphics = { group = "androidx.compose.ui", name = "ui-graphics" }
uiTooling = { group = "androidx.compose.ui", name = "ui-tooling" }
uiToolingPreview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
uiTestManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
hiltAndroid = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hiltCompiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
Expand Down
19 changes: 1 addition & 18 deletions theme/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
plugins {
id("library-convention")
id("compose-convention")
alias(libs.plugins.kotlinAndorid)
}

android {
namespace = "boranfrkn.disneycharacters.theme"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
}
}

dependencies {

implementation(libs.coreKtx)
implementation(libs.appcompat)
implementation(libs.material3)
implementation(platform(libs.composeBom))
}

0 comments on commit d77fc42

Please sign in to comment.