This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
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.
Merge pull request #155 from keigomichi/add-composite-build
Add composite build
- Loading branch information
Showing
20 changed files
with
417 additions
and
105 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 @@ | ||
/convention/build |
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,66 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
group = "com.example.tsundokun.buildlogic" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.android.gradlePlugin) | ||
compileOnly(libs.firebase.crashlytics.gradlePlugin) | ||
compileOnly(libs.kotlin.gradlePlugin) | ||
compileOnly(libs.room.gradlePlugin) | ||
compileOnly(libs.ksp.gradlePlugin) | ||
} | ||
|
||
gradlePlugin{ | ||
plugins{ | ||
register("androidApplicationCompose") { | ||
id = "tsundokun.android.application.compose" | ||
implementationClass = "AndroidApplicationComposeConventionPlugin" | ||
} | ||
register("androidApplication"){ | ||
id = "tsundokun.android.application" | ||
implementationClass = "AndroidApplicationConventionPlugin" | ||
} | ||
register("androidLibraryCompose"){ | ||
id = "tsundokun.android.library.compose" | ||
implementationClass = "AndroidLibraryComposeConventionPlugin" | ||
} | ||
register("androidLibrary"){ | ||
id = "tsundokun.android.library" | ||
implementationClass = "AndroidLibraryConventionPlugin" | ||
} | ||
register("androidFeature"){ | ||
id = "tsundokun.android.feature" | ||
implementationClass = "AndroidFeatureConventionPlugin" | ||
} | ||
register("androidHilt"){ | ||
id = "tsundokun.android.hilt" | ||
implementationClass = "AndroidHiltConventionPlugin" | ||
} | ||
register("androidRoom"){ | ||
id = "tsundokun.android.room" | ||
implementationClass = "AndroidRoomConventionPlugin" | ||
} | ||
register("androidFirebase"){ | ||
id = "tsundokun.android.firebase" | ||
implementationClass = "AndroidApplicationFirebaseConventionPlugin" | ||
} | ||
register("androidTest"){ | ||
id = "tsundokun.android.test" | ||
implementationClass = "AndroidTestConventionPlugin" | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
build-logic/convention/src/main/java/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,28 @@ | ||
import com.android.build.api.dsl.ApplicationExtension | ||
import com.example.tsundokun.buildlogic.configureAndroidCompose | ||
import com.example.tsundokun.buildlogic.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidApplicationComposeConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.android.application") | ||
apply("org.jetbrains.kotlin.android") | ||
} | ||
extensions.configure<ApplicationExtension> { | ||
configureAndroidCompose(this) | ||
defaultConfig.targetSdk = 33 | ||
} | ||
|
||
dependencies { | ||
add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get()) | ||
add("implementation", libs.findLibrary("androidx.lifecycle.viewModel.compose").get()) | ||
add("implementation", libs.findLibrary("androidx.lifecycle.runtime.compose").get()) | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
build-logic/convention/src/main/java/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,21 @@ | ||
import com.android.build.api.dsl.ApplicationExtension | ||
import com.example.tsundokun.buildlogic.configureKotlinAndroid | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
|
||
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> { | ||
configureKotlinAndroid(this) | ||
defaultConfig.targetSdk = 33 | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
build-logic/convention/src/main/java/AndroidApplicationFirebaseConventionPlugin.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,23 @@ | ||
import com.example.tsundokun.buildlogic.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidApplicationFirebaseConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.google.gms.google-services") | ||
apply("com.google.firebase.crashlytics") | ||
} | ||
|
||
dependencies { | ||
val bom = libs.findLibrary("firebase.bom").get() | ||
add("implementation", platform(bom)) | ||
add("implementation", libs.findLibrary("firebase.analytics").get()) | ||
add("implementation", libs.findLibrary("firebase.config").get()) | ||
add("implementation", libs.findLibrary("firebase.crashlytics").get()) | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
build-logic/convention/src/main/java/AndroidFeatureConventionPlugin.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,21 @@ | ||
import com.example.tsundokun.buildlogic.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidFeatureConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("tsundokun.android.library") | ||
apply("tsundokun.android.hilt") | ||
} | ||
|
||
dependencies { | ||
add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get()) | ||
add("implementation", libs.findLibrary("androidx.lifecycle.viewmodel.compose").get()) | ||
add("implementation", libs.findLibrary("androidx.lifecycle.runtime.compose").get()) | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
build-logic/convention/src/main/java/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,20 @@ | ||
import com.example.tsundokun.buildlogic.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidHiltConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.google.devtools.ksp") | ||
apply("dagger.hilt.android.plugin") | ||
} | ||
|
||
dependencies { | ||
add("implementation", libs.findLibrary("hilt-android").get()) | ||
add("ksp", libs.findLibrary("hilt-compiler").get()) | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.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,15 @@ | ||
import com.android.build.gradle.LibraryExtension | ||
import com.example.tsundokun.buildlogic.configureAndroidCompose | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
class AndroidLibraryComposeConventionPlugin : Plugin<Project> { | ||
override fun apply(project: Project) { | ||
with(project) { | ||
pluginManager.apply("com.android.library") | ||
val extension = extensions.getByType<LibraryExtension>() | ||
configureAndroidCompose(extension) | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.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,21 @@ | ||
import com.android.build.gradle.LibraryExtension | ||
import com.example.tsundokun.buildlogic.configureKotlinAndroid | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
|
||
class AndroidLibraryConventionPlugin : 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 = 33 | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
build-logic/convention/src/main/java/AndroidRoomConventionPlugin.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,27 @@ | ||
import androidx.room.gradle.RoomExtension | ||
import com.example.tsundokun.buildlogic.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidRoomConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("androidx.room") | ||
apply("com.google.devtools.ksp") | ||
} | ||
|
||
extensions.configure<RoomExtension> { | ||
schemaDirectory("$projectDir/schemas") | ||
} | ||
|
||
dependencies { | ||
add("implementation", libs.findLibrary("room-runtime").get()) | ||
add("implementation", libs.findLibrary("room-ktx").get()) | ||
add("ksp", libs.findLibrary("room-compiler").get()) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.