Skip to content

Commit

Permalink
Merge pull request #19 from SethTisue/fat-jar
Browse files Browse the repository at this point in the history
package as fat JAR, bump version to 0.1.1
  • Loading branch information
SethTisue committed Jan 11, 2016
2 parents 5c7e573 + 10f450b commit ac92653
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ incremental recompile times.

## Building the plugin from source

`sbt package` will create `target/scala-2.11/scala-sculpt_2.11-0.1.0.jar`.
`sbt assembly` will create `target/scala-2.11/scala-sculpt_2.11-0.1.1.jar`.
(The JAR is a fat JAR that bundles its dependency on spray-json.)

## Using the plugin

You can use the compiled plugin with the Scala 2.11 compiler as follows.

Supposing you have `scala-sculpt_2.11-0.1.0.jar` in your current working directory,
along with `spray-json_2.11-1.3.2.jar` (which you can download
[here](http://repo1.maven.org/maven2/io/spray/spray-json_2.11/1.3.2/spray-json_2.11-1.3.2.jar).
Supposing you have `scala-sculpt_2.11-0.1.1.jar` in your current working directory,

Then you can do e.g.:

scalac -Xplugin:scala-sculpt_2.11-0.1.0.jar:spray-json_2.11-1.3.2.jar \
scalac -Xplugin:scala-sculpt_2.11-0.1.1.jar \
-Xplugin-require:sculpt \
-P:sculpt:out=dep.json \
Dep.scala
Expand Down Expand Up @@ -124,7 +123,7 @@ manipulation, e.g. in the REPL.

Now in a Scala 2.11 REPL with the same JARs on the classpath:

scala -classpath scala-sculpt_2.11-0.1.0.jar:spray-json_2.11-1.3.2.jar
scala -classpath scala-sculpt_2.11-0.1.1.jar

If we load `dep.json` as follows, we'll see the following graph:

Expand Down
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

organization := "com.typesafe"
name := "scala-sculpt"
version := "0.1.0"
version := "0.1.1"
licenses := Seq("Apache License v2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
homepage := Some(url("http://github.com/typesafehub/scala-sculpt"))

Expand All @@ -24,6 +24,12 @@ scalacOptions ++= Seq(
"-Xfatal-warnings"
)

// generate same JAR name as `package` would:
// - don't append "-assembly"; see issue #18
// - and do include the "_2.11", don't know why assembly removes that by default
assemblyJarName in assembly :=
s"${name.value}_${scalaBinaryVersion.value}-${version.value}.jar"

mappings in (Compile, packageBin) ++= Seq(
(baseDirectory.value / "README.md") -> "README.md",
(baseDirectory.value / "LICENSE.md") -> "LICENSE.md")
Expand Down
1 change: 1 addition & 0 deletions project/assembly.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.1")

0 comments on commit ac92653

Please sign in to comment.