From 04d8568fdc0ae9944db7896933d5664339583d5f Mon Sep 17 00:00:00 2001 From: Sergey Rostov Date: Thu, 21 Feb 2019 11:51:32 +0300 Subject: [PATCH] Build: fix DistModelBuilder for copy tasks without destination dir --- .../src/main/kotlin/idea/DistModelBuilder.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/buildSrc/src/main/kotlin/idea/DistModelBuilder.kt b/buildSrc/src/main/kotlin/idea/DistModelBuilder.kt index 0f206083826..69f8cc83789 100755 --- a/buildSrc/src/main/kotlin/idea/DistModelBuilder.kt +++ b/buildSrc/src/main/kotlin/idea/DistModelBuilder.kt @@ -75,9 +75,9 @@ open class DistModelBuilder(val rootProject: Project, pw: PrintWriter) { val rootSpec = copy.rootSpec when (copy) { - is Copy -> context.setDest(copy.destinationDir.path) - is Sync -> context.setDest(copy.destinationDir.path) - is AbstractArchiveTask -> context.setDest(copy.archivePath.path) + is Copy -> copy.destinationDir?.also { context.setDest(it.path) } + is Sync -> copy.destinationDir?.also { context.setDest(it.path) } + is AbstractArchiveTask -> copy.archivePath?.also { context.setDest(it.path) } } when (copy) { @@ -100,15 +100,17 @@ open class DistModelBuilder(val rootProject: Project, pw: PrintWriter) { processCopySpec(it, newCtx) } is DefaultCopySpec -> ctx.child("DEFAULT COPY SPEC") { newCtx -> - val buildRootResolver = it.buildRootResolver() - ctx.addCopyActions(buildRootResolver.allCopyActions) - newCtx.setDest(buildRootResolver.destPath.getFile(ctx.destination!!.file).path) - processCopySpec(it, newCtx) - it.includes + if (ctx.destination != null) { + val buildRootResolver = it.buildRootResolver() + ctx.addCopyActions(buildRootResolver.allCopyActions) + newCtx.setDest(buildRootResolver.destPath.getFile(ctx.destination!!.file).path) + processCopySpec(it, newCtx) + it.includes - newCtx.child("SINGE PARENT COPY SPEC") { child -> - it.sourcePaths.forEach { - processSourcePath(it, child) + newCtx.child("SINGE PARENT COPY SPEC") { child -> + it.sourcePaths.forEach { + processSourcePath(it, child) + } } } }