diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-08 22:29:29 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-08 22:37:39 -0400 |
commit | b103b922f8671e7f45cef0cbd876ebe26cb0a2fa (patch) | |
tree | f5ed98ca10fbd55b73b1c743c6faa6ccda8f664d /stage2 | |
parent | bf534fc64e54af905402833cace7687d73ba8817 (diff) | |
download | cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.tar.gz cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.tar.bz2 cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.zip |
Always create directory before trying to write file
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/Lib.scala | 4 | ||||
-rw-r--r-- | stage2/PublishBuild.scala | 4 | ||||
-rw-r--r-- | stage2/Scaffold.scala | 3 | ||||
-rw-r--r-- | stage2/ToolsTasks.scala | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/stage2/Lib.scala b/stage2/Lib.scala index ac7b45c..b76402a 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -241,6 +241,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ if( files.isEmpty ){ None } else { + jarFile.getParentFile.mkdirs logger.lib("Start packaging "++jarFile.string) val manifest = new Manifest manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0") @@ -360,8 +361,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ // FIXME: do not build this file name including scalaMajorVersion in multiple places val path = jarTarget.toString ++ ( "/" ++ artifactId++ "_" ++ scalaMajorVersion ++ "-" ++ version ++ ".pom" ) val file = new File(path) - Files.write(file.toPath, ("<?xml version='1.0' encoding='UTF-8'?>\n" ++ xml.toString).getBytes) - file + write(file, "<?xml version='1.0' encoding='UTF-8'?>\n" ++ xml.toString) } def concurrently[T,R]( concurrencyEnabled: Boolean )( items: Seq[T] )( projection: T => R ): Seq[R] = { diff --git a/stage2/PublishBuild.scala b/stage2/PublishBuild.scala index 34c1d4f..2bf88bc 100644 --- a/stage2/PublishBuild.scala +++ b/stage2/PublishBuild.scala @@ -52,12 +52,12 @@ abstract class PublishBuild(context: Context) extends PackageBuild(context){ def publishUnsigned: Unit = { lib.publishUnsigned( - sourceFiles, pom +: `package`, publishUrl ++ releaseFolder, sonatypeCredentials + sourceFiles, `package` :+ pom, publishUrl ++ releaseFolder, sonatypeCredentials ) } def publishSigned: Unit = { lib.publishSigned( - sourceFiles, pom +: `package`, publishUrl ++ releaseFolder, sonatypeCredentials + sourceFiles, `package` :+ pom, publishUrl ++ releaseFolder, sonatypeCredentials ) } } diff --git a/stage2/Scaffold.scala b/stage2/Scaffold.scala index 1f3d515..78242fc 100644 --- a/stage2/Scaffold.scala +++ b/stage2/Scaffold.scala @@ -7,8 +7,7 @@ trait Scaffold{ private def createFile( projectDirectory: File, fileName: String, code: String ){ val outputFile = projectDirectory ++ ("/" ++ fileName) - outputFile.getParentFile.mkdirs - Files.write( ( outputFile ).toPath, code.getBytes, StandardOpenOption.CREATE_NEW ) + Stage0Lib.write( outputFile, code, StandardOpenOption.CREATE_NEW ) import scala.Console._ println( GREEN ++ "Created " ++ fileName ++ RESET ) } diff --git a/stage2/ToolsTasks.scala b/stage2/ToolsTasks.scala index df33b5d..d388f12 100644 --- a/stage2/ToolsTasks.scala +++ b/stage2/ToolsTasks.scala @@ -137,7 +137,7 @@ ${assignments.mkString("\n")} } """ val file = nailgun ++ ("/" ++ "EarlyDependencies.java") - Files.write( file.toPath, code.getBytes ) + lib.write( file, code ) println( Console.GREEN ++ "Wrote " ++ file.string ++ Console.RESET ) } } |