Permalink
Browse files

Fixed SBT build

- Improved Proguard support
- Automatic renaming of minified jar
- Custom publishing with proguard support

No more needs of shell scripts!
  • Loading branch information...
1 parent 4eceda6 commit 4d8f144c508043553351f979866295c61e80e5be @aloiscochard committed Feb 15, 2012
Showing with 16 additions and 19 deletions.
  1. +0 −5 build.sh
  2. +16 −5 project/Sindi.scala
  3. +0 −9 publish.sh
View
5 build.sh
@@ -1,5 +0,0 @@
-#!/bin/sh
-sbt 'project sindi-compiler' +clean-files +clean +proguard +publish-local
-rename -f s/.min.jar/.jar/ sindi-compiler/target/scala*/sindi-compiler*.min.jar
-sbt 'project sindi-compiler' +publish-local
-sbt 'project sindi-core' +clean-files +clean +publish-local
View
21 project/Sindi.scala
@@ -49,18 +49,27 @@ object SindiBuild extends Build {
lazy val core = Project(
"sindi-core",
file("sindi-core"),
- settings = buildSettings ++ fmppSettings ++ Sonatype.settings ++ testDependencies ++
- // WORKAROUND for https://github.com/harrah/xsbt/issues/85
- // Remove when updated to SBT 0.11
- Seq(unmanagedClasspath in Compile += Attributed.blank(new java.io.File("doesnotexist")))
+ settings = buildSettings ++ fmppSettings ++ Sonatype.settings ++ testDependencies
) configs (Fmpp)
lazy val compiler = Project(
"sindi-compiler",
file("sindi-compiler"),
settings = buildSettings ++ Sonatype.settings ++ testDependencies ++
Seq(
- libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "provided")
+ libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "provided"),
+ assembly <<= (clean, proguard, minJarPath, artifactPath in (Compile, packageBin), streams) map {
+ (_, _, min, artifact, streams) => {
+ streams.log("assembly").info("copy %s --> %s".format(min, artifact))
+ IO.copyFile(min, artifact)
+ }
+ },
+ publish <<= (assembly, deliver, ivyModule, publishConfiguration, streams) map {
+ (_, _, module, config, s) => IvyActions.publish(module, config, s.log)
+ },
+ publishLocal <<= (assembly, deliverLocal, ivyModule, publishLocalConfiguration, streams) map {
+ (_, _, module, config, s) => IvyActions.publish(module, config, s.log)
+ }
) ++
seq(
(proguardSettings ++ seq(
@@ -72,6 +81,8 @@ object SindiBuild extends Build {
):_*)
)
) dependsOn (core)
+
+ val assembly = TaskKey[Unit]("assembly")
}
object Sonatype extends PublishToSonatype(SindiBuild) {
View
9 publish.sh
@@ -1,9 +0,0 @@
-#!/bin/sh
-sbt test
-echo
-read -p "Press <ENTER> to start publishing..." x
-echo
-sbt 'project sindi-compiler' +clean-files +clean +proguard +publish-local
-rename -f s/.min.jar/.jar/ sindi-compiler/target/scala*/sindi-compiler*.min.jar
-sbt 'project sindi-compiler' +publish
-sbt 'project sindi-core' +clean-files +clean +publish

0 comments on commit 4d8f144

Please sign in to comment.