Skip to content
Permalink
Browse files

add Android Library target and AGP

  • Loading branch information...
ankushg committed Oct 24, 2019
1 parent dfedcba commit b05d5b8249dd9761f0d55da9fe1dfb787b689cd4
@@ -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'
}
}
@@ -1,4 +1,5 @@
plugins {
id("com.android.library")
id 'org.jetbrains.kotlin.multiplatform'
}

@@ -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 {
}
@@ -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')
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="sample" />
@@ -0,0 +1,4 @@
package sample

actual object Sample {
}

0 comments on commit b05d5b8

Please sign in to comment.
You can’t perform that action at this time.