aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-06-06 01:59:37 -0700
committerGitHub <noreply@github.com>2018-06-06 01:59:37 -0700
commit67aa14ac3a97ad993c8617a995ff8902d4b4dc20 (patch)
tree2ee367d9b7dd4904516eb6a8099946547ab04d1a
parent3fa51f3f6669d6c1c4c75f7596d9f437d0fca923 (diff)
parentb5a689054dba11c8d48237042a185e3d545c80b6 (diff)
downloadsbt-gpg-67aa14ac3a97ad993c8617a995ff8902d4b4dc20.tar.gz
sbt-gpg-67aa14ac3a97ad993c8617a995ff8902d4b4dc20.tar.bz2
sbt-gpg-67aa14ac3a97ad993c8617a995ff8902d4b4dc20.zip
Merge pull request #2 from jodersky/add-tests
Add tests
-rw-r--r--build.sbt5
-rw-r--r--project/plugins.sbt2
-rw-r--r--src/sbt-test/sbt-gpg/simple/build.sbt34
-rw-r--r--src/sbt-test/sbt-gpg/simple/project/build.properties1
-rw-r--r--src/sbt-test/sbt-gpg/simple/project/plugins.sbt5
-rw-r--r--src/sbt-test/sbt-gpg/simple/snakeoil.asc10
-rw-r--r--src/sbt-test/sbt-gpg/simple/src/main/scala/main.scala4
-rw-r--r--src/sbt-test/sbt-gpg/simple/test1
8 files changed, 62 insertions, 0 deletions
diff --git a/build.sbt b/build.sbt
index 4b47ee3..93e156b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -4,3 +4,8 @@ version in ThisBuild := {
import sys.process._
("git describe --always --dirty=-SNAPSHOT --match v[0-9].*" !!).tail.trim
}
+
+scriptedLaunchOpts := { scriptedLaunchOpts.value ++
+ Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
+}
+scriptedBufferLog := false
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 59d3bda..9858b8b 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,3 +1,5 @@
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.4.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.1.3")
+
+libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
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)")
+ }
+ }
+ ()
+ }
+ )
diff --git a/src/sbt-test/sbt-gpg/simple/project/build.properties b/src/sbt-test/sbt-gpg/simple/project/build.properties
new file mode 100644
index 0000000..d6e3507
--- /dev/null
+++ b/src/sbt-test/sbt-gpg/simple/project/build.properties
@@ -0,0 +1 @@
+sbt.version=1.1.6
diff --git a/src/sbt-test/sbt-gpg/simple/project/plugins.sbt b/src/sbt-test/sbt-gpg/simple/project/plugins.sbt
new file mode 100644
index 0000000..9189b14
--- /dev/null
+++ b/src/sbt-test/sbt-gpg/simple/project/plugins.sbt
@@ -0,0 +1,5 @@
+sys.props.get("plugin.version") match {
+ case Some(v) => addSbtPlugin("io.crashbox" % "sbt-gpg" % v)
+ case _ => sys.error("""|The system property 'plugin.version' is not defined.
+ |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
+}
diff --git a/src/sbt-test/sbt-gpg/simple/snakeoil.asc b/src/sbt-test/sbt-gpg/simple/snakeoil.asc
new file mode 100644
index 0000000..63c8b6c
--- /dev/null
+++ b/src/sbt-test/sbt-gpg/simple/snakeoil.asc
@@ -0,0 +1,10 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+lHcEWxeZrxMIKoZIzj0DAQcCAwRA9vfhxcWelB6JE/5f6oN9Hg4cd4T5D4Db2qzV
+lGjp1zwdNIZl7k0Rx5q8g9htiqMwaXEItTrdkon0SCBDKcSLAAD+PVWeC91kNMba
+hyDE6Uc2+SwaakJA9+nSAn6bF2+pdP0Qt7QQc2J0LWdwZyBzbmFrZW9pbIiQBBMT
+CgA4FiEErxnKxQ1V5q7g0fKO8FwH7sxY98MFAlsXma8CGwMFCwkIBwMFFQoJCAsF
+FgIDAQACHgECF4AACgkQ8FwH7sxY98OMtgD+NSSsPl4+AnRIgbfSdKPQNL3Gnq02
+6NNUtIba+/BxSJ0BANKPyV49t8yRo6CpR6Hnt9PGoY1IbkbR9MW8I5Cndeps
+=VHhU
+-----END PGP PRIVATE KEY BLOCK-----
diff --git a/src/sbt-test/sbt-gpg/simple/src/main/scala/main.scala b/src/sbt-test/sbt-gpg/simple/src/main/scala/main.scala
new file mode 100644
index 0000000..26030eb
--- /dev/null
+++ b/src/sbt-test/sbt-gpg/simple/src/main/scala/main.scala
@@ -0,0 +1,4 @@
+object Main extends App {
+ println("Hello world!")
+}
+
diff --git a/src/sbt-test/sbt-gpg/simple/test b/src/sbt-test/sbt-gpg/simple/test
new file mode 100644
index 0000000..15675b1
--- /dev/null
+++ b/src/sbt-test/sbt-gpg/simple/test
@@ -0,0 +1 @@
+> check