Skip to content

Commit e9707cb

Browse files
committed
Store currentProjectShortPath in StructureProjectExtension
1 parent 6a451c9 commit e9707cb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/kotlin/io/github/sgtsilvio/gradle/structure/StructurePlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class StructurePlugin : Plugin<Settings> {
3030
projectPathMapping: ProjectPathMapping,
3131
rootDirectory: File,
3232
) {
33-
val currentProjectShortPath = startParameter.currentDir.relativeToOrNull(rootDirectory)?.let { directoryPath ->
34-
projectPathMapping.mapDirectoryToShort(directoryPath.path)
33+
val currentProjectShortPath = startParameter.currentDir.relativeToOrNull(rootDirectory)?.let { directory ->
34+
projectPathMapping.mapDirectoryToShort(directory.path)
3535
}
3636
mapTaskPaths(
3737
startParameter.taskNames,

src/main/kotlin/io/github/sgtsilvio/gradle/structure/StructureProjectExtension.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import javax.inject.Inject
1010
@NonExtensible
1111
abstract class StructureProjectExtension @Inject internal constructor(
1212
private val projectPathMapping: ProjectPathMapping,
13-
private val project: Project,
13+
project: Project,
1414
) {
1515

16-
fun path(shortPath: String) =
17-
projectPathMapping.mapShortToFull(shortPath, projectPathMapping.mapGradleToShort(project.path))
18-
?: throw IllegalArgumentException("'$shortPath' is not a project path")
16+
private val currentProjectShortPath = projectPathMapping.mapGradleToShort(project.path)
17+
18+
fun path(shortPath: String) = projectPathMapping.mapShortToFull(shortPath, currentProjectShortPath)
19+
?: throw IllegalArgumentException("'$shortPath' is not a project path")
1920
}

0 commit comments

Comments
 (0)