From 4210fa87ee6043b9266ea6579bf4a5e18a0364e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwieci=C5=84ski?= <36954793+mateuszkwiecinski@users.noreply.github.com> Date: Tue, 4 Aug 2020 17:18:35 +0200 Subject: [PATCH] fix: IssueLinkTask cannot be registered in project with android-module parent (#75) * fix: IssueLinkTask cannot be registered in project with android module parent * chore: Update Gradle version to 6.6-rc-5 --- Changelog.md | 4 ++++ gradle/wrapper/gradle-wrapper.properties | 2 +- .../project/starter/modules/internal/AndroidPluginUtils.kt | 5 ++++- .../com/project/starter/quality/plugins/QualityPlugin.kt | 5 +++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 711079e7..90625453 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## Changed - Update _Detekt_ to version _1.11.0-RC1_ see [release notes](https://github.com/detekt/detekt/releases/tag/v1.11.0-RC1) +- Update _Android Gradle Plugin_ to 4.0.2, see [release notes](https://developer.android.com/studio/releases/gradle-plugin) + +## Fixed +- IssueLinkTask cannot be registered in project with android-module parent ## [0.14.0] - 2020-08-01 ## Changed diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e42c0b0e..013ba4bc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-rc-4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-rc-5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/src/main/kotlin/com/project/starter/modules/internal/AndroidPluginUtils.kt b/plugins/src/main/kotlin/com/project/starter/modules/internal/AndroidPluginUtils.kt index 9a6cbcf9..96d09f8b 100644 --- a/plugins/src/main/kotlin/com/project/starter/modules/internal/AndroidPluginUtils.kt +++ b/plugins/src/main/kotlin/com/project/starter/modules/internal/AndroidPluginUtils.kt @@ -72,9 +72,12 @@ internal fun Project.configureAndroidProject(variants: DomainObjectSet ExtensionContainer.getByType() = getByType(T::class.java) +internal inline fun ExtensionContainer.findByType() = + findByType(T::class.java) + internal inline fun Project.withExtension(crossinline action: Project.(T) -> Unit) = afterEvaluate { - it.action(it.extensions.getByType()) + it.action(it.extensions.getByType()) } private fun BaseExtension.addKotlinSourceSets() { diff --git a/plugins/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt b/plugins/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt index 02ee86b0..615a3afc 100644 --- a/plugins/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt +++ b/plugins/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt @@ -3,6 +3,7 @@ package com.project.starter.quality.plugins import com.android.build.gradle.BaseExtension import com.android.build.gradle.internal.tasks.factory.dependsOn import com.project.starter.config.plugins.rootConfig +import com.project.starter.modules.internal.findByType import com.project.starter.modules.internal.getByType import com.project.starter.quality.tasks.IssueLinksTask.Companion.registerIssueCheckerTask import com.project.starter.quality.internal.configureCheckstyle @@ -32,8 +33,8 @@ class QualityPlugin : Plugin { private fun Project.configureIssueCheckerTask() { registerIssueCheckerTask { - if (project.hasProperty("android")) { - val extension = project.extensions.getByType() + val extension = project.extensions.findByType() + if (extension != null) { extension.sourceSets.configureEach { sourceSet -> source += sourceSet.java.srcDirs .map { dir -> project.fileTree(dir) }