Skip to content

Commit

Permalink
Merge branch 'master' into pbrant-master
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrant committed Nov 22, 2011
2 parents c19b602 + e898d0a commit 92c08d9
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 32 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
##Usage

Requires [XSBT](http://github.com/harrah/xsbt/tree/0.9).
Requires [XSBT](http://github.com/harrah/xsbt).

Maven artifacts are created for 0.9.4, 0.9.6, 0.9.7, 0.9.8, 0.9.9, 0.9.10, 0.10.0 and 0.10.1 versions.
Maven artifacts are created for 0.11.0 version.

###Adding the plugin to your build

To use the plugin in a project, you need to create `project/plugins/build.sbt`:
To use the plugin in a project, you need to create `project/plugins/build.sbt`(**since sonatype doesn't allow non standard maven layout we can't use `addSbtPlugin` here**):

resolvers += "Proguard plugin repo" at "http://siasia.github.com/maven2"

libraryDependencies <+= sbtVersion("com.github.siasia" %% "xsbt-proguard-plugin" % _)
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % (v+"-0.1.1"))
This adds plugin version corresponding to your sbt version into your build.

Expand Down
21 changes: 0 additions & 21 deletions build.sbt

This file was deleted.

23 changes: 23 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
if [[ ! $1 ]]; then
echo "Please provide artifact version"
else
VERSION=$1
TARGET=target/scala-2.9.1/sbt-0.11.0/xsbt-proguard-plugin_2.9.1-0.11.0-
POM=${TARGET}${VERSION}.pom

stty -echo
read -p "GPG passphrase: " passw; echo
stty echo

function mvn-gpg {
if [[ $2 ]]; then
CLASSIFIER=-Dclassifier=$2
fi
mvn gpg:sign-and-deploy-file -Dgpg.passphrase=$passw -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=${POM} -Dfile=${TARGET}${VERSION}$1 $CLASSIFIER
}

mvn-gpg .jar
mvn-gpg -sources.jar sources
mvn-gpg -javadoc.jar javadoc
fi
62 changes: 62 additions & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import sbt._
import ScriptedPlugin._
import Keys._

import scala.xml.{Elem, Node}

object ProguardPlugin extends Build {
def pomPostProcessTask(node: Node) = node match {
case xml: Elem =>
val children = Seq(
<url>http://github.com/siasia/xsbt-web-plugin</url>,
<licenses>
<license>
<name>GPLv2</name>
<url>http://www.gnu.org/licenses/gpl-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>,
<scm>
<connection>scm:git:git@github.com:siasia/xsbt-proguard-plugin.git</connection>
<developerConnection>scm:git:git@github.com:siasia/xsbt-proguard-plugin.git</developerConnection>
<url>git@github.com:siasia/xsbt-proguard-plugin.git</url>
</scm>,
<developers>
<developer>
<id>siasia</id>
<name>Artyom Olshevskiy</name>
<email>siasiamail@gmail.com</email>
</developer>
</developers>,
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
)
xml.copy(child = xml.child ++ children)
}
def rootSettings: Seq[Setting[_]] = Seq(
scriptedBufferLog := false,
sbtPlugin := true,
projectID <<= (organization,moduleName,version,artifacts,crossPaths){ (org,module,version,as,crossEnabled) =>
ModuleID(org, module, version).cross(crossEnabled).artifacts(as : _*)
},
name := "xsbt-proguard-plugin",
organization := "com.github.siasia",
version <<= sbtVersion(_ + "-0.1.1"),
libraryDependencies += "net.sf.proguard" % "proguard-base" % "4.6",
scalacOptions += "-deprecation",
publishMavenStyle := true,
publishTo <<= (version) {
version: String =>
val ossSonatype = "https://oss.sonatype.org/"
if (version.trim.endsWith("SNAPSHOT"))
Some("snapshots" at ossSonatype + "content/repositories/snapshots")
else None
},
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
pomIncludeRepository := ((_) => false),
pomPostProcess := (pomPostProcessTask _))
lazy val root = Project("root", file(".")) settings(scriptedSettings ++ rootSettings :_*)
}
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resolvers += Resolver.url("Typesafe Repo", url("http://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.ivyStylePatterns)

libraryDependencies <+= sbtVersion("org.scala-tools.sbt" %% "scripted-plugin" % _)
1 change: 0 additions & 1 deletion project/plugins/build.sbt

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/scala/ProguardPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object ProguardPlugin extends Plugin {
val makeInJarFilter = SettingKey[String => String]("makeInJarFilter")

private val proguardArgs = TaskKey[List[String]]("proguard-args")
val proguardInJars = SettingKey[Seq[File]]("proguard-in-jars")
val proguardInJars = TaskKey[Seq[File]]("proguard-in-jars")
val proguardInJarsTask = TaskKey[Seq[File]]("proguard-in-jars-task")
val proguardLibraryJars = TaskKey[Seq[File]]("proguard-library-jars")

Expand Down Expand Up @@ -90,7 +90,7 @@ object ProguardPlugin extends Plugin {
makeInJarFilter := { (file) => "!META-INF/MANIFEST.MF" },
proguardDefaultArgs := Seq("-dontwarn", "-dontoptimize", "-dontobfuscate"),
proguardLibraryJars := { (rtJarPath :PathFinder).get },
proguardInJars <<= (scalaInstance) { (si) => Seq(si.libraryJar) },
proguardInJars <<= (scalaInstance) map { (si) => Seq(si.libraryJar) },
proguardInJarsTask <<= proguardInJarsTaskImpl,
proguardArgs <<= proguardArgsTask,
proguard <<= (packageBin in Compile, proguardArgs in Compile, baseDirectory) map { (_, args, bd) => proguardTask(args, bd) }
Expand Down
1 change: 1 addition & 0 deletions src/sbt-test/test/initial/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % (v+"-0.1.1"))
1 change: 0 additions & 1 deletion src/sbt-test/test/initial/project/plugins/build.sbt

This file was deleted.

2 changes: 1 addition & 1 deletion src/sbt-test/test/initial/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
> ++ 2.8.1
> proguard
$ exists target/scala-2.8.1.final/default_2.8.1-0.1.min.jar
$ exists target/scala-2.8.1/default_2.8.1-0.1.min.jar

0 comments on commit 92c08d9

Please sign in to comment.