[Gradle] Refactor ResolvedDependencyGraph to use Lazy instead provider
It simplifies constructor API. Also constructor changed from `operator fun invoke` to just a regular factory method on companion object.
This commit is contained in:
+2
-3
@@ -561,7 +561,7 @@ constructor(
|
||||
val exportLibraries: FileCollection get() = exportLibrariesResolvedGraph?.files ?: objectFactory.fileCollection()
|
||||
|
||||
private val exportLibrariesResolvedGraph = if (binary is AbstractNativeLibrary) {
|
||||
ResolvedDependencyGraph(project, project.configurations.getByName(binary.exportConfigurationName))
|
||||
ResolvedDependencyGraph.fromConfiguration(project.configurations.getByName(binary.exportConfigurationName))
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@@ -640,8 +640,7 @@ constructor(
|
||||
@get:Internal
|
||||
internal abstract val konanPropertiesService: Property<KonanPropertiesBuildService>
|
||||
|
||||
private val resolvedDependencyGraph = ResolvedDependencyGraph(
|
||||
project,
|
||||
private val resolvedDependencyGraph = ResolvedDependencyGraph.fromConfiguration(
|
||||
project.configurations.getByName(compilation.compileDependencyConfigurationName)
|
||||
)
|
||||
|
||||
|
||||
+5
-5
@@ -27,11 +27,11 @@ internal const val INTRANSITIVE = "intransitive"
|
||||
* Gradle Configuration Cache-friendly representation of resolved Configuration
|
||||
*/
|
||||
internal class ResolvedDependencyGraph
|
||||
private constructor (
|
||||
private val graphRootProvider: Provider<ResolvedComponentResult>,
|
||||
private constructor(
|
||||
private val resolvedComponentsRootProvider: Lazy<ResolvedComponentResult>,
|
||||
private val artifactCollection: ArtifactCollection
|
||||
) {
|
||||
val root get() = graphRootProvider.get()
|
||||
val root get() = resolvedComponentsRootProvider.value
|
||||
val files: FileCollection get() = artifactCollection.artifactFiles
|
||||
val artifacts get() = artifactCollection.artifacts
|
||||
|
||||
@@ -54,8 +54,8 @@ private constructor (
|
||||
}
|
||||
|
||||
companion object {
|
||||
operator fun invoke(project: Project, configuration: Configuration) = ResolvedDependencyGraph(
|
||||
graphRootProvider = configuration.incoming.resolutionResult.let { rr -> project.provider { rr.root } },
|
||||
fun fromConfiguration(configuration: Configuration) = ResolvedDependencyGraph(
|
||||
resolvedComponentsRootProvider = configuration.incoming.resolutionResult.let { rr -> lazy { rr.root } },
|
||||
artifactCollection = configuration.incoming.artifacts
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user