diff options
Diffstat (limited to 'src/sbt-test/sbt-gpg/simple/build.sbt')
-rw-r--r-- | src/sbt-test/sbt-gpg/simple/build.sbt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/sbt-test/sbt-gpg/simple/build.sbt b/src/sbt-test/sbt-gpg/simple/build.sbt new file mode 100644 index 0000000..124217c --- /dev/null +++ b/src/sbt-test/sbt-gpg/simple/build.sbt @@ -0,0 +1,34 @@ +import sbt.librarymanagement.Artifact +import sys.process._ + +lazy val root = project + .in(file(".")) + .settings( + credentials += { + "gpg --import snakeoil.asc".!! + Credentials( + "GnuPG Key ID", + "gpg", + "AF19 CAC5 0D55 E6AE E0D1 F28E F05C 07EE CC58 F7C3", + "ignored" + ) + } + ) + .settings( + TaskKey[Unit]("check") := { + val artifacts: Map[Artifact, java.io.File] = + packagedArtifacts.value + + // check that every artifact is signed and that the actual signature file + // exists + artifacts.foreach{ case (art, file) => + if (art.extension.endsWith(".asc")) { + file.exists || sys.error(s"Signature file $file does not exist") + } else { + artifacts.contains(art.withExtension(art.extension + ".asc")) || + sys.error(s"Found unsigned artifact: $art ($file)") + } + } + () + } + ) |