Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

Commit

Permalink
Explain how to use in Leiningen 2.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jul 24, 2012
1 parent 68b34e5 commit 99cbd79
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ pom.xml
.lein-deps-sum .lein-deps-sum
/.lein-plugins/checksum /.lein-plugins/checksum
/test-project/.lein-plugins/checksum /test-project/.lein-plugins/checksum
target
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -4,16 +4,19 @@ Compile Scala source from Leiningen.


## Usage ## Usage


Add [lein-scalac "0.1.0"] to `:plugins` project.clj. (Or Add `[lein-scalac "0.1.0"]` to `:plugins` project.clj. (Or
`:dev-dependencies` on Leiningen versions earlier than 1.7.0) `:dev-dependencies` on Leiningen versions earlier than 1.7.0)


Set `:scala-source-path` in project.clj, usually to "src/scala", and Set `:scala-source-path` in project.clj, usually to "src/scala", and
place your `.scala` source files in there. place your `.scala` source files in there.


Run `lein scalac` to compile them to `.class` files. Run `lein scalac` to compile them to `.class` files.


If you'd like `scalac` to run before every `compile` invocation you If you want `scalac` to run automatically, add `:prep-tasks ["scalac"]`
can add `leiningen.hooks.scalac` to `:hooks` in project.clj. to `project.clj`

For Leiningen 1.x support, need to add `leiningen.hooks.scalac` to
`:hooks` in project.clj.


## License ## License


Expand Down
2 changes: 2 additions & 0 deletions src/leiningen/hooks/scalac.clj
Expand Up @@ -2,6 +2,8 @@
(:require [robert.hooke] (:require [robert.hooke]
[leiningen.compile])) [leiningen.compile]))


;; This is only needed in Leiningen 1.x

(robert.hooke/add-hook (resolve 'leiningen.compile/prep) (robert.hooke/add-hook (resolve 'leiningen.compile/prep)
(fn [f project & args] (fn [f project & args]
;; Don't load scalac at every lein launch. ;; Don't load scalac at every lein launch.
Expand Down
10 changes: 6 additions & 4 deletions test-project/project.clj
@@ -1,8 +1,10 @@
(defproject test-project "0.1.0" (defproject test-project "0.1.0"
:description "test project with some scala" :description "test project with some scala"
:dependencies [[org.clojure/clojure "1.3.0"] :dependencies [[org.clojure/clojure "1.4.0"]
[org.scala-lang/scala-library "2.9.1"]] [org.scala-lang/scala-library "2.9.1"]]
:scala-source-path "scala"
:plugins [[lein-scalac "0.1.0"]] :plugins [[lein-scalac "0.1.0"]]
:hooks [leiningen.hooks.scalac] :prep-tasks ["scalac"]
:source-path "src/clj" ;; for Leiningen 1.x you need this instead:
:scala-source-path "src/scala") ;; :hooks [leiningen.hooks.scalac]
:main test-project.core)
File renamed without changes.

0 comments on commit 99cbd79

Please sign in to comment.