aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2016-07-06 23:36:40 -0400
committerGitHub <noreply@github.com>2016-07-06 23:36:40 -0400
commitc07b2e2dc582a5354fdd47b75236d1d221b98c91 (patch)
tree0777e40e452cffa0f785f1cc809ba2bc46418cb2
parentdff71b0fce364e7edab5c1a1f11dd8b32e2c3983 (diff)
parentec35ffeba2f5e8a2b1e61c3ba7da4276aa0c8211 (diff)
downloadcbt-c07b2e2dc582a5354fdd47b75236d1d221b98c91.tar.gz
cbt-c07b2e2dc582a5354fdd47b75236d1d221b98c91.tar.bz2
cbt-c07b2e2dc582a5354fdd47b75236d1d221b98c91.zip
Merge pull request #203 from cvogt/publish-local
Publish local
-rw-r--r--build/build.scala17
-rw-r--r--stage2/Lib.scala12
-rw-r--r--stage2/Publish.scala10
3 files changed, 37 insertions, 2 deletions
diff --git a/build/build.scala b/build/build.scala
index 1b69a14..8770ef6 100644
--- a/build/build.scala
+++ b/build/build.scala
@@ -1,6 +1,6 @@
import cbt._
-class Build(val context: Context) extends BaseBuild{
+class Build(val context: Context) extends Publish{
// FIXME: somehow consolidate this with cbt's own boot-strapping from source.
override def dependencies = {
super.dependencies ++ Resolver(mavenCentral).bind(
@@ -13,4 +13,19 @@ class Build(val context: Context) extends BaseBuild{
override def sources = Seq(
"nailgun_launcher", "stage1", "stage2", "compatibility"
).map(d => projectDirectory ++ ("/" + d))
+
+ def groupId: String = "org.cvogt"
+
+ def defaultVersion: String = "0.1"
+ def name: String = "cbt"
+
+ // Members declared in cbt.Publish
+ def description: String = "Fast, intuitive Build Tool for Scala"
+ def developers: Seq[cbt.Developer] = Nil
+ def inceptionYear: Int = 2016
+ def licenses: Seq[cbt.License] = Seq( License.Apache2 )
+ def organization: Option[cbt.Organization] = None
+ def scmConnection: String = ""
+ def scmUrl: String = ""
+ def url: java.net.URL = new java.net.URL("http://github.com/cvogt/cbt/")
}
diff --git a/stage2/Lib.scala b/stage2/Lib.scala
index b65af2d..81d36f3 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