Build: fix DistModelBuilder for copy tasks without destination dir

This commit is contained in:
Sergey Rostov
2019-02-21 11:51:32 +03:00
parent d467e4209a
commit 04d8568fdc
@@ -75,9 +75,9 @@ open class DistModelBuilder(val rootProject: Project, pw: PrintWriter) {
val rootSpec = copy.rootSpec val rootSpec = copy.rootSpec
when (copy) { when (copy) {
is Copy -> context.setDest(copy.destinationDir.path) is Copy -> copy.destinationDir?.also { context.setDest(it.path) }
is Sync -> context.setDest(copy.destinationDir.path) is Sync -> copy.destinationDir?.also { context.setDest(it.path) }
is AbstractArchiveTask -> context.setDest(copy.archivePath.path) is AbstractArchiveTask -> copy.archivePath?.also { context.setDest(it.path) }
} }
when (copy) { when (copy) {
@@ -100,15 +100,17 @@ open class DistModelBuilder(val rootProject: Project, pw: PrintWriter) {
processCopySpec(it, newCtx) processCopySpec(it, newCtx)
} }
is DefaultCopySpec -> ctx.child("DEFAULT COPY SPEC") { newCtx -> is DefaultCopySpec -> ctx.child("DEFAULT COPY SPEC") { newCtx ->
val buildRootResolver = it.buildRootResolver() if (ctx.destination != null) {
ctx.addCopyActions(buildRootResolver.allCopyActions) val buildRootResolver = it.buildRootResolver()
newCtx.setDest(buildRootResolver.destPath.getFile(ctx.destination!!.file).path) ctx.addCopyActions(buildRootResolver.allCopyActions)
processCopySpec(it, newCtx) newCtx.setDest(buildRootResolver.destPath.getFile(ctx.destination!!.file).path)
it.includes processCopySpec(it, newCtx)
it.includes
newCtx.child("SINGE PARENT COPY SPEC") { child -> newCtx.child("SINGE PARENT COPY SPEC") { child ->
it.sourcePaths.forEach { it.sourcePaths.forEach {
processSourcePath(it, child) processSourcePath(it, child)
}
} }
} }
} }