diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-09-28 10:37:32 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-09-28 10:37:32 -0400 |
commit | 92d2cebc47616a6c0782de74273d6eb6977902b0 (patch) | |
tree | 963875254570caff9dea1e07890f82b7f2108530 /stage2 | |
parent | dd96e989d81180d4bbb8b30846a53c8239dfe3ac (diff) | |
parent | 816a2cd3c5e67ceb442d40586566b9f8fd363b79 (diff) | |
download | cbt-92d2cebc47616a6c0782de74273d6eb6977902b0.tar.gz cbt-92d2cebc47616a6c0782de74273d6eb6977902b0.tar.bz2 cbt-92d2cebc47616a6c0782de74273d6eb6977902b0.zip |
Merge remote-tracking branch 'origin/master' into HEAD
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BasicBuild.scala | 7 | ||||
-rw-r--r-- | stage2/Lib.scala | 24 | ||||
-rw-r--r-- | stage2/PackageJars.scala | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index b2bb72b..bcc3646 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -57,7 +57,7 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge /** directory where jars (and the pom file) should be put */ def jarTarget: File = scalaTarget /** directory where the scaladoc should be put */ - def apiTarget: File = scalaTarget ++ "/api" + def docTarget: File = scalaTarget ++ "/api" /** directory where the class files should be put (in package directories) */ def compileTarget: File = scalaTarget ++ "/classes" /** @@ -104,7 +104,8 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge override def dependencyClasspath : ClassPath = ClassPath(localJars) ++ super.dependencyClasspath protected def compileDependencies: Seq[Dependency] = Nil - final def compileClasspath : ClassPath = ClassPath( compileDependencies.flatMap(_.exportedClasspath.files).distinct ) + final def compileClasspath : ClassPath = + dependencyClasspath ++ ClassPath( compileDependencies.flatMap(_.exportedClasspath.files).distinct ) def exportedClasspath : ClassPath = ClassPath(compile.toSeq) def targetClasspath = ClassPath(Seq(compileTarget)) @@ -129,7 +130,7 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge lib.compile( context.cbtHasChanged, needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), - sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, + sourceFiles, compileTarget, compileStatusFile, compileClasspath, context.paths.mavenCache, scalacOptions, context.classLoaderCache, zincVersion = zincVersion, scalaVersion = scalaVersion ) diff --git a/stage2/Lib.scala b/stage2/Lib.scala index c7580d4..46fecf7 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -74,7 +74,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ scalaVersion: String, sourceFiles: Seq[File], dependencyClasspath: ClassPath, - apiTarget: File, + docTarget: File, jarTarget: File, artifactId: String, scalaMajorVersion: String, @@ -86,11 +86,11 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ if(sourceFiles.isEmpty){ None } else { - apiTarget.mkdirs + docTarget.mkdirs val args = Seq( // FIXME: can we use compiler dependency here? "-cp", dependencyClasspath.string, // FIXME: does this break for builds that don't have scalac dependencies? - "-d", apiTarget.toString + "-d", docTarget.toString ) ++ compileArgs ++ sourceFiles.map(_.toString) logger.lib("creating docs for source files "+args.mkString(", ")) redirectOutToErr{ @@ -102,7 +102,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } lib.jarFile( jarTarget ++ ("/"++artifactId++"_"++scalaMajorVersion++"-"++version++"-javadoc.jar"), - Vector(apiTarget) + Vector(docTarget) ) } } @@ -199,6 +199,12 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } } + def consoleOrFail(msg: String) = { + Option(System.console).getOrElse( + throw new Exception(msg + ". java.io.Console == null. See https://github.com/cvogt/cbt/issues/236") + ) + } + def clean(target: File, force: Boolean, dryRun: Boolean, list: Boolean, help: Boolean): ExitCode = { def depthFirstFileStream(file: File): Vector[File] = { ( @@ -225,9 +231,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } else { val performDelete = ( force || { - val console = Option(System.console).getOrElse( - throw new Exception("Can't access Console. Try running `cbt direct clean` or `cbt clean list` or `cbt clean force`.") - ) + val console = consoleOrFail("Use `cbt direct clean` or `cbt clean help`") System.err.println("Files to be deleted:\n\n") files.foreach( System.err.println ) System.err.println("") @@ -314,11 +318,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } lazy val passphrase = - Option(System.console).getOrElse( - throw new Exception("Can't access Console. This probably shouldn't be run through Nailgun.") - ).readPassword( - "GPG Passphrase please:" - ).mkString + consoleOrFail( "Use `cbt direct <task>`" ).readPassword( "GPG Passphrase please:" ).mkString def sign(file: File): File = { //http://stackoverflow.com/questions/16662408/correct-way-to-sign-and-verify-signature-using-bouncycastle diff --git a/stage2/PackageJars.scala b/stage2/PackageJars.scala index 05e625b..10e4c3a 100644 --- a/stage2/PackageJars.scala +++ b/stage2/PackageJars.scala @@ -24,7 +24,7 @@ trait PackageJars extends BaseBuild with ArtifactInfo{ def docJar: Option[File] = cacheDocBasicBuild{ lib.docJar( context.cbtHasChanged, - scalaVersion, sourceFiles, dependencyClasspath, apiTarget, + scalaVersion, sourceFiles, compileClasspath, docTarget, jarTarget, artifactId, scalaMajorVersion, version, scalacOptions, context.classLoaderCache, context.paths.mavenCache ) |