diff --git a/example-android/src/main/java/me/jfenn/gitrest/example/android/MainActivity.kt b/example-android/src/main/java/me/jfenn/gitrest/example/android/MainActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..da4b1578d9ee6c344d7cf00584dbf99785ddb328 --- /dev/null +++ b/example-android/src/main/java/me/jfenn/gitrest/example/android/MainActivity.kt @@ -0,0 +1,4 @@ +package me.jfenn.gitrest.example.android + +class MainActivity { +} \ No newline at end of file diff --git a/gitrest/build.gradle b/gitrest/build.gradle index 464f151c004d19eb8d14cc96c5559b9c8edb8d9a..0dbf492c8f0b186a28f010e4f36686700e225128 100644 --- a/gitrest/build.gradle +++ b/gitrest/build.gradle @@ -1,10 +1,40 @@ +apply plugin: "com.android.library" apply plugin: "kotlin-multiplatform" apply plugin: "kotlinx-serialization" +def libraryVersion = "0.0.1" +def libraryVersionCode = 1 + apply plugin: 'maven-publish' group 'gitrest' -version '0.0.1' +version libraryVersion + +android { + compileSdkVersion 29 + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 29 + versionCode libraryVersionCode + versionName libraryVersion + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + } + + sourceSets.main { + manifest.srcFile 'src/androidMain/AndroidManifest.xml' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} +// temporary solution for https://youtrack.jetbrains.com/issue/KT-34389 project.plugins.apply(org.jetbrains.kotlin.gradle.targets.js.npm.NpmResolverPlugin) kotlin { @@ -29,11 +59,13 @@ kotlin { jvm() + android() + sourceSets { commonMain { dependencies { - implementation kotlin('stdlib-common') - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7' + compileOnly kotlin('stdlib-common') + compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4' compileOnly "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version" compileOnly "io.ktor:ktor-client-core:$ktor_version" compileOnly "io.ktor:ktor-client-json:$ktor_version" @@ -50,7 +82,6 @@ kotlin { dependencies { implementation kotlin('stdlib-jdk8') implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version" - // TODO: ktor dependency for android implementation "io.ktor:ktor-client-apache:$ktor_version" implementation "io.ktor:ktor-client-json-jvm:$ktor_version" implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version" @@ -62,6 +93,21 @@ kotlin { implementation kotlin('test-junit') } } + androidMain { + dependencies { + implementation kotlin('stdlib-jdk7') + implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version" + implementation "io.ktor:ktor-client-android:$ktor_version" + implementation "io.ktor:ktor-client-json-jvm:$ktor_version" + implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version" + } + } + androidTest { + dependencies { + implementation kotlin('test') + implementation kotlin('test-junit') + } + } jsMain { dependencies { implementation kotlin('stdlib-js') diff --git a/gitrest/consumer-rules.pro b/gitrest/consumer-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..0ff06424f6473866c7c22c217d4e164986209f9f --- /dev/null +++ b/gitrest/consumer-rules.pro @@ -0,0 +1,9 @@ +-keepattributes *Annotation*, InnerClasses +-dontnote kotlinx.serialization.SerializationKt +-keep,includedescriptorclasses class com.yourcompany.yourpackage.**$$serializer { *; } # <-- change package name to your app's +-keepclassmembers class me.jfenn.gitrest.** { # <-- change package name to your app's + *** Companion; +} +-keepclasseswithmembers class me.jfenn.gitrest.** { # <-- change package name to your app's + kotlinx.serialization.KSerializer serializer(...); +} diff --git a/gitrest/src/androidMain/AndroidManifest.xml b/gitrest/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..8cf0bd9cd207b18cce608e366cf37b126b588c44 --- /dev/null +++ b/gitrest/src/androidMain/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + +