mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
parent
94400756ff
commit
38d2187eae
2 changed files with 11 additions and 8 deletions
|
@ -21,9 +21,8 @@ open class IncludeFromTo {
|
|||
|
||||
@Directive
|
||||
fun copy(from: From, to: To) {
|
||||
with(File(from.path)) {
|
||||
includedFiles.add(IncludedFile(from, to, listOf(IFileSpec.FileSpec(name))))
|
||||
}
|
||||
val dir = File(from.path).parentFile
|
||||
includedFiles.add(IncludedFile(from(dir.absolutePath), to, listOf(IFileSpec.FileSpec(from.path))))
|
||||
}
|
||||
|
||||
@Directive
|
||||
|
|
|
@ -220,13 +220,17 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
|||
val toDir = KFiles.makeDir(config.target)
|
||||
File(buildDir).copyRecursively(toDir, overwrite = true)
|
||||
} else {
|
||||
config.includedFiles.forEach { inf ->
|
||||
val target = inf.to
|
||||
val targetFile = File(target)
|
||||
val files = KFiles.materializeIncludedFiles(project, listOf(inf))
|
||||
// Delete all target directories
|
||||
val targetDirs = config.includedFiles.map { File(it.to) }.distinct().forEach { targetFile ->
|
||||
val isFile = targetFile.isFile
|
||||
context.logger.log(project.name, 2, " Deleting target dir $targetFile")
|
||||
targetFile.deleteRecursively()
|
||||
targetFile.mkdirs()
|
||||
if (! isFile) targetFile.mkdirs()
|
||||
}
|
||||
// Perform the installations
|
||||
config.includedFiles.forEach { inf ->
|
||||
val targetFile = File(inf.to)
|
||||
val files = KFiles.materializeIncludedFiles(project, listOf(inf))
|
||||
files.forEach {
|
||||
context.logger.log(project.name, 1, " Installing $it to $targetFile")
|
||||
KFiles.copyRecursively(it, targetFile, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue