-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
597 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.loongwind.ardf.demo | ||
|
||
import retrofit2.http.GET | ||
|
||
interface ApiService { | ||
|
||
@GET("user") | ||
suspend fun getUser():User | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<base-config cleartextTrafficPermitted="true" /> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'kotlin-kapt' | ||
id 'maven-publish' | ||
id 'signing' | ||
} | ||
|
||
android { | ||
compileSdk 32 | ||
|
||
defaultConfig { | ||
minSdk 23 | ||
targetSdk 32 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
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:${versions.core_ktx}" | ||
implementation "androidx.appcompat:appcompat:${versions.appcompat}" | ||
api "io.insert-koin:koin-core:${versions.koin}" | ||
api "com.squareup.okhttp3:okhttp:${versions.okhttp}" | ||
api "com.squareup.okhttp3:logging-interceptor:$versions.okhttp" | ||
api "com.squareup.retrofit2:retrofit:$versions.retrofit" | ||
api "com.squareup.retrofit2:converter-gson:$versions.retrofit" | ||
api "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$versions.retrofit_coroutines" | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} | ||
|
||
|
||
|
||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
from android.sourceSets.main.java.source | ||
} | ||
|
||
task javadocs(type: Javadoc) { | ||
source = 'src/main/java/null' | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
excludes = ['**/*.kt'] | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadocs) { | ||
archiveClassifier.set('javadoc') | ||
from javadocs.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives javadocJar | ||
} | ||
|
||
|
||
Properties properties = new Properties() | ||
properties.load(project.rootProject.file('maven.properties').newDataInputStream()) | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId properties.getProperty('GROUP_ID') //开通maven central时候定义的 | ||
artifactId 'net' //资源名称 | ||
version properties.getProperty('VERSION_NAME') //版本名称 | ||
pom { | ||
name = 'net' | ||
description = 'net framework' | ||
url = properties.getProperty('POM_URL') | ||
inceptionYear = properties.getProperty('POM_INCEPTION_YEAR') | ||
|
||
scm { | ||
url = properties.getProperty('POM_URL') | ||
connection = properties.getProperty('POM_SCM_CONNECTION') | ||
developerConnection = properties.getProperty('POM_SCM_DEV_CONNECTION') | ||
} | ||
|
||
licenses { | ||
license { | ||
name = properties.getProperty('POM_LICENCE_NAME') | ||
url = properties.getProperty('POM_LICENCE_URL') | ||
distribution = properties.getProperty('POM_LICENCE_DIST') | ||
comments = properties.getProperty('POM_LICENCE_COMMENTS') | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = properties.getProperty('POM_DEVELOPER_ID') | ||
name = properties.getProperty('POM_DEVELOPER_NAME') | ||
email = properties.getProperty('POM_DEVELOPER_EMAIL') | ||
url = properties.getProperty('POM_DEVELOPER_URL') | ||
} | ||
} | ||
|
||
issueManagement { | ||
system = properties.getProperty('POM_ISSUE_MANAGEMENT_SYSTEM') | ||
url = properties.getProperty('POM_ISSUE_MANAGEMENT_URL') | ||
} | ||
} | ||
// pom文件中声明依赖,从而传递到使用方 | ||
pom.withXml { | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
configurations.implementation.allDependencies.each { | ||
// 避免出现空节点或 artifactId=unspecified 的节点 | ||
if (it.group != null && (it.name != null && "unspecified" != it.name) && it.version != null) { | ||
println "dependency=${it.toString()}" | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
dependencyNode.appendNode('scope', 'implementation') | ||
} | ||
} | ||
} | ||
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") | ||
artifact androidSourcesJar | ||
artifact javadocJar | ||
} | ||
} | ||
repositories { | ||
maven { | ||
def snapshotsUrl = properties.getProperty('MAVEN_SNAPSHOTS_URL') | ||
def releaseUrl = properties.getProperty('MAVEN_RELEASE_URL') | ||
url = properties.getProperty('VERSION_NAME').endsWith('SNAPSHOT') ? snapshotsUrl : releaseUrl | ||
credentials { | ||
username sonatypeUsername | ||
password sonatypePassword | ||
} | ||
} | ||
} | ||
} | ||
signing { | ||
sign publishing.publications.maven //签名配置 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 24 additions & 0 deletions
24
net/src/androidTest/java/com/loongwind/ardf/net/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.loongwind.ardf.net | ||
|
||
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.loongwind.ardf.net", appContext.packageName) | ||
} | ||
} |
Oops, something went wrong.