forked from MRepoApp/MRepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
349 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.android.gradle) | ||
compileOnly(libs.kotlin.gradle) | ||
compileOnly(libs.ksp.gradle) | ||
|
||
implementation(libs.kotlin.reflect) | ||
implementation(libs.kotlin.stdlib) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("androidApplication") { | ||
id = "mrepo.android.application" | ||
implementationClass = "AndroidApplicationConventionPlugin" | ||
} | ||
|
||
register("androidApplicationCompose") { | ||
id = "mrepo.android.application.compose" | ||
implementationClass = "AndroidApplicationComposeConventionPlugin" | ||
} | ||
|
||
register("androidHilt") { | ||
id = "mrepo.android.hilt" | ||
implementationClass = "AndroidHiltConventionPlugin" | ||
} | ||
|
||
register("androidRoom") { | ||
id = "mrepo.android.room" | ||
implementationClass = "AndroidRoomConventionPlugin" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
build-logic/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
import com.android.build.api.dsl.ApplicationExtension | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
class AndroidApplicationComposeConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
||
pluginManager.apply("com.android.application") | ||
|
||
extensions.configure<ApplicationExtension> { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = | ||
libs.findVersion("androidxComposeCompiler").get().toString() | ||
} | ||
|
||
dependencies { | ||
"implementation"(libs.findLibrary("compose.material").get()) | ||
"implementation"(libs.findLibrary("compose.material3").get()) | ||
"implementation"(libs.findLibrary("compose.ui").get()) | ||
"implementation"(libs.findLibrary("compose.ui.tooling.preview").get()) | ||
"debugImplementation"(libs.findLibrary("compose.ui.tooling").get()) | ||
"debugImplementation"(libs.findLibrary("compose.ui.test.manifest").get()) | ||
} | ||
} | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
build-logic/src/main/kotlin/AndroidApplicationConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
import com.android.build.api.dsl.ApplicationExtension | ||
import org.gradle.api.JavaVersion | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.JavaPluginExtension | ||
import org.gradle.jvm.toolchain.JavaLanguageVersion | ||
import org.gradle.kotlin.dsl.configure | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension | ||
|
||
class AndroidApplicationConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.android.application") | ||
apply("org.jetbrains.kotlin.android") | ||
} | ||
|
||
extensions.configure<ApplicationExtension> { | ||
compileSdk = 33 | ||
buildToolsVersion = "33.0.2" | ||
ndkVersion = "25.2.9519653" | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
targetSdk = 33 | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
} | ||
|
||
extensions.configure<JavaPluginExtension> { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
} | ||
} | ||
|
||
extensions.configure<KotlinAndroidProjectExtension> { | ||
jvmToolchain(17) | ||
|
||
sourceSets.all { | ||
languageSettings { | ||
optIn("androidx.compose.material3.ExperimentalMaterial3Api") | ||
optIn("androidx.compose.ui.ExperimentalComposeUiApi") | ||
optIn("androidx.compose.animation.ExperimentalAnimationApi") | ||
optIn("androidx.compose.foundation.ExperimentalFoundationApi") | ||
optIn("com.google.accompanist.permissions.ExperimentalPermissionsApi") | ||
optIn("kotlin.ExperimentalStdlibApi") | ||
optIn("kotlinx.coroutines.FlowPreview") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
build-logic/src/main/kotlin/AndroidHiltConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.jetbrains.kotlin.gradle.plugin.KaptExtension | ||
|
||
class AndroidHiltConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
||
with(pluginManager) { | ||
apply("dagger.hilt.android.plugin") | ||
apply("org.jetbrains.kotlin.kapt") | ||
} | ||
|
||
extensions.configure<KaptExtension> { | ||
correctErrorTypes = true | ||
} | ||
|
||
dependencies { | ||
"implementation"(libs.findLibrary("hilt.android").get()) | ||
"kapt"(libs.findLibrary("hilt.compiler").get()) | ||
"implementation"(libs.findLibrary("hilt.ext.work").get()) | ||
"kapt"(libs.findLibrary("hilt.ext.compiler").get()) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.