From e9135d2936ddcd0ff385b80fbed7a417aa83ead3 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 3 Sep 2024 17:51:15 +0200 Subject: [PATCH] refactor(gradle-inspector): Make use of `OrtDependency` extensions Signed-off-by: Sebastian Schuberth --- .../src/main/kotlin/GradleInspector.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt b/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt index 51704f6620ce4..f40a709636007 100644 --- a/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt +++ b/plugins/package-managers/gradle-inspector/src/main/kotlin/GradleInspector.kt @@ -350,14 +350,11 @@ private fun Collection.toPackageRefs( packageDependencies: MutableCollection ): Set = mapTo(mutableSetOf()) { dep -> - val (id, linkage) = if (dep.localPath != null) { - val id = Identifier("Gradle", dep.groupId, dep.artifactId, dep.version) - id to PackageLinkage.PROJECT_DYNAMIC + val id = Identifier(dep.dependencyType, dep.groupId, dep.artifactId, dep.version) + val linkage = if (dep.isProjectDependency) { + PackageLinkage.PROJECT_DYNAMIC } else { - packageDependencies += dep - - val id = Identifier("Maven", dep.groupId, dep.artifactId, dep.version) - id to PackageLinkage.DYNAMIC + PackageLinkage.DYNAMIC } PackageReference(id, linkage, dep.dependencies.toPackageRefs(packageDependencies))