Skip to content

Commit 5822f49

Browse files
committed
Update to Kotlin 1.3.11 Gradle 5.1.1 Android Build Tools Plugin 3.3.0
1 parent 41a8486 commit 5822f49

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

gradle/dependencies.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ ext {
33
minSdk : 21,
44
targetSdk : 28,
55
compileSdk : 28,
6-
// Kotlin version is used in multiple places hence it is available as version variable
7-
kotlin : "1.2.71"
6+
kotlin : "1.3.11"
87
]
98
projectDependency = [
109

1110
// Gradle Plugins
1211
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${projectVersion.kotlin}",
13-
gradlePlugin : "com.android.tools.build:gradle:3.2.1",
12+
gradlePlugin : "com.android.tools.build:gradle:3.3.0",
1413

1514
// Dependencies
1615
kotlinStdlibJdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${projectVersion.kotlin}",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ class RootCoveragePlugin : Plugin<Project> {
7171
list.add("jacoco/test*UnitTest.exec")
7272
}
7373
if (rootProjectExtension.testTypes.contains(TestVariantBuildOutput.TestType.ANDROID_TEST)) {
74+
75+
// Android Build Tools Plugin 3.2
7476
list.add("outputs/code-coverage/connected/*coverage.ec")
77+
78+
// Android Build Tools Plugin 3.3+
79+
list.add("outputs/code_coverage/*/connected/*coverage.ec")
7580
}
7681
return list
7782
}
@@ -191,11 +196,9 @@ class RootCoveragePlugin : Plugin<Project> {
191196
}
192197

193198
// Collect the class files based on the Java Compiler output
194-
val javaClassTrees = variant.javaCompiler.outputs.files.map { file ->
199+
val javaClassTrees = variant.javaCompileProvider.get().outputs.files.map { file ->
195200
project.fileTree(file, excludes = getFileFilterPatterns()).excludeNonClassFiles()
196201
}
197-
// Hard coded alternative to get class files for Java.
198-
//val classesTree = project.fileTree(mapOf("dir" to "${project.buildDir}/intermediates/classes/${variant.dirName}", "excludes" to getFileFilterPatterns()))
199202

200203
// TODO: No idea how to dynamically get the kotlin class files output folder, so for now this is hardcoded.
201204
// TODO: For some reason the tmp/kotlin-classes folder does not use the variant.dirName property, for now we instead use the variant.name.
@@ -219,21 +222,9 @@ class RootCoveragePlugin : Plugin<Project> {
219222
// Make the root task depend on the sub-project code coverage task
220223
rootTask.dependsOn(subModuleTask)
221224

222-
// Set or add the sub-task class directories to the root task
223-
if (rootTask.classDirectories == null) {
224-
rootTask.classDirectories = subModuleTask.classDirectories
225-
} else {
226-
rootTask.classDirectories += subModuleTask.classDirectories
227-
}
228-
229-
// Set or add the sub-task source directories to the root task
230-
if (rootTask.sourceDirectories == null) {
231-
rootTask.sourceDirectories = subModuleTask.sourceDirectories
232-
} else {
233-
rootTask.sourceDirectories += subModuleTask.sourceDirectories
234-
}
235-
236-
// Add the sub-task class directories to the root task
237-
rootTask.executionData(subModuleTask.executionData)
225+
// Add the sub-task class directories, source directories and executionData to the root task
226+
rootTask.classDirectories.from(subModuleTask.classDirectories)
227+
rootTask.sourceDirectories.from(subModuleTask.sourceDirectories)
228+
rootTask.executionData.from(subModuleTask.executionData)
238229
}
239230
}

0 commit comments

Comments
 (0)