diff options
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BasicBuild.scala | 4 | ||||
-rw-r--r-- | stage2/Lib.scala | 10 | ||||
-rw-r--r-- | stage2/Plugin.scala | 3 |
3 files changed, 10 insertions, 7 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index e3b1c1b..8d72f9a 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -153,9 +153,11 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge ) } + def cleanFiles: Seq[File] = Seq( target ) + def clean: ExitCode = { lib.clean( - target, + cleanFiles, context.args.contains("force"), context.args.contains("dry-run"), context.args.contains("list"), diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 700f18d..b6187ce 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -223,7 +223,7 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ ) } - def clean(target: File, force: Boolean, dryRun: Boolean, list: Boolean, help: Boolean): ExitCode = { + def clean(targets: Seq[File], force: Boolean, dryRun: Boolean, list: Boolean, help: Boolean): ExitCode = { def depthFirstFileStream(file: File): Vector[File] = { ( if (file.isDirectory) { @@ -231,7 +231,7 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ } else Vector() ) :+ file } - lazy val files = depthFirstFileStream( target ) + lazy val files = targets.filter(_.exists).flatMap( depthFirstFileStream ) if( help ){ System.err.println( s""" @@ -240,8 +240,8 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ dry-run does not actually delete files """ ) ExitCode.Success - } else if (!target.exists){ - System.err.println( "Nothing to clean. Does not exist: " ++ target.string ) + } else if (files.isEmpty){ + System.err.println( "Nothing to clean." ) ExitCode.Success } else if( list ){ files.map(_.string).foreach( println ) @@ -250,7 +250,7 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ val performDelete = ( force || { val console = consoleOrFail("Use `cbt direct clean` or `cbt clean help`") - System.err.println("Files to be deleted:\n\n") + System.err.println("Files to be deleted:\n") files.foreach( System.err.println ) System.err.println("") System.err.print("To delete the above files type 'delete': ") diff --git a/stage2/Plugin.scala b/stage2/Plugin.scala index 94a8749..4d52fcc 100644 --- a/stage2/Plugin.scala +++ b/stage2/Plugin.scala @@ -1,4 +1,5 @@ package cbt trait Plugin extends BaseBuild{ - override def dependencies = super.dependencies :+ context.cbtDependency + override def dependencies = + super.dependencies :+ context.cbtDependency :+ DirectoryDependency( context.cbtHome ++ "/plugins/essentials" ) } |