From 9346c325504f8909e1c323d5db64dd0a9e1138b1 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, 7 Jun 2024 11:58:15 +0900 Subject: [PATCH] =?UTF-8?q?shared=E3=83=A2=E3=82=B8=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + settings.gradle | 1 + shared/.gitignore | 1 + shared/build.gradle | 35 +++++++++++++++++++ shared/consumer-rules.pro | 0 shared/proguard-rules.pro | 21 +++++++++++ .../shared/ExampleInstrumentedTest.java | 26 ++++++++++++++ shared/src/main/AndroidManifest.xml | 4 +++ .../nem/kidshift/shared/ExampleUnitTest.java | 17 +++++++++ 9 files changed, 106 insertions(+) create mode 100644 shared/.gitignore create mode 100644 shared/build.gradle create mode 100644 shared/consumer-rules.pro create mode 100644 shared/proguard-rules.pro create mode 100644 shared/src/androidTest/java/one/nem/kidshift/shared/ExampleInstrumentedTest.java create mode 100644 shared/src/main/AndroidManifest.xml create mode 100644 shared/src/test/java/one/nem/kidshift/shared/ExampleUnitTest.java diff --git a/.idea/gradle.xml b/.idea/gradle.xml index d8c84a2..3cd2a4c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -17,6 +17,7 @@ diff --git a/settings.gradle b/settings.gradle index cf9fd6a..c809618 100644 --- a/settings.gradle +++ b/settings.gradle @@ -28,3 +28,4 @@ include ':feature:debug' include ':utils' include ':data' include ':model' +include ':shared' diff --git a/shared/.gitignore b/shared/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/shared/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/shared/build.gradle b/shared/build.gradle new file mode 100644 index 0000000..010ee0d --- /dev/null +++ b/shared/build.gradle @@ -0,0 +1,35 @@ +plugins { + alias(libs.plugins.androidLibrary) +} + +android { + namespace 'one.nem.kidshift.shared' + compileSdk 34 + + defaultConfig { + minSdk 28 + + 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.appcompat + implementation libs.material + testImplementation libs.junit + androidTestImplementation libs.ext.junit + androidTestImplementation libs.espresso.core +} \ No newline at end of file diff --git a/shared/consumer-rules.pro b/shared/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/shared/proguard-rules.pro b/shared/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/shared/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/shared/src/androidTest/java/one/nem/kidshift/shared/ExampleInstrumentedTest.java b/shared/src/androidTest/java/one/nem/kidshift/shared/ExampleInstrumentedTest.java new file mode 100644 index 0000000..d74750f --- /dev/null +++ b/shared/src/androidTest/java/one/nem/kidshift/shared/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package one.nem.kidshift.shared; + +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.kidshift.shared.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/shared/src/main/AndroidManifest.xml b/shared/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/shared/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/shared/src/test/java/one/nem/kidshift/shared/ExampleUnitTest.java b/shared/src/test/java/one/nem/kidshift/shared/ExampleUnitTest.java new file mode 100644 index 0000000..b625fe8 --- /dev/null +++ b/shared/src/test/java/one/nem/kidshift/shared/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package one.nem.kidshift.shared; + +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