Skip to content

Commit

Permalink
add Android Library target and AGP
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushg committed Oct 24, 2019
1 parent dfedcba commit b05d5b8
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ buildscript {

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50"
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
66 changes: 66 additions & 0 deletions multiplatform-parcelize/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id("com.android.library")
id 'org.jetbrains.kotlin.multiplatform'
}

Expand All @@ -7,8 +8,63 @@ repositories {
mavenCentral()
}

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28

androidExtensions {
experimental = true
}

defaultConfig {
minSdkVersion 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

// Android Gradle Plugin expects sources to be in main, test, and androidTest
// In order to keep our code structure consistent across platforms, we redefine
// the sourceset directories here.
sourceSets {
// Main code is in androidMain
main {
manifest.srcFile 'src/androidMain/AndroidManifest.xml'
java.srcDirs = ['src/androidMain/kotlin']
res.srcDirs = ['src/androidMain/res']
}
// Unit test code is in androidTest (parallels jvmTest, jsTest)
test {
java.srcDirs = ['src/androidTest/kotlin']
res.srcDirs = ['src/androidTest/res']
}
// Android instrumentationtest code is in androidInstrumentationTests
androidTest {
java.srcDirs = ['src/androidInstrumentationTest/kotlin']
res.srcDirs = ['src/androidInstrumentationTest/res']
}
}
}

dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'

testImplementation 'junit:junit:4.12'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test-junit'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
}

kotlin {
jvm()
android()
js {
nodejs {
}
Expand Down Expand Up @@ -36,6 +92,16 @@ kotlin {
implementation kotlin('test-junit')
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
}
}
androidTest {
dependencies {
implementation kotlin('stdlib')
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
Expand Down
2 changes: 2 additions & 0 deletions multiplatform-parcelize/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="sample" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package sample

actual object Sample {
}

0 comments on commit b05d5b8

Please sign in to comment.