Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : 멀티 모듈을 위한 세팅 #3

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 1 addition & 50 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("convention.application")
}

android {
namespace = "com.withpeace.withpeace"
compileSdk = 34

defaultConfig {
applicationId = "com.withpeace.withpeace"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
Expand All @@ -19,51 +16,5 @@ android {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
11 changes: 11 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

dependencies {
implementation(libs.android.gradlePlugin)
implementation(libs.kotlin.gradlePlugin)
implementation(libs.hilt.gradlePlugin)
}

18 changes: 18 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "build-logic"
23 changes: 23 additions & 0 deletions build-logic/src/main/kotlin/Extension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.getByType

internal fun Project.android(action: CommonExtension<*, *, *, *, *>.() -> Unit) {
val androidExtension = extensions.getByName("android")
if (androidExtension is CommonExtension<*, *, *, *, *>) {
androidExtension.apply(action)
}
}

internal fun Project.java(action: JavaPluginExtension.() -> Unit) {
val javaPluginExtension = extensions.getByType<JavaPluginExtension>()
javaPluginExtension.apply {
action()
}
}

internal val Project.libs
get(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
42 changes: 42 additions & 0 deletions build-logic/src/main/kotlin/convention.android.base.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("android")
}
android {
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
packaging {
resources {
excludes += "/META-INF/*"
}
}
}

dependencies{
"androidTestImplementation"(libs.findLibrary("androidx.test.ext").get())
"androidTestImplementation"(libs.findLibrary("androidx-test-espresso-core").get())
"androidTestImplementation"(libs.findLibrary("junit4").get())
"debugImplementation"(libs.findLibrary("androidx-test-core").get())
}
32 changes: 32 additions & 0 deletions build-logic/src/main/kotlin/convention.android.compose.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id("convention.android.base")
}
android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion =
libs.findVersion("androidxComposeCompiler").get().toString()
}
}

dependencies {
val bom = libs.findLibrary("androidx-compose-bom").get()
"implementation"(platform(bom))
"androidTestImplementation"(platform(bom))

"implementation"(libs.findLibrary("androidx.activity.compose").get())
"implementation"(libs.findLibrary("androidx.compose.material3").get())
"implementation"(libs.findLibrary("androidx.compose.ui").get())
"implementation"(libs.findLibrary("androidx.compose.ui.tooling.preview").get())
"implementation"(libs.findLibrary("androidx.lifecycle.runtimeCompose").get())
"implementation"(libs.findLibrary("androidx.compose.icon").get())
"implementation"(libs.findLibrary("androidx.compose.navigation").get())

"androidTestImplementation"(libs.findLibrary("androidx.compose.ui.test").get())
"androidTestImplementation"(libs.findLibrary("androidx-compose-navigation-test").get())

"debugImplementation"(libs.findLibrary("androidx-compose-ui-tooling").get())
"debugImplementation"(libs.findLibrary("androidx-compose-ui-testManifest").get())
}
14 changes: 14 additions & 0 deletions build-logic/src/main/kotlin/convention.android.hilt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("dagger.hilt.android.plugin")
kotlin("kapt")
}

dependencies {
"implementation"(libs.findLibrary("hilt.core").get())
"implementation"(libs.findLibrary("hilt.android").get())
"implementation"(libs.findLibrary("hilt.navigation.compose").get())
"implementation"(libs.findLibrary("hilt.android.testing").get())
"kapt"(libs.findLibrary("hilt.android.compiler").get())
"kaptAndroidTest"(libs.findLibrary("hilt.android.compiler").get())
"androidTestImplementation"(libs.findLibrary("hilt.android.testing").get())
}
8 changes: 8 additions & 0 deletions build-logic/src/main/kotlin/convention.application.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("com.android.application")
id("convention.android.compose")
id("convention.android.hilt")
id("convention.test.library")
id("convention.coroutine")
}

6 changes: 6 additions & 0 deletions build-logic/src/main/kotlin/convention.coroutine.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies {
"implementation"(libs.findLibrary("coroutines.core").get())
"implementation"(libs.findLibrary("coroutines.android").get())
"testImplementation"(libs.findLibrary("coroutines.android").get())
"testImplementation"(libs.findLibrary("coroutines.test").get())
}
7 changes: 7 additions & 0 deletions build-logic/src/main/kotlin/convention.data.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("com.android.library")
id("convention.android.base")
id("convention.test.library")
id("convention.coroutine")
id("convention.android.hilt")
}
8 changes: 8 additions & 0 deletions build-logic/src/main/kotlin/convention.feature.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("com.android.library")
id("convention.android.base")
id("convention.test.library")
id("convention.coroutine")
id("convention.android.compose")
id("convention.android.hilt")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
kotlin("jvm")
id("convention.coroutine")
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies {
"testImplementation"(libs.findLibrary("junit4").get())
"testImplementation"(libs.findLibrary("mockk").get())
"testImplementation"(libs.findLibrary("truth").get())
}
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.4.0" apply true
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.ktlint)
alias(libs.plugins.android.library) apply false
alias(libs.plugins.hilt) apply false
}
1 change: 1 addition & 0 deletions google-login/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions google-login/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "com.woosuk.google_login"
compileSdk = 34

defaultConfig {
minSdk = 26

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

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit4)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}
Empty file added google-login/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions google-login/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.woosuk.google_login

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.woosuk.google_login.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions google-login/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.woosuk.google_login

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
Loading
Loading