Add tests with new Android Gradle Plugin
This commit is contained in:
+33
-34
@@ -1,12 +1,14 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.isLegacyAndroidGradleVersion
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
|
||||
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.+")
|
||||
|
||||
@@ -25,52 +27,46 @@ abstract class AbstractKotlinAndroidGradleTests(
|
||||
fun testSimpleCompile() {
|
||||
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") {
|
||||
assertSuccessful()
|
||||
assertContains(":Lib:compileReleaseKotlin",
|
||||
":Test:compileDebugKotlin",
|
||||
":compileFlavor1DebugKotlin",
|
||||
":compileFlavor2DebugKotlin",
|
||||
":compileFlavor1JnidebugKotlin",
|
||||
":compileFlavor1ReleaseKotlin",
|
||||
":compileFlavor2JnidebugKotlin",
|
||||
":compileFlavor2ReleaseKotlin",
|
||||
":compileFlavor1Debug",
|
||||
":compileFlavor2Debug",
|
||||
":compileFlavor1Jnidebug",
|
||||
":compileFlavor2Jnidebug",
|
||||
":compileFlavor1Release",
|
||||
":compileFlavor2Release",
|
||||
":compileFlavor1DebugUnitTestKotlin",
|
||||
"InternalDummyTest PASSED",
|
||||
":compileFlavor1DebugAndroidTestKotlin")
|
||||
// Before 3.0 AGP test only modules are compiled only against one flavor and one build type,
|
||||
// and contain only the compileDebugKotlin task.
|
||||
// After 3.0 AGP test only modules contain a compile<Variant>Kotlin task for each variant.
|
||||
tasks.addAll(findTasksByPattern(":Test:compile[\\w\\d]+Kotlin"))
|
||||
assertTasksExecuted(tasks)
|
||||
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||
// known bug: new AGP does not run Kotlin tests
|
||||
// https://issuetracker.google.com/issues/38454212
|
||||
// TODO: remove when the bug is fixed
|
||||
assertContains("InternalDummyTest PASSED")
|
||||
}
|
||||
checkKotlinGradleBuildServices()
|
||||
}
|
||||
|
||||
// Run the build second time, assert everything is up-to-date
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertContains(":Lib:compileReleaseKotlin UP-TO-DATE")
|
||||
assertTasksUpToDate(tasks)
|
||||
}
|
||||
|
||||
// Run the build third time, re-run tasks
|
||||
|
||||
project.build("build", "--rerun-tasks") {
|
||||
assertSuccessful()
|
||||
assertContains(":Lib:compileReleaseKotlin",
|
||||
":Test:compileDebugKotlin",
|
||||
":compileFlavor1DebugKotlin",
|
||||
":compileFlavor2DebugKotlin",
|
||||
":compileFlavor1JnidebugKotlin",
|
||||
":compileFlavor1ReleaseKotlin",
|
||||
":compileFlavor2JnidebugKotlin",
|
||||
":compileFlavor2ReleaseKotlin",
|
||||
":compileFlavor1Debug",
|
||||
":compileFlavor2Debug",
|
||||
":compileFlavor1Jnidebug",
|
||||
":compileFlavor2Jnidebug",
|
||||
":compileFlavor1Release",
|
||||
":compileFlavor2Release")
|
||||
assertTasksExecuted(tasks)
|
||||
checkKotlinGradleBuildServices()
|
||||
}
|
||||
}
|
||||
@@ -82,8 +78,11 @@ abstract class AbstractKotlinAndroidGradleTests(
|
||||
// Execute 'assembleAndroidTest' first, without 'build' side effects
|
||||
project.build("assembleAndroidTest") {
|
||||
assertSuccessful()
|
||||
assertContains(":copyFlavor1DebugKotlinClasses")
|
||||
assertContains(":copyFlavor2DebugKotlinClasses")
|
||||
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||
// 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
|
||||
}
|
||||
|
||||
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 String.substringAfter(delimiter: String, missingDelimiterValue: () -> String): String {
|
||||
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 java.io.File
|
||||
|
||||
class Kapt3IT : BaseGradleIT() {
|
||||
abstract class Kapt3BaseIT : BaseGradleIT() {
|
||||
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 fun androidBuildOptions() =
|
||||
BuildOptions(withDaemon = true,
|
||||
androidHome = File(ANDROID_HOME_PATH),
|
||||
androidGradlePluginVersion = ANDROID_GRADLE_PLUGIN_VERSION,
|
||||
freeCommandLineArgs = listOf("-Pkapt.verbose=true"))
|
||||
|
||||
override fun defaultBuildOptions(): BuildOptions =
|
||||
super.defaultBuildOptions().copy(withDaemon = true)
|
||||
|
||||
|
||||
private fun CompiledProject.assertKaptSuccessful() {
|
||||
fun CompiledProject.assertKaptSuccessful() {
|
||||
KAPT_SUCCESSFUL_REGEX.findAll(this.output).count() > 0
|
||||
}
|
||||
}
|
||||
|
||||
open class Kapt3IT : Kapt3BaseIT() {
|
||||
companion object {
|
||||
private const val GRADLE_VERSION = "3.3"
|
||||
}
|
||||
|
||||
@Test
|
||||
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
|
||||
fun testGeneratedDirectoryIsUpToDate() {
|
||||
val project = Project("generatedDirUpToDate", GRADLE_2_14_VERSION, directoryPrefix = "kapt2")
|
||||
val project = Project("generatedDirUpToDate", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
@@ -268,7 +187,7 @@ class Kapt3IT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
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)
|
||||
project.setupWorkingDir()
|
||||
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 {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -34,6 +35,7 @@ android {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -16,5 +17,6 @@ allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
}
|
||||
+1
@@ -37,6 +37,7 @@ repositories {
|
||||
url "https://clojars.org/repo/"
|
||||
}
|
||||
mavenLocal()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
kapt {
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
@@ -38,6 +39,7 @@ android {
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+3
@@ -3,4 +3,7 @@ package foo;
|
||||
import android.app.Activity;
|
||||
|
||||
public class JavaActivity extends Activity {
|
||||
void f() {
|
||||
foo.GetSomethingKt.getSomething();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -5,6 +5,7 @@ buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||
@@ -16,5 +17,6 @@ allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
}
|
||||
+29
-15
@@ -1,12 +1,6 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
dependencies {
|
||||
compile project(':Lib')
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "25.0.2"
|
||||
@@ -22,23 +16,17 @@ android {
|
||||
targetSdkVersion 22
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
jnidebug.initWith(buildTypes.debug)
|
||||
jnidebug {
|
||||
applicationIdSuffix ".jnidebug"
|
||||
jniDebuggable true
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "myFlavor"
|
||||
productFlavors {
|
||||
flavor1 {
|
||||
applicationId "com.example.flavor1"
|
||||
versionCode 20
|
||||
dimension "myFlavor"
|
||||
}
|
||||
|
||||
flavor2 {
|
||||
applicationId "com.example.flavor2"
|
||||
minSdkVersion 14
|
||||
dimension "myFlavor"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,3 +36,29 @@ android {
|
||||
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
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
|
||||
+12
@@ -16,4 +16,16 @@ android {
|
||||
minSdkVersion 7
|
||||
targetSdkVersion 22
|
||||
}
|
||||
|
||||
flavorDimensions "myFlavor"
|
||||
productFlavors {
|
||||
flavor1 {
|
||||
dimension "myFlavor"
|
||||
}
|
||||
flavor2 {
|
||||
dimension "myFlavor"
|
||||
}
|
||||
}
|
||||
|
||||
publishNonDefault true
|
||||
}
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
|
||||
+14
-5
@@ -5,10 +5,6 @@ android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
sourceSets {
|
||||
main.kotlin.srcDirs += 'root/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 7
|
||||
targetSdkVersion 22
|
||||
@@ -17,5 +13,18 @@ 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 {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
@@ -13,5 +14,6 @@ allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
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 {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -14,6 +13,7 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
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 {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -14,6 +13,7 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
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 {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -14,7 +13,8 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -4,9 +4,10 @@ buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
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("io.realm:realm-gradle-plugin:$realm_version") {
|
||||
exclude group: 'com.android.tools.build', module: 'gradle'
|
||||
@@ -48,6 +49,7 @@ repositories {
|
||||
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
|
||||
}
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+5
-5
@@ -1,12 +1,11 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -14,6 +13,7 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
}
|
||||
+2
@@ -5,6 +5,7 @@ buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||
@@ -16,6 +17,7 @@ allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user