From ad2bd702131b127df16d9bd6c2e59fc203120d43 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 28 Apr 2020 11:49:42 +0200 Subject: [PATCH] Use sbt-publish-rsync rather than our own (#28868) --- RELEASING.md | 2 +- build.sbt | 4 ++-- project/Doc.scala | 4 ++-- project/Paradox.scala | 4 ++-- project/Publish.scala | 26 ++------------------------ project/plugins.sbt | 1 + project/scripts/release | 4 ++-- 7 files changed, 12 insertions(+), 33 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 6484a2a152..50e3da53fe 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -77,7 +77,7 @@ It is possible to release a revised documentation to the already existing releas ``` 1. If the generated documentation looks good, send it to Gustav: ```sh - sbt "akka-docs/deployRsync akkarepo@gustav.akka.io" + sbt akka-docs/publishRsync ``` 1. Do not forget to push the new branch back to GitHub. diff --git a/build.sbt b/build.sbt index 632e64e60d..eb929573fd 100644 --- a/build.sbt +++ b/build.sbt @@ -80,7 +80,7 @@ lazy val aggregatedProjects: Seq[ProjectReference] = List[ProjectReference]( lazy val root = Project(id = "akka", base = file(".")) .aggregate(aggregatedProjects: _*) - .enablePlugins(DeployRsync) + .enablePlugins(PublishRsyncPlugin) .settings(rootSettings: _*) .settings(unidocRootIgnoreProjects := Seq(remoteTests, benchJmh, protobuf, protobufV3, akkaScalaNightly, docs)) .settings(unmanagedSources in (Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get) @@ -209,7 +209,7 @@ lazy val docs = akkaModule("akka-docs") .settings(javacOptions += "-parameters") // for Jackson .enablePlugins( AkkaParadoxPlugin, - DeployRsync, + PublishRsyncPlugin, NoPublish, ParadoxBrowse, ScaladocNoVerificationOfDiagrams, diff --git a/project/Doc.scala b/project/Doc.scala index f4d0eb274f..15cfdddc06 100644 --- a/project/Doc.scala +++ b/project/Doc.scala @@ -12,7 +12,7 @@ import sbtunidoc.GenJavadocPlugin.autoImport._ import sbt.Keys._ import sbt.File import scala.annotation.tailrec -import DeployRsync.autoImport.deployRsyncArtifacts +import com.lightbend.sbt.publishrsync.PublishRsyncPlugin.autoImport.publishRsyncArtifacts import sbt.ScopeFilter.ProjectFilter @@ -138,7 +138,7 @@ object UnidocRoot extends AutoPlugin { if (JdkOptions.isJdk8) Seq("-Xdoclint:none") else Seq("-Xdoclint:none", "--ignore-source-errors", "--no-module-directories") }, - deployRsyncArtifacts ++= { + publishRsyncArtifacts ++= { val releaseVersion = if (isSnapshot.value) "snapshot" else version.value (Compile / unidoc).value match { case Seq(japi, api) => diff --git a/project/Paradox.scala b/project/Paradox.scala index f468a17def..aeccc71ad7 100644 --- a/project/Paradox.scala +++ b/project/Paradox.scala @@ -7,7 +7,7 @@ package akka import com.lightbend.paradox.sbt.ParadoxPlugin import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport._ import com.lightbend.paradox.apidoc.ApidocPlugin -import DeployRsync.autoImport.deployRsyncArtifacts +import com.lightbend.sbt.publishrsync.PublishRsyncPlugin.autoImport._ import sbt.Keys._ import sbt._ @@ -77,7 +77,7 @@ object Paradox { name in (Compile, paradox) := "Akka", resolvers += Resolver.jcenterRepo, ApidocPlugin.autoImport.apidocRootPackage := "akka", - deployRsyncArtifacts += { + publishRsyncArtifacts += { val releaseVersion = if (isSnapshot.value) "snapshot" else version.value ((Compile / paradox).value -> s"www/docs/akka/$releaseVersion") }) diff --git a/project/Publish.scala b/project/Publish.scala index 00916c5731..c359c8144e 100644 --- a/project/Publish.scala +++ b/project/Publish.scala @@ -8,6 +8,7 @@ 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 { @@ -18,6 +19,7 @@ object Publish extends AutoPlugin { 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")), @@ -61,27 +63,3 @@ object NoPublish extends AutoPlugin { override def projectSettings = Seq(skip in publish := true, sources in (Compile, doc) := Seq.empty, whitesourceIgnore := true) } - -object DeployRsync extends AutoPlugin { - import scala.sys.process._ - import sbt.complete.DefaultParsers._ - - override def requires = plugins.JvmPlugin - - trait Keys { - val deployRsyncArtifacts = taskKey[Seq[(File, String)]]("File or directory and a path to deploy to") - val deployRsync = inputKey[Unit]("Deploy using rsync") - } - - object autoImport extends Keys - import autoImport._ - - override def projectSettings = Seq( - deployRsyncArtifacts := List(), - deployRsync := { - val (_, host) = (Space ~ StringBasic).parsed - deployRsyncArtifacts.value.foreach { - case (from, to) => s"rsync -rvz $from/ $host:$to" ! - } - }) -} diff --git a/project/plugins.sbt b/project/plugins.sbt index e94f76218a..727bf1272c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -25,3 +25,4 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") addSbtPlugin("com.hpe.sbt" % "sbt-pull-request-validator" % "1.0.0") addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.24") addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0") +addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.2") diff --git a/project/scripts/release b/project/scripts/release index 8d5038e854..6ecd11afbe 100755 --- a/project/scripts/release +++ b/project/scripts/release @@ -322,11 +322,11 @@ fi echolog "Building docs and pushing to the server..." if [ $dry_run ]; then echodry "Not actually pushing to server. Commands:" - echodry " sbt $RELEASE_OPT deployRsync" + echodry " sbt $RELEASE_OPT publishRsync" else important ssh ${release_server} "cd ${release_path}/docs/akka; git add .; git commit -m 'before publishing version $version'; true" # using Scala 2.13 here to avoid the infamous problem with missing AskSupport in classpath - important sbt -Dakka.build.scalaVersion=2.13.0 $RELEASE_OPT "deployRsync ${release_server}" + important sbt -Dakka.build.scalaVersion=2.13.0 $RELEASE_OPT publishRsync" important ssh ${release_server} "cd ${release_path}/docs/akka; git add .; git commit -m 'publish version $version'" fi