[Gradle] IdeaKotlinProjectArtifactDependencyMatcher: Migrate to 'BuildIdentifier.getBuildPath'

^KT-58157 In Progress
This commit is contained in:
Sebastian Sellmair
2023-07-27 17:39:49 +02:00
committed by Space Team
parent fc359acb37
commit 33a61c62ba
2 changed files with 4 additions and 4 deletions
@@ -13,7 +13,7 @@ import java.io.File
internal class IdeaKotlinProjectArtifactDependencyMatcher( internal class IdeaKotlinProjectArtifactDependencyMatcher(
val type: IdeaKotlinSourceDependency.Type, val type: IdeaKotlinSourceDependency.Type,
val buildId: String, val buildPath: String,
val projectPath: String, val projectPath: String,
val artifactFilePath: FilePathRegex val artifactFilePath: FilePathRegex
) : IdeaKotlinDependencyMatcher { ) : IdeaKotlinDependencyMatcher {
@@ -23,7 +23,7 @@ internal class IdeaKotlinProjectArtifactDependencyMatcher(
override fun matches(dependency: IdeaKotlinDependency): Boolean { override fun matches(dependency: IdeaKotlinDependency): Boolean {
if (dependency !is IdeaKotlinProjectArtifactDependency) return false if (dependency !is IdeaKotlinProjectArtifactDependency) return false
return dependency.type == type && return dependency.type == type &&
dependency.coordinates.buildId == buildId && dependency.coordinates.buildPath == buildPath &&
dependency.coordinates.projectPath == projectPath && dependency.coordinates.projectPath == projectPath &&
dependency.artifactsClasspath.any { artifactFilePath.matches(it) } dependency.artifactsClasspath.any { artifactFilePath.matches(it) }
@@ -51,12 +51,12 @@ fun projectArtifactDependency(
buildIdAndProjectPath: String, artifactFilePath: FilePathRegex buildIdAndProjectPath: String, artifactFilePath: FilePathRegex
): IdeaKotlinDependencyMatcher { ): IdeaKotlinDependencyMatcher {
val slicedProjectPath = buildIdAndProjectPath.split("::", limit = 2) val slicedProjectPath = buildIdAndProjectPath.split("::", limit = 2)
val buildId = if (slicedProjectPath.size == 2) slicedProjectPath.first() else ":" val buildPath = if (slicedProjectPath.size == 2) slicedProjectPath.first() else ":"
val projectPath = if (slicedProjectPath.size == 2) ":" + slicedProjectPath.last() else slicedProjectPath.last() val projectPath = if (slicedProjectPath.size == 2) ":" + slicedProjectPath.last() else slicedProjectPath.last()
return IdeaKotlinProjectArtifactDependencyMatcher( return IdeaKotlinProjectArtifactDependencyMatcher(
type = type, type = type,
buildId = buildId, buildPath = buildPath,
projectPath = projectPath, projectPath = projectPath,
artifactFilePath = artifactFilePath artifactFilePath = artifactFilePath
) )