From 37d99bca53685823bddda5817b57fe596d4c213f Mon Sep 17 00:00:00 2001 From: jeff <404407685@qq.com> Date: Tue, 19 Jan 2021 23:50:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- foudations/mogo-commons/.gitignore | 1 + foudations/mogo-commons/build.gradle | 37 +++++++++++++++++++ foudations/mogo-commons/consumer-rules.pro | 0 foudations/mogo-commons/proguard-rules.pro | 21 +++++++++++ .../cloud/commons/ExampleInstrumentedTest.kt | 24 ++++++++++++ .../mogo-commons/src/main/AndroidManifest.xml | 5 +++ .../cloud/commons/network/RetrofitFactory.kt | 14 +++++++ .../com/mogo/cloud/commons/ExampleUnitTest.kt | 17 +++++++++ settings.gradle | 1 + 9 files changed, 120 insertions(+) create mode 100644 foudations/mogo-commons/.gitignore create mode 100644 foudations/mogo-commons/build.gradle create mode 100644 foudations/mogo-commons/consumer-rules.pro create mode 100644 foudations/mogo-commons/proguard-rules.pro create mode 100644 foudations/mogo-commons/src/androidTest/java/com/mogo/cloud/commons/ExampleInstrumentedTest.kt create mode 100644 foudations/mogo-commons/src/main/AndroidManifest.xml create mode 100644 foudations/mogo-commons/src/main/java/com/mogo/cloud/commons/network/RetrofitFactory.kt create mode 100644 foudations/mogo-commons/src/test/java/com/mogo/cloud/commons/ExampleUnitTest.kt diff --git a/foudations/mogo-commons/.gitignore b/foudations/mogo-commons/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/foudations/mogo-commons/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle new file mode 100644 index 0000000..98a4c57 --- /dev/null +++ b/foudations/mogo-commons/build.gradle @@ -0,0 +1,37 @@ +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.2" + + defaultConfig { + minSdkVersion 19 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation rootProject.ext.dependencies.retrofit + +} \ No newline at end of file diff --git a/foudations/mogo-commons/consumer-rules.pro b/foudations/mogo-commons/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/foudations/mogo-commons/proguard-rules.pro b/foudations/mogo-commons/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/foudations/mogo-commons/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/foudations/mogo-commons/src/androidTest/java/com/mogo/cloud/commons/ExampleInstrumentedTest.kt b/foudations/mogo-commons/src/androidTest/java/com/mogo/cloud/commons/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..229aaf7 --- /dev/null +++ b/foudations/mogo-commons/src/androidTest/java/com/mogo/cloud/commons/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.mogo.cloud.commons + +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.mogo.cloud.commons.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/AndroidManifest.xml b/foudations/mogo-commons/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ee3ace1 --- /dev/null +++ b/foudations/mogo-commons/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + / + \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/java/com/mogo/cloud/commons/network/RetrofitFactory.kt b/foudations/mogo-commons/src/main/java/com/mogo/cloud/commons/network/RetrofitFactory.kt new file mode 100644 index 0000000..6db0e8b --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/cloud/commons/network/RetrofitFactory.kt @@ -0,0 +1,14 @@ +package com.mogo.cloud.commons.network + +import androidx.collection.ArrayMap +import retrofit2.Retrofit + +/** + * + * @Author: wujifei + * @CreateDate: 1/19/21 11:21 PM + * @Description: 描述 + */ +class RetrofitFactory private constructor() { + +} \ No newline at end of file diff --git a/foudations/mogo-commons/src/test/java/com/mogo/cloud/commons/ExampleUnitTest.kt b/foudations/mogo-commons/src/test/java/com/mogo/cloud/commons/ExampleUnitTest.kt new file mode 100644 index 0000000..b8f9ed0 --- /dev/null +++ b/foudations/mogo-commons/src/test/java/com/mogo/cloud/commons/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.mogo.cloud.commons + +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) + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 05c00ef..9cc457f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ +include ':foudations:mogo-commons' include ':foudations:mogo-httpdns' include ':foudations:mogo-passport' include ':app'