Automatically publish the proguarded JAR

This commit is contained in:
Alexandre Archambault 2016-02-20 15:53:09 +01:00
parent 8f8c81e975
commit facf76eb20
2 changed files with 49 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,6 @@
package coursier.cli
// dummy app to keep proguard quiet in 2.10
object Coursier {
def main(args: Array[String]): Unit = {}
}