-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register Kotlin MPP source sets in AGP
^KT-43391 fixed
- Loading branch information
Showing
21 changed files
with
479 additions
and
33 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
22 changes: 22 additions & 0 deletions
22
...gration-tests/src/test/resources/testProject/new-mpp-android-source-sets/build.gradle.kts
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,22 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
mavenLocal() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath(kotlin("gradle-plugin:${property("kotlin_version")}")) | ||
classpath("com.android.tools.build:gradle:${property("android_tools_version")}") | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
mavenLocal() | ||
jcenter() | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ration-tests/src/test/resources/testProject/new-mpp-android-source-sets/gradle.properties
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 @@ | ||
kotlin.code.style=official |
38 changes: 38 additions & 0 deletions
38
...ion-tests/src/test/resources/testProject/new-mpp-android-source-sets/lib/build.gradle.kts
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,38 @@ | ||
plugins { | ||
id("com.android.library") | ||
kotlin("multiplatform") | ||
} | ||
|
||
android { | ||
compileSdkVersion(28) | ||
defaultConfig { | ||
minSdkVersion(21) | ||
targetSdkVersion(28) | ||
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
} | ||
|
||
kotlin { | ||
android() | ||
macosX64("macos") | ||
|
||
sourceSets { | ||
getByName("commonMain").dependencies { | ||
implementation(kotlin("stdlib-common")) | ||
} | ||
|
||
getByName("commonMain").dependencies { | ||
implementation(kotlin("test")) | ||
implementation(kotlin("test-annotations-common")) | ||
} | ||
|
||
getByName("androidMain").dependencies { | ||
implementation(kotlin("stdlib-jdk8")) | ||
} | ||
|
||
getByName("androidAndroidTest").dependencies { | ||
implementation(kotlin("test-junit")) | ||
implementation("com.android.support.test:runner:1.0.2") | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...es/testProject/new-mpp-android-source-sets/lib/src/androidAndroidTest/java/DontCompile.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 @@ | ||
CANT COMPILE THIS FILE! |
13 changes: 13 additions & 0 deletions
13
...oject/new-mpp-android-source-sets/lib/src/androidAndroidTest/kotlin/AndroidAndroidTest.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,13 @@ | ||
import kotlin.test.Test | ||
|
||
/** | ||
* Expected to fail! | ||
*/ | ||
class AndroidAndroidTest { | ||
@Test | ||
fun fail() { | ||
MainApiKotlin.sayHi() | ||
MainApiJava.sayHi() | ||
CommonApi.throwException() | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...resources/testProject/new-mpp-android-source-sets/lib/src/androidMain/java/DontCompile.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 @@ | ||
CANT COMPILE THIS FILE! |
3 changes: 3 additions & 0 deletions
3
...estProject/new-mpp-android-source-sets/lib/src/androidMain/kotlin/AndroidMainApiKotlin.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,3 @@ | ||
object AndroidMainApiKotlin { | ||
fun sayHi() = println("HI") | ||
} |
10 changes: 10 additions & 0 deletions
10
...urces/testProject/new-mpp-android-source-sets/lib/src/androidTest/java/AndroidTestJava.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,10 @@ | ||
import org.junit.Test | ||
|
||
class AndroidTestJava { | ||
@Test | ||
fun fail() { | ||
MainApiJava.sayHi() | ||
MainApiKotlin.sayHi() | ||
CommonApi.throwException() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...s/testProject/new-mpp-android-source-sets/lib/src/androidTest/kotlin/AndroidTestKotlin.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,10 @@ | ||
import org.junit.Test | ||
|
||
class AndroidTestKotlin { | ||
@Test | ||
fun fail() { | ||
MainApiJava.sayHi() | ||
MainApiKotlin.sayHi() | ||
CommonApi.throwException() | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../resources/testProject/new-mpp-android-source-sets/lib/src/commonMain/kotlin/CommonApi.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,3 @@ | ||
object CommonApi { | ||
fun throwException(): Unit = error("This is supposed to fail!") | ||
} |
9 changes: 9 additions & 0 deletions
9
...resources/testProject/new-mpp-android-source-sets/lib/src/commonTest/kotlin/CommonTest.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,9 @@ | ||
import kotlin.test.Test | ||
|
||
/* Expected to fail ! */ | ||
class CommonTest { | ||
@Test | ||
fun fail() { | ||
CommonApi.throwException() | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...c/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/AndroidManifest.xml
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 @@ | ||
<manifest package="io.sellmair.mpp"/> |
3 changes: 3 additions & 0 deletions
3
...c/test/resources/testProject/new-mpp-android-source-sets/lib/src/main/java/MainApiJava.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,3 @@ | ||
object MainApiJava { | ||
fun sayHi() = println("HI") | ||
} |
3 changes: 3 additions & 0 deletions
3
...st/resources/testProject/new-mpp-android-source-sets/lib/src/main/kotlin/MainApiKotlin.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,3 @@ | ||
object MainApiKotlin { | ||
fun sayHi() = println("HI") | ||
} |
13 changes: 13 additions & 0 deletions
13
.../src/test/resources/testProject/new-mpp-android-source-sets/lib/src/test/java/TestJava.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,13 @@ | ||
import org.junit.Test | ||
|
||
class TestJava { | ||
|
||
@Test | ||
fun fail() { | ||
MainApiKotlin.sayHi() | ||
MainApiJava.sayHi() | ||
AndroidMainApiKotlin.sayHi() | ||
CommonApi.throwException() | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
.../test/resources/testProject/new-mpp-android-source-sets/lib/src/test/kotlin/TestKotlin.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,13 @@ | ||
import kotlin.test.Test | ||
|
||
/** | ||
* Expected to fail! | ||
*/ | ||
class TestKotlin { | ||
@Test | ||
fun fail() { | ||
MainApiKotlin.sayHi() | ||
MainApiJava.sayHi() | ||
CommonApi.throwException() | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...tion-tests/src/test/resources/testProject/new-mpp-android-source-sets/settings.gradle.kts
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,2 @@ | ||
rootProject.name = "mpp-playgound" | ||
include(":lib") |
Oops, something went wrong.