diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47d12f9c9..f30fc8e40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Cache konan - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.konan key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} @@ -109,7 +109,7 @@ jobs: 17 - name: Validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties diff --git a/README.md b/README.md index fe1d79d57..973e50583 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ ## Latest releases 🛠 -- Kotlin && Multiplatform && Compose && Plugin | [v11.1.1](https://github.com/mikepenz/AboutLibraries/tree/v11.1.1) +- Kotlin && Multiplatform && Compose && Plugin | [v11.1.2](https://github.com/mikepenz/AboutLibraries/tree/v11.1.2) ## Gradle Plugin diff --git a/app-desktop/src/main/resources/aboutlibraries.json b/app-desktop/src/main/resources/aboutlibraries.json index 46fb1328d..b4ff2f939 100644 --- a/app-desktop/src/main/resources/aboutlibraries.json +++ b/app-desktop/src/main/resources/aboutlibraries.json @@ -1,10 +1,57 @@ { "metadata": { - "generated": "2023-11-04T07:40:40.575Z" + "generated": "2024-03-30T13:43:55.823Z" }, "libraries": [ { - "uniqueId": "com.mikepenz:aboutlibraries-compose-jvm", + "uniqueId": "androidx.annotation:annotation-jvm", + "funding": [ + + ], + "developers": [ + { + "name": "The Android Open Source Project" + } + ], + "artifactVersion": "1.7.1", + "description": "Provides source annotations for tooling and readability.", + "scm": { + "connection": "scm:git:https://android.googlesource.com/platform/frameworks/support", + "url": "https://cs.android.com/androidx/platform/frameworks/support" + }, + "name": "Annotation", + "website": "https://developer.android.com/jetpack/androidx/releases/annotation#1.7.1", + "licenses": [ + "Apache-2.0" + ] + }, + { + "uniqueId": "androidx.collection:collection-jvm", + "funding": [ + + ], + "developers": [ + { + "name": "The Android Open Source Project" + } + ], + "artifactVersion": "1.4.0", + "description": "Standalone efficient collections.", + "scm": { + "connection": "scm:git:https://android.googlesource.com/platform/frameworks/support", + "url": "https://cs.android.com/androidx/platform/frameworks/support" + }, + "name": "collections", + "website": "https://developer.android.com/jetpack/androidx/releases/collection#1.4.0", + "licenses": [ + "Apache-2.0" + ], + "organization": { + "name": "The Android Open Source Project" + } + }, + { + "uniqueId": "com.mikepenz:aboutlibraries-compose-m3-jvm", "funding": [ ], @@ -13,14 +60,14 @@ "name": "Mike Penz" } ], - "artifactVersion": "10.9.1", + "artifactVersion": "11.1.1", "description": "AboutLibraries automatically detects all dependencies of a project and collects their information including the license. Optionally visualising it via the provided ui components.", "scm": { "connection": "scm:git@github.com:mikepenz/AboutLibraries.git", "url": "https://github.com/mikepenz/AboutLibraries", "developerConnection": "scm:git@github.com:mikepenz/AboutLibraries.git" }, - "name": "AboutLibraries Library", + "name": "AboutLibraries Compose Material 3 Library", "website": "https://github.com/mikepenz/AboutLibraries", "licenses": [ "Apache-2.0" @@ -36,14 +83,14 @@ "name": "Mike Penz" } ], - "artifactVersion": "10.9.1", + "artifactVersion": "11.1.1", "description": "AboutLibraries automatically detects all dependencies of a project and collects their information including the license. Optionally visualising it via the provided ui components.", "scm": { "connection": "scm:git@github.com:mikepenz/AboutLibraries.git", "url": "https://github.com/mikepenz/AboutLibraries", "developerConnection": "scm:git@github.com:mikepenz/AboutLibraries.git" }, - "name": "AboutLibraries Library", + "name": "AboutLibraries Core Library", "website": "https://github.com/mikepenz/AboutLibraries", "licenses": [ "Apache-2.0" @@ -60,7 +107,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Animation engine and animation primitives that are the building blocks of the Compose animation library", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -84,7 +131,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose animation library", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -108,7 +155,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose Desktop", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -132,7 +179,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Higher level abstractions of the Compose UI primitives. This library is design system agnostic, providing the high-level building blocks for both application and design-system developers", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -156,7 +203,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose layout implementations", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -169,6 +216,30 @@ "Apache-2.0" ] }, + { + "uniqueId": "org.jetbrains.compose.material3:material3-desktop", + "funding": [ + + ], + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "Compose Multiplatform Team" + } + ], + "artifactVersion": "1.6.1", + "description": "Compose Material You Design Components library", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", + "url": "https://github.com/JetBrains/compose-jb", + "developerConnection": "scm:git:https://github.com/JetBrains/compose-jb.git" + }, + "name": "Compose Material3 Components", + "website": "https://github.com/JetBrains/compose-jb", + "licenses": [ + "Apache-2.0" + ] + }, { "uniqueId": "org.jetbrains.compose.material:material-desktop", "funding": [ @@ -180,7 +251,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose Material Design Components library", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -204,7 +275,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose Material Design core icons. This module contains the most commonly used set of Material icons.", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -228,7 +299,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Material ripple used to build interactive components", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -252,7 +323,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Tree composition support for code generated by the Compose compiler plugin and corresponding public API", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -276,7 +347,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose components that allow saving and restoring the local ui state", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -300,7 +371,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose UI primitives. This library contains the primitives that form the Compose UI Toolkit, such as drawing, measurement and layout.", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -324,7 +395,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose classes related to dimensions without units", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -348,7 +419,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose graphics", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -372,7 +443,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose Text primitives and utilities", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -396,7 +467,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose tooling library API. This library provides the API required to declare @Preview composables in user apps.", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -420,7 +491,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Compose classes for simple units", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -444,7 +515,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "1.5.10", + "artifactVersion": "1.6.1", "description": "Internal Compose utilities used by other modules", "scm": { "connection": "scm:git:https://github.com/JetBrains/compose-jb.git", @@ -468,7 +539,7 @@ "name": "Kotlin Team" } ], - "artifactVersion": "1.9.20", + "artifactVersion": "1.9.23", "description": "Kotlin Standard Library", "scm": { "connection": "scm:git:https://github.com/JetBrains/kotlin.git", @@ -492,7 +563,7 @@ "name": "Kotlin Team" } ], - "artifactVersion": "1.8.20", + "artifactVersion": "1.9.23", "description": "Kotlin Standard Library JDK 7 extension", "scm": { "connection": "scm:git:https://github.com/JetBrains/kotlin.git", @@ -516,7 +587,7 @@ "name": "Kotlin Team" } ], - "artifactVersion": "1.8.20", + "artifactVersion": "1.9.23", "description": "Kotlin Standard Library JDK 8 extension", "scm": { "connection": "scm:git:https://github.com/JetBrains/kotlin.git", @@ -540,7 +611,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "0.17.0", + "artifactVersion": "0.23.2", "description": "AtomicFU utilities", "scm": { "url": "https://github.com/Kotlin/kotlinx.atomicfu" @@ -562,7 +633,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "0.3.6", + "artifactVersion": "0.3.7", "description": "Kotlin Immutable Collections multiplatform library", "scm": { "url": "https://github.com/Kotlin/kotlinx.collections.immutable" @@ -584,7 +655,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "1.7.3", + "artifactVersion": "1.8.0", "description": "Coroutines support libraries for Kotlin", "scm": { "url": "https://github.com/Kotlin/kotlinx.coroutines" @@ -606,7 +677,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "1.7.3", + "artifactVersion": "1.8.0", "description": "Coroutines support libraries for Kotlin", "scm": { "url": "https://github.com/Kotlin/kotlinx.coroutines" @@ -617,6 +688,28 @@ "Apache-2.0" ] }, + { + "uniqueId": "org.jetbrains.kotlinx:kotlinx-datetime-jvm", + "funding": [ + + ], + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "JetBrains Team" + } + ], + "artifactVersion": "0.5.0", + "description": "Kotlin Datetime Library", + "scm": { + "url": "https://github.com/Kotlin/kotlinx-datetime" + }, + "name": "kotlinx-datetime", + "website": "https://github.com/Kotlin/kotlinx-datetime", + "licenses": [ + "Apache-2.0" + ] + }, { "uniqueId": "org.jetbrains.kotlinx:kotlinx-serialization-bom", "funding": [ @@ -628,7 +721,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "1.6.0", + "artifactVersion": "1.6.3", "description": "Kotlin multiplatform serialization runtime library", "scm": { "url": "https://github.com/Kotlin/kotlinx.serialization" @@ -650,7 +743,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "1.6.0", + "artifactVersion": "1.6.3", "description": "Kotlin multiplatform serialization runtime library", "scm": { "url": "https://github.com/Kotlin/kotlinx.serialization" @@ -672,7 +765,7 @@ "name": "JetBrains Team" } ], - "artifactVersion": "1.6.0", + "artifactVersion": "1.6.3", "description": "Kotlin multiplatform serialization runtime library", "scm": { "url": "https://github.com/Kotlin/kotlinx.serialization" @@ -694,7 +787,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "0.7.85", + "artifactVersion": "0.7.97", "description": "Kotlin Skia bindings", "scm": { "connection": "scm:git:https://www.github.com/JetBrains/skiko.git", @@ -718,7 +811,7 @@ "name": "Compose Multiplatform Team" } ], - "artifactVersion": "0.7.85", + "artifactVersion": "0.7.97", "description": "Kotlin Skia bindings", "scm": { "connection": "scm:git:https://www.github.com/JetBrains/skiko.git", diff --git a/app/build.gradle b/app/build.gradle index 2d2fbbc14..0e985625c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,7 @@ +import com.mikepenz.aboutlibraries.plugin.DuplicateMode +import com.mikepenz.aboutlibraries.plugin.DuplicateRule +import com.mikepenz.aboutlibraries.plugin.StrictMode + plugins { id 'com.android.application' } @@ -106,13 +110,15 @@ aboutLibraries { // Define the strict mode, will fail if the project uses licenses not allowed // - This will only automatically fail for Android projects which have `registerAndroidTasks` enabled // For non Android projects, execute `exportLibraryDefinitions` - strictMode = com.mikepenz.aboutlibraries.plugin.StrictMode.FAIL + strictMode = StrictMode.FAIL // Allowed set of licenses, this project will be able to use without build failure - allowedLicenses = ["Apache-2.0", "asdkl"] + allowedLicenses = ["Apache-2.0"] + // Allowed set of licenses for specific dependencies, this project will be able to use without build failure + allowedLicensesMap = ["asdkl": ["androidx.jetpack.library"]] // Enable the duplication mode, allows to merge, or link dependencies which relate - duplicationMode = com.mikepenz.aboutlibraries.plugin.DuplicateMode.LINK + duplicationMode = DuplicateMode.LINK // Configure the duplication rule, to match "duplicates" with - duplicationRule = com.mikepenz.aboutlibraries.plugin.DuplicateRule.SIMPLE + duplicationRule = DuplicateRule.SIMPLE // Enable pretty printing for the generated JSON file prettyPrint = true diff --git a/gradle.properties b/gradle.properties index 0aaae90ba..d00d4dccf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ GROUP=com.mikepenz -VERSION_NAME=11.1.1 -VERSION_CODE=110101 +VERSION_NAME=11.1.2 +VERSION_CODE=110102 POM_URL=https://github.com/mikepenz/AboutLibraries POM_SCM_URL=https://github.com/mikepenz/AboutLibraries POM_SCM_CONNECTION=scm:git@github.com:mikepenz/AboutLibraries.git diff --git a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt index 7a53817fe..4c065dbe7 100644 --- a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt +++ b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt @@ -1,9 +1,6 @@ package com.mikepenz.aboutlibraries.plugin -import org.gradle.api.NamedDomainObjectCollection -import org.gradle.api.model.ObjectFactory import java.util.regex.Pattern -import javax.inject.Inject @Suppress("unused") // Public API for Gradle build scripts. abstract class AboutLibrariesExtension { @@ -127,6 +124,20 @@ abstract class AboutLibrariesExtension { */ var allowedLicenses: Array = emptyArray() + /** + * Defines the allowed licenses for specific libraries which will not result in warnings or failures depending on the [strictMode] configuration. + * This is useful if some dependencies have special licenses which are only used in testing and are accepted for thsi case. + * + * ``` + * aboutLibraries { + * allowedLicensesMap = mapOf("Apache-2.0" to arrayOf("libraryId")) + * } + * ``` + * + * This API requires spdxId's to be provided. A full list is available here: https://spdx.org/licenses/ + */ + var allowedLicensesMap: Map> = emptyMap() + /** * Defines the plugins behavior in case of duplicates. * By default duplicates are kept, no duplicate discovery enabled. diff --git a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt index 756485161..83ea08dcc 100644 --- a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt +++ b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt @@ -1,12 +1,17 @@ package com.mikepenz.aboutlibraries.plugin +import com.mikepenz.aboutlibraries.plugin.mapping.Library import com.mikepenz.aboutlibraries.plugin.mapping.License import com.mikepenz.aboutlibraries.plugin.model.writeToDisk import com.mikepenz.aboutlibraries.plugin.util.forLicense -import org.gradle.api.tasks.* +import org.gradle.api.tasks.CacheableTask +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.TaskAction import org.slf4j.LoggerFactory import java.io.File -import java.util.* +import java.util.Locale @CacheableTask abstract class AboutLibrariesTask : BaseAboutLibrariesTask() { @@ -44,14 +49,34 @@ abstract class AboutLibrariesTask : BaseAboutLibrariesTask() { val name = it.name.lowercase(Locale.ENGLISH) val url = it.url?.lowercase(Locale.ENGLISH) if (!(allowedLicenses.contains(id) - || allowedLicenses.contains(name) - || (url?.isNotEmpty() == true && allowedLicenses.contains(url))) + || allowedLicenses.contains(name) + || (url?.isNotEmpty() == true && allowedLicenses.contains(url))) ) { missing.add(it) } } - if (missing.isEmpty()) { + val missingMapped = mutableMapOf>() + if (allowedLicensesMap.isNotEmpty()) { + missing.forEach { + val id = it.spdxId?.lowercase(Locale.ENGLISH) ?: it.hash.lowercase(Locale.ENGLISH) + + val libsForLicense = allowedLicensesMap[id] ?: allowedLicensesMap[name] + if (libsForLicense != null) { + val notAllowed = result.libraries.forLicense(it).filter { lib -> + !(libsForLicense.contains(lib.uniqueId) || libsForLicense.contains(lib.groupId) || libsForLicense.contains(lib.artifactId)) + } + if (notAllowed.isNotEmpty()) { + missingMapped[it] = notAllowed + } + } + } + } else { + missing.forEach { missingMapped[it] = result.libraries.forLicense(it) } + } + + + if (missingMapped.isEmpty()) { LOGGER.info("No libraries detected using a license not allowed.") } else { val message = StringBuilder() @@ -59,11 +84,9 @@ abstract class AboutLibrariesTask : BaseAboutLibrariesTask() { message.appendLine("=======================================") } message.appendLine("Detected usage of not allowed licenses!") - missing.forEach { - message.appendLine("-> License: ${it.name} | ${it.spdxId ?: "-"} (${it.url}), used by:") - result.libraries.forLicense(it).forEach { lib -> - message.appendLine(" ${lib.uniqueId}") - } + missingMapped.forEach { (license, libraries) -> + message.appendLine("-> License: ${license.name} | ${license.spdxId ?: "-"} (${license.url}), used by:") + libraries.forEach { lib -> message.appendLine(" ${lib.uniqueId}") } } repeat(2) { message.appendLine("=======================================") diff --git a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt index 9ec9b9244..0080386c3 100644 --- a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt +++ b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt @@ -5,7 +5,12 @@ import com.mikepenz.aboutlibraries.plugin.util.LibrariesProcessor import groovy.json.JsonSlurper import org.gradle.api.DefaultTask import org.gradle.api.artifacts.dsl.DependencyHandler -import org.gradle.api.tasks.* +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity import org.slf4j.LoggerFactory import java.io.File import javax.inject.Inject @@ -59,6 +64,9 @@ abstract class BaseAboutLibrariesTask : DefaultTask() { @Input val allowedLicenses = extension.allowedLicenses + @Input + val allowedLicensesMap = extension.allowedLicensesMap + @Input val offlineMode = extension.offlineMode diff --git a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt index fddcd8d7b..d3e696b65 100644 --- a/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt +++ b/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt @@ -74,17 +74,21 @@ class DependencyCollector( val visitedDependencyNames = mutableSetOf() if (LOGGER.isDebugEnabled) LOGGER.debug("Pre-fetching dependencies for $variant") - configuration - .resolvedConfiguration - .lenientConfiguration - .allModuleDependencies - .getResolvedArtifacts(visitedDependencyNames) - .forEach { resArtifact -> - val identifier = "${resArtifact.moduleVersion.id.group.trim()}:${resArtifact.name.trim()}" - if (LOGGER.isDebugEnabled) LOGGER.debug("Retrieved for $variant :: $identifier") - val versions = variantSet.getOrPut(identifier) { LinkedHashSet() } - versions.add(resArtifact.moduleVersion.id.version.trim()) - } + try { + configuration + .resolvedConfiguration + .lenientConfiguration + .allModuleDependencies + .getResolvedArtifacts(visitedDependencyNames) + .forEach { resArtifact -> + val identifier = "${resArtifact.moduleVersion.id.group.trim()}:${resArtifact.name.trim()}" + if (LOGGER.isDebugEnabled) LOGGER.debug("Retrieved for $variant :: $identifier") + val versions = variantSet.getOrPut(identifier) { LinkedHashSet() } + versions.add(resArtifact.moduleVersion.id.version.trim()) + } + } catch (t: Throwable) { + LOGGER.error("Failed to retrieve dependencies for $variant", t) + } if (LOGGER.isDebugEnabled) LOGGER.debug("Completed-fetching dependencies for $variant") } @@ -148,10 +152,10 @@ class DependencyCollector( private val testCompile = setOf("testCompile", "androidTestCompile") private val Configuration.isTest get() = name.startsWith("test", ignoreCase = true) || - name.startsWith("androidTest", ignoreCase = true) || - hierarchy.any { configurationHierarchy -> - testCompile.any { configurationHierarchy.name.contains(it, ignoreCase = true) } - } + name.startsWith("androidTest", ignoreCase = true) || + hierarchy.any { configurationHierarchy -> + testCompile.any { configurationHierarchy.name.contains(it, ignoreCase = true) } + } private val platform = "platform"