Add tests with new Android Gradle Plugin
This commit is contained in:
+33
-34
@@ -1,12 +1,14 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
|
import org.jetbrains.kotlin.gradle.util.isLegacyAndroidGradleVersion
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
class KotlinAndroidGradleCLIOnly : AbstractKotlinAndroidGradleTests(gradleVersion = "3.3", androidGradlePluginVersion = "2.3.0")
|
class KotlinAndroidGradleCLIOnly : AbstractKotlinAndroidGradleTests(gradleVersion = "3.3", androidGradlePluginVersion = "2.3.0")
|
||||||
|
class KotlinAndroid30GradleCLIOnly : AbstractKotlinAndroidGradleTests(gradleVersion = "4.0-rc-1", androidGradlePluginVersion = "3.0.0-alpha2")
|
||||||
|
|
||||||
class KotlinAndroidWithJackGradleCLIOnly : AbstractKotlinAndroidWithJackGradleTests(gradleVersion = "3.3", androidGradlePluginVersion = "2.3.+")
|
class KotlinAndroidWithJackGradleCLIOnly : AbstractKotlinAndroidWithJackGradleTests(gradleVersion = "3.3", androidGradlePluginVersion = "2.3.+")
|
||||||
|
|
||||||
@@ -25,52 +27,46 @@ abstract class AbstractKotlinAndroidGradleTests(
|
|||||||
fun testSimpleCompile() {
|
fun testSimpleCompile() {
|
||||||
val project = Project("AndroidProject", gradleVersion)
|
val project = Project("AndroidProject", gradleVersion)
|
||||||
|
|
||||||
|
val modules = listOf("Android", "Lib")
|
||||||
|
val flavors = listOf("Flavor1", "Flavor2")
|
||||||
|
val buildTypes = listOf("Debug", "Release")
|
||||||
|
|
||||||
|
val tasks = arrayListOf<String>()
|
||||||
|
for (module in modules) {
|
||||||
|
for (flavor in flavors) {
|
||||||
|
for (buildType in buildTypes) {
|
||||||
|
tasks.add(":$module:compile$flavor${buildType}Kotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
project.build("build", "assembleAndroidTest") {
|
project.build("build", "assembleAndroidTest") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":Lib:compileReleaseKotlin",
|
// Before 3.0 AGP test only modules are compiled only against one flavor and one build type,
|
||||||
":Test:compileDebugKotlin",
|
// and contain only the compileDebugKotlin task.
|
||||||
":compileFlavor1DebugKotlin",
|
// After 3.0 AGP test only modules contain a compile<Variant>Kotlin task for each variant.
|
||||||
":compileFlavor2DebugKotlin",
|
tasks.addAll(findTasksByPattern(":Test:compile[\\w\\d]+Kotlin"))
|
||||||
":compileFlavor1JnidebugKotlin",
|
assertTasksExecuted(tasks)
|
||||||
":compileFlavor1ReleaseKotlin",
|
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||||
":compileFlavor2JnidebugKotlin",
|
// known bug: new AGP does not run Kotlin tests
|
||||||
":compileFlavor2ReleaseKotlin",
|
// https://issuetracker.google.com/issues/38454212
|
||||||
":compileFlavor1Debug",
|
// TODO: remove when the bug is fixed
|
||||||
":compileFlavor2Debug",
|
assertContains("InternalDummyTest PASSED")
|
||||||
":compileFlavor1Jnidebug",
|
}
|
||||||
":compileFlavor2Jnidebug",
|
|
||||||
":compileFlavor1Release",
|
|
||||||
":compileFlavor2Release",
|
|
||||||
":compileFlavor1DebugUnitTestKotlin",
|
|
||||||
"InternalDummyTest PASSED",
|
|
||||||
":compileFlavor1DebugAndroidTestKotlin")
|
|
||||||
checkKotlinGradleBuildServices()
|
checkKotlinGradleBuildServices()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the build second time, assert everything is up-to-date
|
// Run the build second time, assert everything is up-to-date
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":Lib:compileReleaseKotlin UP-TO-DATE")
|
assertTasksUpToDate(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the build third time, re-run tasks
|
// Run the build third time, re-run tasks
|
||||||
|
|
||||||
project.build("build", "--rerun-tasks") {
|
project.build("build", "--rerun-tasks") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":Lib:compileReleaseKotlin",
|
assertTasksExecuted(tasks)
|
||||||
":Test:compileDebugKotlin",
|
|
||||||
":compileFlavor1DebugKotlin",
|
|
||||||
":compileFlavor2DebugKotlin",
|
|
||||||
":compileFlavor1JnidebugKotlin",
|
|
||||||
":compileFlavor1ReleaseKotlin",
|
|
||||||
":compileFlavor2JnidebugKotlin",
|
|
||||||
":compileFlavor2ReleaseKotlin",
|
|
||||||
":compileFlavor1Debug",
|
|
||||||
":compileFlavor2Debug",
|
|
||||||
":compileFlavor1Jnidebug",
|
|
||||||
":compileFlavor2Jnidebug",
|
|
||||||
":compileFlavor1Release",
|
|
||||||
":compileFlavor2Release")
|
|
||||||
checkKotlinGradleBuildServices()
|
checkKotlinGradleBuildServices()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,8 +78,11 @@ abstract class AbstractKotlinAndroidGradleTests(
|
|||||||
// Execute 'assembleAndroidTest' first, without 'build' side effects
|
// Execute 'assembleAndroidTest' first, without 'build' side effects
|
||||||
project.build("assembleAndroidTest") {
|
project.build("assembleAndroidTest") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":copyFlavor1DebugKotlinClasses")
|
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||||
assertContains(":copyFlavor2DebugKotlinClasses")
|
// with the new AGP we don't need copy classes tasks
|
||||||
|
assertContains(":copyFlavor1DebugKotlinClasses")
|
||||||
|
assertContains(":copyFlavor2DebugKotlinClasses")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
@@ -347,6 +347,22 @@ abstract class BaseGradleIT {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun CompiledProject.findTasksByPattern(pattern: String): Set<String> {
|
||||||
|
return "task '($pattern)'".toRegex().findAll(output).mapTo(HashSet()) { it.groupValues[1] }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun CompiledProject.assertTasksExecuted(tasks: Iterable<String>) {
|
||||||
|
for (task in tasks) {
|
||||||
|
assertContains("Executing task '$task'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun CompiledProject.assertTasksUpToDate(tasks: Iterable<String>) {
|
||||||
|
for (task in tasks) {
|
||||||
|
assertContains("$task UP-TO-DATE")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun CompiledProject.getOutputForTask(taskName: String): String {
|
fun CompiledProject.getOutputForTask(taskName: String): String {
|
||||||
fun String.substringAfter(delimiter: String, missingDelimiterValue: () -> String): String {
|
fun String.substringAfter(delimiter: String, missingDelimiterValue: () -> String): String {
|
||||||
val index = indexOf(delimiter)
|
val index = indexOf(delimiter)
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.util.isLegacyAndroidGradleVersion
|
||||||
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class Kapt3Android30IT : Kapt3AndroidIT() {
|
||||||
|
override val androidGradlePluginVersion: String
|
||||||
|
get() = "3.0.0-alpha1"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Kapt3AndroidIT : Kapt3BaseIT() {
|
||||||
|
companion object {
|
||||||
|
private const val GRADLE_VERSION = "4.0-rc-1"
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open val androidGradlePluginVersion: String
|
||||||
|
get() = "2.3.0"
|
||||||
|
|
||||||
|
private fun androidBuildOptions() =
|
||||||
|
BuildOptions(withDaemon = true,
|
||||||
|
androidHome = File(ANDROID_HOME_PATH),
|
||||||
|
androidGradlePluginVersion = androidGradlePluginVersion,
|
||||||
|
freeCommandLineArgs = listOf("-Pkapt.verbose=true"))
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testButterKnife() {
|
||||||
|
val project = Project("android-butterknife", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
|
project.build("build", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertKaptSuccessful()
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/org/example/kotlin/butterknife/SimpleActivity\$\$ViewBinder.java")
|
||||||
|
assertFileExists("app/build/intermediates/classes/release/org/example/kotlin/butterknife/SimpleActivity\$\$ViewBinder.class")
|
||||||
|
assertFileExists("app/build/tmp/kotlin-classes/release/org/example/kotlin/butterknife/SimpleAdapter\$ViewHolder.class")
|
||||||
|
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||||
|
// we don't copy classes with new AGP
|
||||||
|
assertFileExists("app/build/intermediates/classes/release/org/example/kotlin/butterknife/SimpleAdapter\$ViewHolder.class")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build("build", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertContains(":compileReleaseKotlin UP-TO-DATE")
|
||||||
|
assertContains(":compileReleaseJavaWithJavac UP-TO-DATE")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testDagger() {
|
||||||
|
val project = Project("android-dagger", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
|
project.build("build", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertKaptSuccessful()
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/com/example/dagger/kotlin/DaggerApplicationComponent.java")
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/com/example/dagger/kotlin/ui/HomeActivity_MembersInjector.java")
|
||||||
|
assertFileExists("app/build/intermediates/classes/release/com/example/dagger/kotlin/DaggerApplicationComponent.class")
|
||||||
|
assertFileExists("app/build/tmp/kotlin-classes/release/com/example/dagger/kotlin/AndroidModule.class")
|
||||||
|
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||||
|
// we don't copy classes with new AGP
|
||||||
|
assertFileExists("app/build/intermediates/classes/release/com/example/dagger/kotlin/AndroidModule.class")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testKt15001() {
|
||||||
|
val project = Project("kt15001", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
|
project.build("compileReleaseSources", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertKaptSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testDbFlow() {
|
||||||
|
val project = Project("android-dbflow", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
|
project.build("compileReleaseSources", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertKaptSuccessful()
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/com/raizlabs/android/dbflow/config/GeneratedDatabaseHolder.java")
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/com/raizlabs/android/dbflow/config/AppDatabaseapp_Database.java")
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/mobi/porquenao/poc/kotlin/core/Item_Table.java")
|
||||||
|
assertFileExists("app/build/generated/source/kapt/release/mobi/porquenao/poc/kotlin/core/Item_Adapter.java")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testRealm() {
|
||||||
|
val project = Project("android-realm", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
|
project.build("compileReleaseSources", options = options) {
|
||||||
|
assertSuccessful()
|
||||||
|
assertKaptSuccessful()
|
||||||
|
assertFileExists("build/generated/source/kapt/release/io/realm/CatRealmProxy.java")
|
||||||
|
assertFileExists("build/generated/source/kapt/release/io/realm/CatRealmProxyInterface.java")
|
||||||
|
assertFileExists("build/generated/source/kapt/release/io/realm/DefaultRealmModule.java")
|
||||||
|
assertFileExists("build/generated/source/kapt/release/io/realm/DefaultRealmModuleMediator.java")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-91
@@ -20,28 +20,23 @@ import org.jetbrains.kotlin.gradle.util.*
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class Kapt3IT : BaseGradleIT() {
|
abstract class Kapt3BaseIT : BaseGradleIT() {
|
||||||
companion object {
|
companion object {
|
||||||
private const val GRADLE_VERSION = "2.10"
|
|
||||||
private const val GRADLE_2_14_VERSION = "2.14.1"
|
|
||||||
private const val ANDROID_GRADLE_PLUGIN_VERSION = "1.5.+"
|
|
||||||
|
|
||||||
private val KAPT_SUCCESSFUL_REGEX = "Annotation processing complete, errors: 0".toRegex()
|
private val KAPT_SUCCESSFUL_REGEX = "Annotation processing complete, errors: 0".toRegex()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun androidBuildOptions() =
|
|
||||||
BuildOptions(withDaemon = true,
|
|
||||||
androidHome = File(ANDROID_HOME_PATH),
|
|
||||||
androidGradlePluginVersion = ANDROID_GRADLE_PLUGIN_VERSION,
|
|
||||||
freeCommandLineArgs = listOf("-Pkapt.verbose=true"))
|
|
||||||
|
|
||||||
override fun defaultBuildOptions(): BuildOptions =
|
override fun defaultBuildOptions(): BuildOptions =
|
||||||
super.defaultBuildOptions().copy(withDaemon = true)
|
super.defaultBuildOptions().copy(withDaemon = true)
|
||||||
|
|
||||||
|
fun CompiledProject.assertKaptSuccessful() {
|
||||||
private fun CompiledProject.assertKaptSuccessful() {
|
|
||||||
KAPT_SUCCESSFUL_REGEX.findAll(this.output).count() > 0
|
KAPT_SUCCESSFUL_REGEX.findAll(this.output).count() > 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Kapt3IT : Kapt3BaseIT() {
|
||||||
|
companion object {
|
||||||
|
private const val GRADLE_VERSION = "3.3"
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAnnotationProcessorAsFqName() {
|
fun testAnnotationProcessorAsFqName() {
|
||||||
@@ -147,85 +142,9 @@ class Kapt3IT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testButterKnife() {
|
|
||||||
val project = Project("android-butterknife", GRADLE_VERSION, directoryPrefix = "kapt2")
|
|
||||||
val options = androidBuildOptions()
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertKaptSuccessful()
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/org/example/kotlin/butterknife/SimpleActivity\$\$ViewBinder.java")
|
|
||||||
assertFileExists("app/build/intermediates/classes/release/org/example/kotlin/butterknife/SimpleActivity\$\$ViewBinder.class")
|
|
||||||
assertFileExists("app/build/intermediates/classes/release/org/example/kotlin/butterknife/SimpleAdapter\$ViewHolder.class")
|
|
||||||
}
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertContains(":compileReleaseKotlin UP-TO-DATE")
|
|
||||||
assertContains(":compileReleaseJavaWithJavac UP-TO-DATE")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testDagger() {
|
|
||||||
val project = Project("android-dagger", GRADLE_VERSION, directoryPrefix = "kapt2")
|
|
||||||
val options = androidBuildOptions()
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", ":app:compileDebugUnitTestJavaWithJavac", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertKaptSuccessful()
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/com/example/dagger/kotlin/DaggerApplicationComponent.java")
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/com/example/dagger/kotlin/ui/HomeActivity_MembersInjector.java")
|
|
||||||
assertFileExists("app/build/intermediates/classes/release/com/example/dagger/kotlin/DaggerApplicationComponent.class")
|
|
||||||
assertFileExists("app/build/intermediates/classes/release/com/example/dagger/kotlin/AndroidModule.class")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testKt15001() {
|
|
||||||
val project = Project("kt15001", GRADLE_VERSION, directoryPrefix = "kapt2")
|
|
||||||
val options = androidBuildOptions()
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertKaptSuccessful()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testDbFlow() {
|
|
||||||
val project = Project("android-dbflow", GRADLE_VERSION, directoryPrefix = "kapt2")
|
|
||||||
val options = androidBuildOptions()
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertKaptSuccessful()
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/com/raizlabs/android/dbflow/config/GeneratedDatabaseHolder.java")
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/com/raizlabs/android/dbflow/config/AppDatabaseapp_Database.java")
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/mobi/porquenao/poc/kotlin/core/Item_Table.java")
|
|
||||||
assertFileExists("app/build/generated/source/kapt/release/mobi/porquenao/poc/kotlin/core/Item_Adapter.java")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testRealm() {
|
|
||||||
val project = Project("android-realm", GRADLE_VERSION, directoryPrefix = "kapt2")
|
|
||||||
val options = androidBuildOptions()
|
|
||||||
|
|
||||||
project.build("compileReleaseSources", options = options) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertKaptSuccessful()
|
|
||||||
assertFileExists("build/generated/source/kapt/release/io/realm/CatRealmProxy.java")
|
|
||||||
assertFileExists("build/generated/source/kapt/release/io/realm/CatRealmProxyInterface.java")
|
|
||||||
assertFileExists("build/generated/source/kapt/release/io/realm/DefaultRealmModule.java")
|
|
||||||
assertFileExists("build/generated/source/kapt/release/io/realm/DefaultRealmModuleMediator.java")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGeneratedDirectoryIsUpToDate() {
|
fun testGeneratedDirectoryIsUpToDate() {
|
||||||
val project = Project("generatedDirUpToDate", GRADLE_2_14_VERSION, directoryPrefix = "kapt2")
|
val project = Project("generatedDirUpToDate", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -268,7 +187,7 @@ class Kapt3IT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoveAnnotationIC() {
|
fun testRemoveAnnotationIC() {
|
||||||
val project = Project("simple", GRADLE_2_14_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val internalDummyKt = project.projectDir.getFileByName("InternalDummy.kt")
|
val internalDummyKt = project.projectDir.getFileByName("InternalDummy.kt")
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package org.jetbrains.kotlin.gradle.util
|
||||||
|
|
||||||
|
import org.gradle.util.VersionNumber
|
||||||
|
|
||||||
|
fun isLegacyAndroidGradleVersion(androidGradlePluginVersion: String): Boolean =
|
||||||
|
VersionNumber.parse(androidGradlePluginVersion) < VersionNumber.parse("3.0.0-alpha1")
|
||||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -34,6 +35,7 @@ android {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
+2
@@ -4,6 +4,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -16,5 +17,6 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -37,6 +37,7 @@ repositories {
|
|||||||
url "https://clojars.org/repo/"
|
url "https://clojars.org/repo/"
|
||||||
}
|
}
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
|
|||||||
+1
@@ -3,6 +3,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
|
|||||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
@@ -38,6 +39,7 @@ android {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
+3
@@ -3,4 +3,7 @@ package foo;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
public class JavaActivity extends Activity {
|
public class JavaActivity extends Activity {
|
||||||
|
void f() {
|
||||||
|
foo.GetSomethingKt.getSomething();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -5,6 +5,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
@@ -16,5 +17,6 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+29
-15
@@ -1,12 +1,6 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile project(':Lib')
|
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
buildToolsVersion "25.0.2"
|
buildToolsVersion "25.0.2"
|
||||||
@@ -22,23 +16,17 @@ android {
|
|||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
flavorDimensions "myFlavor"
|
||||||
jnidebug.initWith(buildTypes.debug)
|
|
||||||
jnidebug {
|
|
||||||
applicationIdSuffix ".jnidebug"
|
|
||||||
jniDebuggable true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
flavor1 {
|
flavor1 {
|
||||||
applicationId "com.example.flavor1"
|
applicationId "com.example.flavor1"
|
||||||
versionCode 20
|
versionCode 20
|
||||||
|
dimension "myFlavor"
|
||||||
}
|
}
|
||||||
|
|
||||||
flavor2 {
|
flavor2 {
|
||||||
applicationId "com.example.flavor2"
|
applicationId "com.example.flavor2"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
|
dimension "myFlavor"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,3 +36,29 @@ android {
|
|||||||
noJdk = true
|
noJdk = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VersionNumber.parse(android_tools_version) < VersionNumber.parse("3.0.0-alpha1")) {
|
||||||
|
configurations {
|
||||||
|
flavor1DebugCompile
|
||||||
|
flavor1ReleaseCompile
|
||||||
|
flavor2DebugCompile
|
||||||
|
flavor2ReleaseCompile
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
flavor1DebugCompile project(path: ':Lib', configuration: 'flavor1Debug')
|
||||||
|
flavor1ReleaseCompile project(path: ':Lib', configuration: 'flavor1Release')
|
||||||
|
flavor2DebugCompile project(path: ':Lib', configuration: 'flavor2Debug')
|
||||||
|
flavor2ReleaseCompile project(path: ':Lib', configuration: 'flavor2Release')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dependencies {
|
||||||
|
compile project(":Lib")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
}
|
||||||
|
|||||||
-1
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
+12
@@ -16,4 +16,16 @@ android {
|
|||||||
minSdkVersion 7
|
minSdkVersion 7
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions "myFlavor"
|
||||||
|
productFlavors {
|
||||||
|
flavor1 {
|
||||||
|
dimension "myFlavor"
|
||||||
|
}
|
||||||
|
flavor2 {
|
||||||
|
dimension "myFlavor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishNonDefault true
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
+14
-5
@@ -5,10 +5,6 @@ android {
|
|||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
buildToolsVersion "25.0.2"
|
buildToolsVersion "25.0.2"
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main.kotlin.srcDirs += 'root/kotlin'
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 7
|
minSdkVersion 7
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
@@ -17,5 +13,18 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
targetProjectPath ':Android'
|
targetProjectPath ':Android'
|
||||||
targetVariant 'flavor1Debug'
|
if (VersionNumber.parse(android_tools_version) < VersionNumber.parse("3.0.0-alpha1")) {
|
||||||
|
targetVariant 'flavor1Debug'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flavorDimensions "myFlavor"
|
||||||
|
productFlavors {
|
||||||
|
flavor1 {
|
||||||
|
dimension "myFlavor"
|
||||||
|
}
|
||||||
|
flavor2 {
|
||||||
|
dimension "myFlavor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
class Test
|
||||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
@@ -13,5 +14,6 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,12 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +13,7 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -1,12 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +13,7 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -1,12 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +13,8 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-1
@@ -4,9 +4,10 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath("io.realm:realm-gradle-plugin:$realm_version") {
|
classpath("io.realm:realm-gradle-plugin:$realm_version") {
|
||||||
exclude group: 'com.android.tools.build', module: 'gradle'
|
exclude group: 'com.android.tools.build', module: 'gradle'
|
||||||
@@ -48,6 +49,7 @@ repositories {
|
|||||||
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
|
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
|
||||||
}
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
+5
-5
@@ -1,12 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +13,7 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
@@ -5,6 +5,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
@@ -16,6 +17,7 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user