Skip to content
This repository
Browse code

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...
commit 4d8f144c508043553351f979866295c61e80e5be 1 parent 4eceda6
Alois Cochard authored February 15, 2012
5  build.sh
... ...
@@ -1,5 +0,0 @@
1  
-#!/bin/sh
2  
-sbt 'project sindi-compiler' +clean-files +clean +proguard +publish-local
3  
-rename -f s/.min.jar/.jar/ sindi-compiler/target/scala*/sindi-compiler*.min.jar
4  
-sbt 'project sindi-compiler' +publish-local
5  
-sbt 'project sindi-core' +clean-files +clean +publish-local
21  project/Sindi.scala
@@ -49,10 +49,7 @@ object SindiBuild extends Build {
49 49
   lazy val core = Project(
50 50
     "sindi-core",
51 51
     file("sindi-core"),
52  
-    settings = buildSettings ++ fmppSettings ++ Sonatype.settings ++ testDependencies ++
53  
-                // WORKAROUND for https://github.com/harrah/xsbt/issues/85
54  
-                // Remove when updated to SBT 0.11
55  
-                Seq(unmanagedClasspath in Compile += Attributed.blank(new java.io.File("doesnotexist")))
  52
+    settings = buildSettings ++ fmppSettings ++ Sonatype.settings ++ testDependencies
56 53
   ) configs (Fmpp)
57 54
 
58 55
   lazy val compiler = Project(
@@ -60,7 +57,19 @@ object SindiBuild extends Build {
60 57
     file("sindi-compiler"),
61 58
     settings = buildSettings ++ Sonatype.settings ++ testDependencies ++
62 59
                   Seq(
63  
-                    libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "provided")
  60
+                    libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "provided"),
  61
+                    assembly <<= (clean, proguard, minJarPath, artifactPath in (Compile, packageBin), streams) map {
  62
+                      (_, _, min, artifact, streams) => {
  63
+                        streams.log("assembly").info("copy %s --> %s".format(min, artifact))
  64
+                        IO.copyFile(min, artifact)
  65
+                      }
  66
+                    },
  67
+                    publish <<= (assembly, deliver, ivyModule, publishConfiguration, streams) map { 
  68
+                      (_, _, module, config, s) => IvyActions.publish(module, config, s.log)
  69
+                    },
  70
+                    publishLocal <<= (assembly, deliverLocal, ivyModule, publishLocalConfiguration, streams) map { 
  71
+                      (_, _, module, config, s) => IvyActions.publish(module, config, s.log)
  72
+                    }
64 73
                   ) ++
65 74
                   seq(
66 75
                     (proguardSettings ++ seq(
@@ -72,6 +81,8 @@ object SindiBuild extends Build {
72 81
                     ):_*)
73 82
                 ) 
74 83
   ) dependsOn (core)
  84
+
  85
+  val assembly = TaskKey[Unit]("assembly")
75 86
 }
76 87
 
77 88
 object Sonatype extends PublishToSonatype(SindiBuild) {
9  publish.sh
... ...
@@ -1,9 +0,0 @@
1  
-#!/bin/sh
2  
-sbt test
3  
-echo
4  
-read -p "Press <ENTER> to start publishing..." x
5  
-echo
6  
-sbt 'project sindi-compiler' +clean-files +clean +proguard +publish-local
7  
-rename -f s/.min.jar/.jar/ sindi-compiler/target/scala*/sindi-compiler*.min.jar
8  
-sbt 'project sindi-compiler' +publish
9  
-sbt 'project sindi-core' +clean-files +clean +publish

0 notes on commit 4d8f144

Please sign in to comment.
Something went wrong with that request. Please try again.