From a8c3faefcb647e5f338d6f7d837c257750ee54e2 Mon Sep 17 00:00:00 2001 From: Tim Harper Date: Sun, 17 Jan 2016 14:22:01 -0700 Subject: [PATCH] Move com.typesafe.sbt.pgp to com.jsuereth.sbtpgp It's odd for the namespace of the plugin to not match the artifact namespace. Also, cleans up obvious, low-hanging-fruit deprecation warnings. --- build.sbt | 2 +- .../main/scala/com/jsuereth/pgp/package.scala | 5 ++--- .../src/main/scala-sbt-0.13/Compat.scala | 0 .../src/main/scala-sbt-1.0/Compat.scala | 0 .../com/jsuereth/pgp/cli/CommonParsers.scala | 4 ++-- .../scala/com/jsuereth/pgp/cli/Display.scala | 0 .../scala/com/jsuereth/pgp/cli/EncryptFile.scala | 0 .../com/jsuereth/pgp/cli/EncryptMessage.scala | 0 .../scala/com/jsuereth/pgp/cli/ExportKey.scala | 0 .../com/jsuereth/pgp/cli/GeneratePgpKey.scala | 0 .../scala/com/jsuereth/pgp/cli/ImportKey.scala | 0 .../scala/com/jsuereth/pgp/cli/ListKeys.scala | 0 .../scala/com/jsuereth/pgp/cli/ListSigs.scala | 0 .../scala/com/jsuereth/pgp/cli/SignKey.scala | 0 .../scala/com/jsuereth/pgp/cli/commands.scala | 0 .../scala/com/jsuereth/pgp/cli/context.scala | 0 .../scala/com/jsuereth/pgp/cli/hkpcommands.scala | 0 .../scala/com/jsuereth/sbtpgp}/PgpKeys.scala | 7 +++---- .../scala/com/jsuereth/sbtpgp}/PgpSettings.scala | 5 ++--- .../com/jsuereth/sbtpgp}/PgpSignatureCheck.scala | 11 ++++------- .../scala/com/jsuereth/sbtpgp}/PgpSigner.scala | 7 +++---- .../jsuereth/sbtpgp}/PgpVerifierFactory.scala | 3 +-- .../scala/com/jsuereth/sbtpgp}/SbtHelpers.scala | 15 +++++++-------- .../main/scala/com/jsuereth/sbtpgp}/SbtPgp.scala | 12 ++++-------- .../jsuereth/sbtpgp}/SbtPgpCommandContext.scala | 5 ++--- .../scala/com/jsuereth/sbtpgp}/package.scala | 4 ++-- .../src/sbt-test/pgp-cmd/gen-key/build.sbt | 2 +- .../sbt-test/pgp-cmd/gen-key/project/plugins.sbt | 0 .../src/sbt-test/pgp-cmd/gen-key/test | 0 .../src/sbt-test/sbt-pgp/credentials/build.sbt | 0 .../sbt-pgp/credentials/project/plugins.sbt | 0 .../src/sbt-test/sbt-pgp/credentials/pubring.pgp | Bin .../src/sbt-test/sbt-pgp/credentials/test | 0 .../src/sbt-test/sbt-pgp/skip/build.sbt | 0 .../sbt-test/sbt-pgp/skip/project/plugins.sbt | 0 .../src/sbt-test/sbt-pgp/skip/pubring.pgp | 0 .../src/sbt-test/sbt-pgp/skip/secring.pgp | 0 .../src/sbt-test/sbt-pgp/skip/test | 0 38 files changed, 34 insertions(+), 48 deletions(-) rename {pgp-plugin => sbt-pgp}/src/main/scala-sbt-0.13/Compat.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala-sbt-1.0/Compat.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala (92%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/Display.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/EncryptFile.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/EncryptMessage.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/ExportKey.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/GeneratePgpKey.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/ImportKey.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/ListKeys.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/ListSigs.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/SignKey.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/commands.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/context.scala (100%) rename {pgp-plugin => sbt-pgp}/src/main/scala/com/jsuereth/pgp/cli/hkpcommands.scala (100%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/PgpKeys.scala (97%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/PgpSettings.scala (99%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/PgpSignatureCheck.scala (98%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/PgpSigner.scala (97%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/PgpVerifierFactory.scala (98%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/SbtHelpers.scala (83%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/SbtPgp.scala (82%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/SbtPgpCommandContext.scala (98%) rename {pgp-plugin/src/main/scala/com/typesafe/sbt/pgp => sbt-pgp/src/main/scala/com/jsuereth/sbtpgp}/package.scala (82%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/pgp-cmd/gen-key/build.sbt (92%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/pgp-cmd/gen-key/project/plugins.sbt (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/pgp-cmd/gen-key/test (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/credentials/build.sbt (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/credentials/project/plugins.sbt (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/credentials/pubring.pgp (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/credentials/test (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/skip/build.sbt (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/skip/project/plugins.sbt (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/skip/pubring.pgp (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/skip/secring.pgp (100%) rename {pgp-plugin => sbt-pgp}/src/sbt-test/sbt-pgp/skip/test (100%) diff --git a/build.sbt b/build.sbt index 3b9ffac..bbb54c4 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,7 @@ lazy val library = // The sbt plugin. lazy val plugin = - Project("plugin", file("pgp-plugin")) + Project("plugin", file("sbt-pgp")) .dependsOn(library) .settings( sbtPlugin := true, diff --git a/gpg-library/src/main/scala/com/jsuereth/pgp/package.scala b/gpg-library/src/main/scala/com/jsuereth/pgp/package.scala index a2e8a94..aaaec2b 100644 --- a/gpg-library/src/main/scala/com/jsuereth/pgp/package.scala +++ b/gpg-library/src/main/scala/com/jsuereth/pgp/package.scala @@ -18,12 +18,11 @@ object PGP { } java.security.Security.addProvider(newProvider) } catch { - case t => sys.error("Could not initialize bouncy castle encryption.") + case t: Throwable => sys.error("Could not initialize bouncy castle encryption.") } /** This is a helper method used to make sure the above initialization happens. */ - def init = () - + def init(): Unit = () /** This can load your local PGP keyring. */ def loadPublicKeyRing(file: File) = PublicKeyRing loadFromFile file diff --git a/pgp-plugin/src/main/scala-sbt-0.13/Compat.scala b/sbt-pgp/src/main/scala-sbt-0.13/Compat.scala similarity index 100% rename from pgp-plugin/src/main/scala-sbt-0.13/Compat.scala rename to sbt-pgp/src/main/scala-sbt-0.13/Compat.scala diff --git a/pgp-plugin/src/main/scala-sbt-1.0/Compat.scala b/sbt-pgp/src/main/scala-sbt-1.0/Compat.scala similarity index 100% rename from pgp-plugin/src/main/scala-sbt-1.0/Compat.scala rename to sbt-pgp/src/main/scala-sbt-1.0/Compat.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala similarity index 92% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala index b6fb750..0add85d 100644 --- a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/CommonParsers.scala @@ -11,7 +11,7 @@ object CommonParsers { private def hexPublicKeyIds(ctx: PgpStaticContext): Seq[String] = try { - (ctx.publicKeyRing.publicKeys.view map (_.keyID) map ("%x" format (_))).toSeq + ctx.publicKeyRing.publicKeys.view.map(_.keyID).map("%x" format (_)).toSeq } catch { case _: Throwable => Seq.empty } @@ -23,7 +23,7 @@ object CommonParsers { private def userIds(ctx: PgpStaticContext): Seq[String] = try { - (ctx.publicKeyRing.publicKeys.view flatMap (_.userIDs)).toSeq + ctx.publicKeyRing.publicKeys.view.flatMap(_.userIDs).toSeq } catch { case _: Throwable => Seq.empty } diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/Display.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/Display.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/Display.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/Display.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/EncryptFile.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/EncryptFile.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/EncryptFile.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/EncryptFile.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/EncryptMessage.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/EncryptMessage.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/EncryptMessage.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/EncryptMessage.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ExportKey.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ExportKey.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ExportKey.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ExportKey.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/GeneratePgpKey.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/GeneratePgpKey.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/GeneratePgpKey.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/GeneratePgpKey.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ImportKey.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ImportKey.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ImportKey.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ImportKey.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ListKeys.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ListKeys.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ListKeys.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ListKeys.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ListSigs.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ListSigs.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/ListSigs.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/ListSigs.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/SignKey.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/SignKey.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/SignKey.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/SignKey.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/commands.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/commands.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/commands.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/commands.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/context.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/context.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/context.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/context.scala diff --git a/pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/hkpcommands.scala b/sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/hkpcommands.scala similarity index 100% rename from pgp-plugin/src/main/scala/com/jsuereth/pgp/cli/hkpcommands.scala rename to sbt-pgp/src/main/scala/com/jsuereth/pgp/cli/hkpcommands.scala diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpKeys.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpKeys.scala similarity index 97% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpKeys.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpKeys.scala index efd8329..5dc28ba 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpKeys.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpKeys.scala @@ -1,15 +1,14 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import sbt._ -import com.jsuereth.pgp._ import KeyRanks._ +import com.jsuereth.pgp._ import sbt.sbtpgp.Compat._ /** SBT Keys for the PGP plugin. */ object PgpKeys { - // PGP related setup + // PGP related setup val pgpSigner = taskKey[PgpSigner]("The helper class to run GPG commands.") val pgpVerifierFactory = taskKey[PgpVerifierFactory]("The helper class to verify public keys from a public key ring.") val pgpSecretRing = settingKey[File]("The location of the secret key ring. Only needed if using bouncy castle.") diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSettings.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSettings.scala similarity index 99% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSettings.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSettings.scala index aa68b34..981c85c 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSettings.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSettings.scala @@ -1,6 +1,4 @@ -package com.typesafe.sbt -package pgp - +package com.jsuereth.sbtpgp import sbt._ import Keys._ @@ -225,6 +223,7 @@ object PgpSettings { PgpSignatureCheck.checkSignaturesTask(updatePgpSignatures.value, pgpVerifierFactory.value, streams.value) } ) + lazy val globalSettings: Seq[Setting[_]] = inScope(Global)(gpgConfigurationSettings ++ nativeConfigurationSettings ++ signVerifyConfigurationSettings) /** Settings this plugin defines. TODO - require manual setting of these... */ lazy val projectSettings: Seq[Setting[_]] = signingSettings ++ verifySettings ++ Seq(commands += pgpCommand) diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSignatureCheck.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSignatureCheck.scala similarity index 98% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSignatureCheck.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSignatureCheck.scala index 512d4e7..5fea6e4 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSignatureCheck.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSignatureCheck.scala @@ -1,5 +1,4 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import sbt._ import Keys._ @@ -87,7 +86,7 @@ object PgpSignatureCheck { } /** Pretty-prints a report to the logs of all the PGP signature results. */ - def prettyPrintSingatureReport(report: SignatureCheckReport, s: TaskStreams): Unit = + def prettyPrintSingatureReport(report: SignatureCheckReport, s: TaskStreams): Unit = if(report.results.isEmpty) s.log.info("----- No Dependencies for PGP check -----") else { import report._ @@ -108,14 +107,14 @@ object PgpSignatureCheck { } foreach { x => s.log.info(prettify(x)) } } /** Returns the SignatureCheck results for all missing signature artifacts in an update. */ - private def missingSignatures(update: UpdateReport, s: TaskStreams): Seq[SignatureCheck] = + private def missingSignatures(update: UpdateReport, s: TaskStreams): Seq[SignatureCheck] = for { config <- update.configurations module <- config.modules artifact <- module.missingArtifacts if artifact.extension endsWith gpgExtension } yield SignatureCheck(module.module, artifact, SignatureCheckResult.MISSING) - + /** Returns the SignatureCheck results for all downloaded signature artifacts. */ private def checkArtifactSignatures(update: UpdateReport, pgp: PgpVerifierFactory, s: TaskStreams): Seq[SignatureCheck] = { pgp.withVerifier(pgp => for { @@ -126,5 +125,3 @@ object PgpSignatureCheck { } yield SignatureCheck(module.module, artifact, pgp.verifySignature(file, s))) } } - - diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSigner.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSigner.scala similarity index 97% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSigner.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSigner.scala index 1885156..79e4513 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSigner.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSigner.scala @@ -1,5 +1,4 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import sbt._ import Keys._ @@ -8,8 +7,8 @@ import sbt.sbtpgp.Compat._ /** The interface used to sign plugins. */ trait PgpSigner { - /** Signs a given file and writes the output to the signature file specified. - * Returns the signature file, throws on errors. + /** Signs a given file and writes the output to the signature file specified. + * Returns the signature file, throws on errors. */ def sign(file: File, signatureFile: File, s: TaskStreams): File } diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpVerifierFactory.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpVerifierFactory.scala similarity index 98% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpVerifierFactory.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpVerifierFactory.scala index 21ad7dc..4e4f986 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpVerifierFactory.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpVerifierFactory.scala @@ -1,5 +1,4 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import scala.util.matching.Regex import scala.util.control.Exception._ diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtHelpers.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtHelpers.scala similarity index 83% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtHelpers.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtHelpers.scala index b803fc9..4333baf 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtHelpers.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtHelpers.scala @@ -1,5 +1,4 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import sbt._ import Def.Initialize @@ -12,8 +11,8 @@ object SbtHelpers { * the value of the switch setting. */ def switch[T](switch: SettingKey[Boolean], - iftrue: Initialize[T], - iffalse: Initialize[T]): Initialize[T] = + iftrue: Def.Initialize[T], + iffalse: Def.Initialize[T]): Def.Initialize[T] = switch.zipWith(iftrue) { (use, first) => if(use) Some(first) else None }.zipWith(iffalse) { (opt, second) => opt getOrElse second } @@ -27,9 +26,9 @@ trait Cache[K,V] { /** This method attempts to use a cached value, if one is found. If * there is no cached value, the default is used and placed * back into the cache. - * + * * Upon any exception, the cache is cleared. - * + * * TODO - Allow subclasses to handle specific exceptions. */ @inline @@ -49,7 +48,7 @@ trait Cache[K,V] { } } -// TODO - Less ugly/dangerous hack here... +// TODO - Less ugly/dangerous hack here... // - Expire passwords after N minutes etc. // - Kill password only on password exceptions. -private[pgp] object PasswordCache extends Cache[String, Array[Char]] \ No newline at end of file +private[sbtpgp] object PasswordCache extends Cache[String, Array[Char]] diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/SbtPgp.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgp.scala similarity index 82% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/SbtPgp.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgp.scala index 50d4109..b6c0abc 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/SbtPgp.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgp.scala @@ -1,11 +1,10 @@ -package com.typesafe.sbt +package com.jsuereth.sbtpgp -import com.typesafe.sbt.pgp._ import sbt._ import sbt.sbtpgp.Compat._ /** - * This class is used to control what we expose to + * This class is used to control what we expose to * users. It grants access to all our keys in the * common naming sense of plugins. This is temporary * until we clean this plugin up for 0.12.0 usage. @@ -15,10 +14,8 @@ object SbtPgp extends AutoPlugin { override def trigger = allRequirements override def requires = pgpRequires - // Note - workaround for issues in sbt 0.13.5 autoImport - object autoImportImpl { - - val PgpKeys = pgp.PgpKeys + object autoImport { + val PgpKeys = com.jsuereth.sbtpgp.PgpKeys // TODO - Are these ok for style guide? We think so. def useGpg = PgpKeys.useGpg in Global @@ -36,7 +33,6 @@ object SbtPgp extends AutoPlugin { def signingSettings = PgpSettings.signingSettings } - val autoImport = autoImportImpl // TODO - Maybe signing settigns should be a different plugin... override val projectSettings = PgpSettings.projectSettings override val globalSettings = PgpSettings.globalSettings diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtPgpCommandContext.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgpCommandContext.scala similarity index 98% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtPgpCommandContext.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgpCommandContext.scala index de6b934..9724950 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/SbtPgpCommandContext.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgpCommandContext.scala @@ -1,5 +1,4 @@ -package com.typesafe.sbt -package pgp +package com.jsuereth.sbtpgp import sbt._ import sbt.Keys.TaskStreams @@ -55,4 +54,4 @@ case class SbtPgpCommandContext( def log = s.log // TODO - Is this the right thing to do? def output[A](msg: => A): Unit = println(msg) -} \ No newline at end of file +} diff --git a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/package.scala b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/package.scala similarity index 82% rename from pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/package.scala rename to sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/package.scala index 137ab23..8291be3 100644 --- a/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/package.scala +++ b/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/package.scala @@ -1,6 +1,6 @@ -package com.typesafe.sbt +package com.jsuereth -package object pgp { +package object sbtpgp { /** Default extension for PGP signatures. */ val gpgExtension = ".asc" diff --git a/pgp-plugin/src/sbt-test/pgp-cmd/gen-key/build.sbt b/sbt-pgp/src/sbt-test/pgp-cmd/gen-key/build.sbt similarity index 92% rename from pgp-plugin/src/sbt-test/pgp-cmd/gen-key/build.sbt rename to sbt-pgp/src/sbt-test/pgp-cmd/gen-key/build.sbt index b240307..e7c7ddf 100644 --- a/pgp-plugin/src/sbt-test/pgp-cmd/gen-key/build.sbt +++ b/sbt-pgp/src/sbt-test/pgp-cmd/gen-key/build.sbt @@ -1,4 +1,4 @@ -import com.typesafe.sbt.pgp.{SbtPgpCommandContext, PgpKeys} +import com.jsuereth.sbt.pgp.{SbtPgpCommandContext, PgpKeys} pgpSecretRing := baseDirectory.value / "secring.pgp" diff --git a/pgp-plugin/src/sbt-test/pgp-cmd/gen-key/project/plugins.sbt b/sbt-pgp/src/sbt-test/pgp-cmd/gen-key/project/plugins.sbt similarity index 100% rename from pgp-plugin/src/sbt-test/pgp-cmd/gen-key/project/plugins.sbt rename to sbt-pgp/src/sbt-test/pgp-cmd/gen-key/project/plugins.sbt diff --git a/pgp-plugin/src/sbt-test/pgp-cmd/gen-key/test b/sbt-pgp/src/sbt-test/pgp-cmd/gen-key/test similarity index 100% rename from pgp-plugin/src/sbt-test/pgp-cmd/gen-key/test rename to sbt-pgp/src/sbt-test/pgp-cmd/gen-key/test diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/credentials/build.sbt b/sbt-pgp/src/sbt-test/sbt-pgp/credentials/build.sbt similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/credentials/build.sbt rename to sbt-pgp/src/sbt-test/sbt-pgp/credentials/build.sbt diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/credentials/project/plugins.sbt b/sbt-pgp/src/sbt-test/sbt-pgp/credentials/project/plugins.sbt similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/credentials/project/plugins.sbt rename to sbt-pgp/src/sbt-test/sbt-pgp/credentials/project/plugins.sbt diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/credentials/pubring.pgp b/sbt-pgp/src/sbt-test/sbt-pgp/credentials/pubring.pgp similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/credentials/pubring.pgp rename to sbt-pgp/src/sbt-test/sbt-pgp/credentials/pubring.pgp diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/credentials/test b/sbt-pgp/src/sbt-test/sbt-pgp/credentials/test similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/credentials/test rename to sbt-pgp/src/sbt-test/sbt-pgp/credentials/test diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/skip/build.sbt b/sbt-pgp/src/sbt-test/sbt-pgp/skip/build.sbt similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/skip/build.sbt rename to sbt-pgp/src/sbt-test/sbt-pgp/skip/build.sbt diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/skip/project/plugins.sbt b/sbt-pgp/src/sbt-test/sbt-pgp/skip/project/plugins.sbt similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/skip/project/plugins.sbt rename to sbt-pgp/src/sbt-test/sbt-pgp/skip/project/plugins.sbt diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/skip/pubring.pgp b/sbt-pgp/src/sbt-test/sbt-pgp/skip/pubring.pgp similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/skip/pubring.pgp rename to sbt-pgp/src/sbt-test/sbt-pgp/skip/pubring.pgp diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/skip/secring.pgp b/sbt-pgp/src/sbt-test/sbt-pgp/skip/secring.pgp similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/skip/secring.pgp rename to sbt-pgp/src/sbt-test/sbt-pgp/skip/secring.pgp diff --git a/pgp-plugin/src/sbt-test/sbt-pgp/skip/test b/sbt-pgp/src/sbt-test/sbt-pgp/skip/test similarity index 100% rename from pgp-plugin/src/sbt-test/sbt-pgp/skip/test rename to sbt-pgp/src/sbt-test/sbt-pgp/skip/test