From 108bee3010b18ba68875b6eb382442dd89a26b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 8 Dec 2023 11:15:26 +0900 Subject: [PATCH] =?UTF-8?q?:feature:common=20=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 5 +++ feature/common/.gitignore | 1 + feature/common/build.gradle | 35 +++++++++++++++++++ feature/common/consumer-rules.pro | 0 feature/common/proguard-rules.pro | 21 +++++++++++ .../common/ExampleInstrumentedTest.java | 26 ++++++++++++++ feature/common/src/main/AndroidManifest.xml | 4 +++ .../feature/common/ExampleUnitTest.java | 17 +++++++++ gradle/libs.versions.toml | 4 ++- settings.gradle | 1 + 10 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 feature/common/.gitignore create mode 100644 feature/common/build.gradle create mode 100644 feature/common/consumer-rules.pro create mode 100644 feature/common/proguard-rules.pro create mode 100644 feature/common/src/androidTest/java/one/nem/lacerta/feature/common/ExampleInstrumentedTest.java create mode 100644 feature/common/src/main/AndroidManifest.xml create mode 100644 feature/common/src/test/java/one/nem/lacerta/feature/common/ExampleUnitTest.java diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ae388c2a..a12d88dc 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -12,6 +12,11 @@ diff --git a/feature/common/.gitignore b/feature/common/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/common/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/common/build.gradle b/feature/common/build.gradle new file mode 100644 index 00000000..ee10993e --- /dev/null +++ b/feature/common/build.gradle @@ -0,0 +1,35 @@ +plugins { + alias(libs.plugins.com.android.library) +} + +android { + namespace 'one.nem.lacerta.feature.common' + compileSdk 33 + + defaultConfig { + minSdk 26 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.androidx.appcompat + implementation libs.com.google.android.material + testImplementation libs.junit + androidTestImplementation libs.androidx.test.ext.junit + androidTestImplementation libs.androidx.test.espresso.core +} \ No newline at end of file diff --git a/feature/common/consumer-rules.pro b/feature/common/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/common/proguard-rules.pro b/feature/common/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/common/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/feature/common/src/androidTest/java/one/nem/lacerta/feature/common/ExampleInstrumentedTest.java b/feature/common/src/androidTest/java/one/nem/lacerta/feature/common/ExampleInstrumentedTest.java new file mode 100644 index 00000000..72609253 --- /dev/null +++ b/feature/common/src/androidTest/java/one/nem/lacerta/feature/common/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package one.nem.lacerta.feature.common; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("one.nem.lacerta.feature.common.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/feature/common/src/main/AndroidManifest.xml b/feature/common/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/feature/common/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/common/src/test/java/one/nem/lacerta/feature/common/ExampleUnitTest.java b/feature/common/src/test/java/one/nem/lacerta/feature/common/ExampleUnitTest.java new file mode 100644 index 00000000..7a3d7736 --- /dev/null +++ b/feature/common/src/test/java/one/nem/lacerta/feature/common/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package one.nem.lacerta.feature.common; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1d4626a2..7e6bfe7a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,6 @@ [versions] nav = "2.7.5" +agp = "8.0.2" [libraries] navigation-fragment = { group="androidx.navigation", name="navigation-fragment", version.ref="nav"} @@ -17,4 +18,5 @@ androidx-test-espresso-core = { group="androidx.test.espresso", name="espresso-c com-google-dagger-hilt-android = { group="com.google.dagger", name="hilt-android", version="2.44" } com-google-dagger-hilt-compiler = { group="com.google.dagger", name="hilt-compiler", version="2.44" } -[plugins] \ No newline at end of file +[plugins] +com-android-library = { id = "com.android.library", version.ref = "agp" } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 30217124..4362808c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,3 +19,4 @@ include ':feature:home' include ':feature:search' include ':feature:library' include ':feature:scan' +include ':feature:common'