diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-07-06 21:36:28 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-07-06 21:44:29 -0400 |
commit | bb7cb00014a0355b067c03423723a309c0acbb87 (patch) | |
tree | 61d70de9648cce379adbd1fa977c995201fb972a | |
parent | bc2231720d3620b5e0459fa12c467bf675fcfdf5 (diff) | |
download | cbt-bb7cb00014a0355b067c03423723a309c0acbb87.tar.gz cbt-bb7cb00014a0355b067c03423723a309c0acbb87.tar.bz2 cbt-bb7cb00014a0355b067c03423723a309c0acbb87.zip |
publish local support
-rw-r--r-- | stage2/Lib.scala | 12 | ||||
-rw-r--r-- | stage2/Publish.scala | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/stage2/Lib.scala b/stage2/Lib.scala index a060ac6..f769c44 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -367,6 +367,18 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } } + def publishLocal( sourceFiles: Seq[File], artifacts: Seq[File], mavenCache: File, releaseFolder: String ): Unit = { + if(sourceFiles.nonEmpty){ + val targetDir = mavenCache ++ releaseFolder.stripSuffix("/") + targetDir.mkdirs + artifacts.foreach{ a => + val target = targetDir ++ ("/" ++ a.getName) + System.err.println(blue("publishing ") ++ target.getPath) + Files.copy( a.toPath, target.toPath, StandardCopyOption.REPLACE_EXISTING ) + } + } + } + def publishSigned( sourceFiles: Seq[File], artifacts: Seq[File], url: URL, credentials: Option[String] = None ): Unit = { // TODO: make concurrency configurable here if(sourceFiles.nonEmpty){ diff --git a/stage2/Publish.scala b/stage2/Publish.scala index 1cc3b70..96e856b 100644 --- a/stage2/Publish.scala +++ b/stage2/Publish.scala @@ -35,7 +35,7 @@ trait Publish extends PackageJars{ ) // ========== publish ========== - final protected def releaseFolder = s"/${groupId.replace(".","/")}/${artifactId}_$scalaMajorVersion/$version/" + final protected val releaseFolder = s"/${groupId.replace(".","/")}/${artifactId}_$scalaMajorVersion/$version/" private def snapshotUrl = new URL("https://oss.sonatype.org/content/repositories/snapshots") private def releaseUrl = new URL("https://oss.sonatype.org/service/local/staging/deploy/maven2") def publishUrl = if(version.endsWith("-SNAPSHOT")) snapshotUrl else releaseUrl @@ -50,6 +50,14 @@ trait Publish extends PackageJars{ copy( context.copy(version = Some(version+"-SNAPSHOT")) ).publishUnsigned } + def publishLocal: Unit = { + lib.publishLocal( sourceFiles, `package` :+ pom, context.paths.mavenCache, releaseFolder ) + } + + def publishSnapshotLocal: Unit = { + copy( context.copy(version = Some(version+"-SNAPSHOT")) ).publishLocal + } + def publishUnsigned: Unit = { lib.publishUnsigned( sourceFiles, `package` :+ pom, publishUrl ++ releaseFolder, sonatypeCredentials |