Skip to content

Commit

Permalink
Remove unused DGP utils (#3881)
Browse files Browse the repository at this point in the history
These two utilities are no longer used. They can be removed to simplify the code.
  • Loading branch information
adam-enko authored Oct 22, 2024
1 parent a9d0c77 commit 1955c11
Showing 1 changed file with 0 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
package org.jetbrains.dokka.gradle.internal

import org.gradle.api.*
import org.gradle.api.artifacts.ArtifactView
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.component.ComponentIdentifier
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.attributes.Attribute
import org.gradle.api.attributes.AttributeContainer
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.ExtensionContainer
Expand Down Expand Up @@ -113,13 +108,6 @@ internal operator fun GradleVersion.compareTo(version: String): Int =
compareTo(GradleVersion.version(version))


/** Only matches components that come from subprojects */
internal object LocalProjectOnlyFilter : Spec<ComponentIdentifier> {
override fun isSatisfiedBy(element: ComponentIdentifier?): Boolean =
element is ProjectComponentIdentifier
}


/** Invert the result of a [Spec] predicate */
internal operator fun <T> Spec<T>.not(): Spec<T> = Spec<T> { !this@not.isSatisfiedBy(it) }

Expand All @@ -145,44 +133,6 @@ internal fun <T> NamedDomainObjectContainer<T>.maybeCreate(
): T = maybeCreate(name).apply(configure)


/**
* Aggregate the incoming files from a [Configuration] (with name [named]) into [collector].
*
* Configurations that do not exist or cannot be
* [resolved][org.gradle.api.artifacts.Configuration.isCanBeResolved]
* will be ignored.
*
* @param[builtBy] An optional [TaskProvider], used to set [ConfigurableFileCollection.builtBy].
* This should not typically be used, and is only necessary in rare cases where a Gradle Plugin is
* misconfigured.
*/
internal fun ConfigurationContainer.collectIncomingFiles(
named: String,
collector: ConfigurableFileCollection,
builtBy: TaskProvider<*>? = null,
artifactViewConfiguration: ArtifactView.ViewConfiguration.() -> Unit = {
// ignore failures: it's usually okay if fetching files is best-effort because
// maybe Dokka doesn't need _all_ dependencies
lenient(true)
},
) {
val conf = findByName(named)
if (conf != null && conf.isCanBeResolved) {
val incomingFiles = conf.incoming
.artifactView(artifactViewConfiguration)
.artifacts
.resolvedArtifacts // using 'resolved' might help with triggering artifact transforms?
.map { artifacts -> artifacts.map { it.file } }

collector.from(incomingFiles)

if (builtBy != null) {
collector.builtBy(builtBy)
}
}
}


/**
* Create a new [NamedDomainObjectContainer], using
* [org.gradle.kotlin.dsl.domainObjectContainer]
Expand Down

0 comments on commit 1955c11

Please sign in to comment.