Skip to content
Snippets Groups Projects
Commit 290fc083 authored by Jim Chen's avatar Jim Chen
Browse files

Bug 1439410 - 1. Enable Kotlin for geckoview tests; r=nalexander

Kotlin has several nice features for writing tests, such as lambdas and
default implementations for interface methods. This patch adds Kotlin
support to the geckoview module build.gradle. We don't want to use
Kotlin in non-test code yet, so the patch ensures that only test code
contains Kotlin files.

MozReview-Commit-ID: FcQiHj20xlB

--HG--
extra : rebase_source : e304d25d09291bc0a3faa29bf36f9d01eadc8524
parent 063498d9
No related branches found
No related tags found
No related merge requests found
......@@ -50,9 +50,12 @@ buildscript {
}
}
ext.kotlin_version = '1.1.51'
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......
buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
......@@ -151,10 +152,12 @@ dependencies {
implementation "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.5.1'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
......@@ -220,7 +223,7 @@ android.libraryVariants.all { variant ->
}
apply plugin: 'maven'
uploadArchives {
repositories.mavenDeployer {
pom.groupId = 'org.mozilla'
......@@ -264,6 +267,18 @@ afterEvaluate {
archives javadocJarOfficialWithGeckoBinariesNoMinApiRelease
archives sourcesJarOfficialWithGeckoBinariesNoMinApiRelease
}
// For now, ensure Kotlin is only used in tests.
android.sourceSets.all { sourceSet ->
if (sourceSet.name.startsWith('test') || sourceSet.name.startsWith('androidTest')) {
return
}
(sourceSet.java.srcDirs + sourceSet.kotlin.srcDirs).each {
if (!fileTree(it, { include '**/*.kt' }).empty) {
throw new GradleException("Kotlin used in non-test directory ${it.path}")
}
}
}
}
// Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment