-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublish.scala
66 lines (55 loc) · 2 KB
/
Publish.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright (C) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
*/
package akka
import sbt._
import sbt.Keys._
import java.io.File
import sbtwhitesource.WhiteSourcePlugin.autoImport.whitesourceIgnore
import com.lightbend.sbt.publishrsync.PublishRsyncPlugin.autoImport.publishRsyncHost
object Publish extends AutoPlugin {
val defaultPublishTo = settingKey[File]("Default publish directory")
override def trigger = allRequirements
override lazy val projectSettings = Seq(
pomExtra := akkaPomExtra,
publishTo := Some(akkaPublishTo.value),
publishRsyncHost := "akkarepo@gustav.akka.io",
credentials ++= akkaCredentials,
organizationName := "Lightbend Inc.",
organizationHomepage := Some(url("https://www.lightbend.com")),
publishMavenStyle := true,
pomIncludeRepository := { x =>
false
},
defaultPublishTo := target.value / "repository")
def akkaPomExtra = {
<inceptionYear>2009</inceptionYear>
<developers>
<developer>
<id>akka-contributors</id>
<name>Akka Contributors</name>
<email>akka.official@gmail.com</email>
<url>https://github.com/akka/akka/graphs/contributors</url>
</developer>
</developers>
}
private def akkaPublishTo = Def.setting {
val key = new java.io.File(
Option(System.getProperty("akka.gustav.key"))
.getOrElse(System.getProperty("user.home") + "/.ssh/id_rsa_gustav.pem"))
if (isSnapshot.value)
Resolver.sftp("Akka snapshots", "gustav.akka.io", "/home/akkarepo/www/snapshots").as("akkarepo", key)
else
Opts.resolver.sonatypeStaging
}
private def akkaCredentials: Seq[Credentials] =
Option(System.getProperty("akka.publish.credentials")).map(f => Credentials(new File(f))).toSeq
}
/**
* For projects that are not to be published.
*/
object NoPublish extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def projectSettings =
Seq(skip in publish := true, sources in (Compile, doc) := Seq.empty, whitesourceIgnore := true)
}