From facf76eb20b558a3a44a9bf21b78ccd7c12192b8 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Sat, 20 Feb 2016 15:53:09 +0100 Subject: [PATCH] Automatically publish the proguarded JAR --- build.sbt | 44 ++++++++++++++++++- .../scala-2.10/coursier/cli/Coursier.scala | 6 +++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 cli/src/main/scala-2.10/coursier/cli/Coursier.scala diff --git a/build.sbt b/build.sbt index 1816ce648..2d78c84bb 100644 --- a/build.sbt +++ b/build.sbt @@ -266,7 +266,49 @@ lazy val cli = project "-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}" ), javaOptions in (Proguard, ProguardKeys.proguard) := Seq("-Xmx3172M"), - artifactPath in Proguard := (ProguardKeys.proguardDirectory in Proguard).value / "coursier-standalone.jar" + artifactPath in Proguard := (ProguardKeys.proguardDirectory in Proguard).value / "coursier-standalone.jar", + artifacts ++= { + if (scalaBinaryVersion.value == "2.10") + Nil + else Seq( + Artifact( + moduleName.value, + "jar", + "jar", + "standalone" + ) + ) + }, + packagedArtifacts <++= { + ( + moduleName, + scalaBinaryVersion, + ProguardKeys.proguard in Proguard + ).map { + (mod, sbv, files) => + if (sbv == "2.10") + Map.empty[Artifact, File] + else { + val f = files match { + case Seq(f) => f + case Seq() => + throw new Exception("Found no proguarded files. Expected one.") + case _ => + throw new Exception("Found several proguarded files. Don't know how to publish all of them.") + } + + Map( + // FIXME Same Artifact as above + Artifact( + mod, + "jar", + "jar", + "standalone" + ) -> f + ) + } + } + } ) lazy val web = project diff --git a/cli/src/main/scala-2.10/coursier/cli/Coursier.scala b/cli/src/main/scala-2.10/coursier/cli/Coursier.scala new file mode 100644 index 000000000..1f106cc1a --- /dev/null +++ b/cli/src/main/scala-2.10/coursier/cli/Coursier.scala @@ -0,0 +1,6 @@ +package coursier.cli + +// dummy app to keep proguard quiet in 2.10 +object Coursier { + def main(args: Array[String]): Unit = {} +}