From e6b870f4f805eaabde015fbd58d3f334bf2aae02 Mon Sep 17 00:00:00 2001 From: Dango <282919162@qq.com> Date: Wed, 30 Aug 2023 17:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/lib_common_pubilsh.yml | 8 ++++ common/.gitignore | 1 + common/build.gradle | 42 +++++++++++++++++++ common/consumer-rules.pro | 0 common/gradle.properties | 27 ++++++++++++ common/proguard-rules.pro | 21 ++++++++++ .../dx/common/ExampleInstrumentedTest.kt | 24 +++++++++++ common/src/main/AndroidManifest.xml | 4 ++ .../com/dango/dx/common/ExampleUnitTest.kt | 17 ++++++++ settings.gradle | 1 + 10 files changed, 145 insertions(+) create mode 100644 .github/workflows/lib_common_pubilsh.yml create mode 100644 common/.gitignore create mode 100644 common/build.gradle create mode 100644 common/consumer-rules.pro create mode 100644 common/gradle.properties create mode 100644 common/proguard-rules.pro create mode 100644 common/src/androidTest/java/com/dango/dx/common/ExampleInstrumentedTest.kt create mode 100644 common/src/main/AndroidManifest.xml create mode 100644 common/src/test/java/com/dango/dx/common/ExampleUnitTest.kt diff --git a/.github/workflows/lib_common_pubilsh.yml b/.github/workflows/lib_common_pubilsh.yml new file mode 100644 index 0000000..f7bcf8d --- /dev/null +++ b/.github/workflows/lib_common_pubilsh.yml @@ -0,0 +1,8 @@ +name: push_lib_widget +on: [ push ] +jobs: + push_lib_widget: + uses: DangoDX/ReusableWorkflows/.github/workflows/publish_maven_central.yml@master + with: + module_path: common/ + secrets: inherit \ No newline at end of file diff --git a/common/.gitignore b/common/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/common/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000..499264e --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,42 @@ +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'com.vanniktech.maven.publish' +} + +android { + namespace 'com.dango.dx.common' + compileSdk 33 + + defaultConfig { + minSdk 21 + targetSdk 33 + + 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 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.9.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} \ No newline at end of file diff --git a/common/consumer-rules.pro b/common/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/common/gradle.properties b/common/gradle.properties new file mode 100644 index 0000000..229765c --- /dev/null +++ b/common/gradle.properties @@ -0,0 +1,27 @@ +GROUP=io.github.DangoDX +POM_ARTIFACT_ID=lib_common +VERSION_NAME=0.0.0 + +SONATYPE_HOST=S01 +RELEASE_SIGNING_ENABLED=true + +SONATYPE_AUTOMATIC_RELEASE=true +SONATYPE_CONNECT_TIMEOUT_SECONDS=600 +SONATYPE_CLOSE_TIMEOUT_SECONDS=9000 + +POM_NAME=UselessDango +POM_DESCRIPTION=A description of what my library does. +POM_INCEPTION_YEAR=2023 +POM_URL=https://github.com/dango-dx + +POM_LICENSE_NAME=The Apache Software License, Version 2.0 +POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENSE_DIST=repo + +POM_SCM_URL=https://github.com/dango-dx +POM_SCM_CONNECTION=scm:git:git://github.com/dango-dx +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/dango-dx + +POM_DEVELOPER_ID=Dango +POM_DEVELOPER_NAME= Dango +POM_DEVELOPER_URL=https://github.com/dango-dx \ No newline at end of file diff --git a/common/proguard-rules.pro b/common/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/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/common/src/androidTest/java/com/dango/dx/common/ExampleInstrumentedTest.kt b/common/src/androidTest/java/com/dango/dx/common/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..eb4ba86 --- /dev/null +++ b/common/src/androidTest/java/com/dango/dx/common/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.dango.dx.common + +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.dango.dx.common.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/common/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/common/src/test/java/com/dango/dx/common/ExampleUnitTest.kt b/common/src/test/java/com/dango/dx/common/ExampleUnitTest.kt new file mode 100644 index 0000000..f38f9e2 --- /dev/null +++ b/common/src/test/java/com/dango/dx/common/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.dango.dx.common + +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 a8530d0..92d6a92 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,3 +16,4 @@ rootProject.name = "DangoUnit" include ':app' include ':lib:widget' include ':lib:kit' +include ':common'