Skip to content

Commit

Permalink
Merge pull request #929 from mikepenz/develop
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
mikepenz authored Sep 26, 2023
2 parents 82f0867 + 2b1a1ff commit db53238
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

## Latest releases 🛠

- (Next Gen) Kotlin && Multiplatform && Plugin | [v10.9.0](https://github.com/mikepenz/AboutLibraries/tree/v10.9.0)
- (Next Gen) Kotlin && Multiplatform && Plugin | [v10.9.1](https://github.com/mikepenz/AboutLibraries/tree/v10.9.1)
- Kotlin && Gradle Plugin | [v8.9.4](https://github.com/mikepenz/AboutLibraries/tree/v8.9.4)

## Gradle Plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ fun LicenseDialog(
.align(Alignment.End)
.padding(horizontal = 8.dp, vertical = 2.dp)
) {
TextButton(onClick = onDismiss) {
TextButton(
onClick = onDismiss,
colors = ButtonDefaults.textButtonColors(
contentColor = colors.dialogConfirmButtonColor,
)
) {
Text(confirmText)
}
}
Expand Down Expand Up @@ -295,18 +300,21 @@ object LibraryDefaults {
* @param contentColor the content color of this [Library]
* @param badgeBackgroundColor the badge background color of this [Library]
* @param badgeContentColor the badge content color of this [Library]
* @param dialogConfirmButtonColor the dialog's confirm button color of this [Library]
*/
@Composable
fun libraryColors(
backgroundColor: Color = MaterialTheme.colors.background,
contentColor: Color = contentColorFor(backgroundColor),
badgeBackgroundColor: Color = MaterialTheme.colors.primary,
badgeContentColor: Color = contentColorFor(badgeBackgroundColor),
dialogConfirmButtonColor: Color = MaterialTheme.colors.primary,
): LibraryColors = DefaultLibraryColors(
backgroundColor = backgroundColor,
contentColor = contentColor,
badgeBackgroundColor = badgeBackgroundColor,
badgeContentColor = badgeContentColor
badgeContentColor = badgeContentColor,
dialogConfirmButtonColor = dialogConfirmButtonColor,
)

/**
Expand Down Expand Up @@ -350,6 +358,9 @@ interface LibraryColors {

/** Represents the badge content color for this library item. */
val badgeContentColor: Color

/** Represents the text color of the dialog's confirm button */
val dialogConfirmButtonColor: Color
}

/**
Expand All @@ -361,6 +372,7 @@ private class DefaultLibraryColors(
override val contentColor: Color,
override val badgeBackgroundColor: Color,
override val badgeContentColor: Color,
override val dialogConfirmButtonColor: Color,
) : LibraryColors


Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GROUP=com.mikepenz

VERSION_NAME=10.9.0
VERSION_CODE=100900
VERSION_NAME=10.9.1
VERSION_CODE=100901
POM_URL=https://github.com/mikepenz/AboutLibraries
POM_SCM_URL=https://github.com/mikepenz/AboutLibraries
POM_SCM_CONNECTION=scm:[email protected]:mikepenz/AboutLibraries.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.ResolvedDependency
import org.gradle.internal.component.AmbiguousVariantSelectionException
import org.slf4j.LoggerFactory

/**
Expand Down Expand Up @@ -73,17 +72,21 @@ class DependencyCollector(
.forEach { (variant, configuration) ->
val variantSet = mutableCollectContainer.getOrPut(variant) { sortedMapOf(compareBy<String> { it }) }
val visitedDependencyNames = mutableSetOf<String>()

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())
}

if (LOGGER.isDebugEnabled) LOGGER.debug("Completed-fetching dependencies for $variant")
}
return CollectedContainer(mutableCollectContainer)
}
Expand All @@ -101,22 +104,29 @@ class DependencyCollector(
if (name !in visitedDependencyNames) {
visitedDependencyNames += name

if (LOGGER.isDebugEnabled) LOGGER.debug("handling resolved artifact :: $name")

try {
resolvedArtifacts += when {
resolvedDependency.moduleVersion == "unspecified" -> {
if (LOGGER.isDebugEnabled) LOGGER.debug("artifact has unspecified version")
resolvedDependency.children.getResolvedArtifacts(
visitedDependencyNames = visitedDependencyNames
)
}

includePlatform && resolvedDependency.isPlatform -> {
if (LOGGER.isDebugEnabled) LOGGER.debug("artifact is platform")
setOf(resolvedDependency.toResolvedBomArtifact())
}

else -> resolvedDependency.allModuleArtifacts
else -> {
if (LOGGER.isDebugEnabled) LOGGER.debug("retrieve allModuleArtifacts from artifact")
resolvedDependency.allModuleArtifacts
}
}
} catch (e: AmbiguousVariantSelectionException) {
LOGGER.info("Found ambiguous variant - $resolvedDependency", e)
} catch (e: Throwable) {
LOGGER.warn("Found ambiguous variant - $resolvedDependency", e)
}
}
}
Expand Down

0 comments on commit db53238

Please sign in to comment.