Permalink
Browse files

Fixed lein-javac for Leiningen 1.7.0.

  • Loading branch information...
1 parent 21fafc1 commit 37b66d14f374bc4ccc6f20603a724e02a42fd0be Roman Scherer committed Feb 15, 2012
Showing with 27 additions and 18 deletions.
  1. +12 −4 README
  2. +2 −2 project.clj
  3. +4 −3 sample/project.clj
  4. +7 −7 src/leiningen/javac.clj
  5. +2 −2 test/leiningen/test/javac.clj
View
16 README
@@ -20,9 +20,9 @@ Example:
:dependencies [[org.clojure/clojure "1.2.0-beta1"]]
:dev-dependencies [[lein-javac "1.2.1-SNAPSHOT"]]
:source-path "src/clojure"
- :java-source-path [["src/java"]
- ["test/java" :debug "true"]]
- :java-options {:debug "true"})
+ :javac-source-path [["src/java"]
+ ["test/java" :debug "true"]]
+ :javac-options {:debug "true"})
## Compilation
@@ -40,6 +40,15 @@ Use Leiningen and add lein-javac to your development dependencies.
:dev-dependencies [[lein-javac "1.2.1-SNAPSHOT"]]
+## Leiningen's built-in "javac" task
+
+Leiningen has a built in "javac" task, that was derived from
+lein-javac. Unfortunately most of the lein-javac features have been
+stripped out over the time :(
+
+Use the :javac-source-path and :javac-options keywords if you want to
+use lein-javac, otherwise just :java-source-path and :java-options.
+
## Authors
- Caspar Florian Ebeling / febeling
@@ -49,4 +58,3 @@ Use Leiningen and add lein-javac to your development dependencies.
## License
EPL license
-
View
@@ -1,5 +1,5 @@
-(defproject org.clojars.r0man/lein-javac "1.2.4-SNAPSHOT"
+(defproject lein-javac "1.3.0"
:description "Java compiler plugin for Leiningen."
:dependencies [[ant/ant-launcher "1.6.5"]]
- :dev-dependencies [[leiningen/leiningen "1.6.2"]
+ :dev-dependencies [[leiningen/leiningen "1.7.0"]
[robert/hooke "1.1.2"]])
View
@@ -8,7 +8,8 @@
:dev-dependencies [[lein-javac "1.2.1-SNAPSHOT"]]
:source-path "src/clojure"
:compile-path "build/classes"
+ :plugins [[lein-javac "0.1.0"]]
:hooks [leiningen.hooks.javac]
- :java-source-path [["src/java"]
- ["test/java" :destdir "build/unit/classes"]]
- :java-options {:debug "true"})
+ :javac-source-path [["src/java"]
+ ["test/java" :destdir "build/unit/classes"]]
+ :javac-options {:debug "true"})
View
@@ -9,14 +9,14 @@ Usage:
(:import org.apache.tools.ant.types.Path java.io.File)
(:use [clojure.string :only (join)]
[leiningen.classpath :only (get-classpath)])
- (:require lancet)
+ (:require lancet.core)
(:refer-clojure :exclude [compile]))
(def ^{:dynamic true} *java-options*
{:debug "false" :fork "true" :includejavaruntime "yes"})
-(defmethod lancet/coerce [Path String] [_ str]
- (Path. lancet/ant-project str))
+(defmethod lancet.core/coerce [Path String] [_ str]
+ (Path. lancet.core/ant-project str))
(defn expand-path
"Expand a path fragment relative to the project root. If path starts
@@ -33,7 +33,7 @@ Usage:
(defn- java-options
"Returns the java compiler options of the project."
- [project] (merge *java-options* (:java-options project)))
+ [project] (merge *java-options* (:javac-options project)))
(defn extract-javac-task
"Extract a compile task from the given spec."
@@ -49,15 +49,15 @@ Usage:
(defn extract-javac-tasks
"Extract all compile tasks of the project."
[project]
- (let [specs (:java-source-path project)]
+ (let [specs (:javac-source-path project)]
(map #(extract-javac-task project %)
(if (isa? (class specs) String) [[specs]] specs))))
(defn- run-javac-task
"Compile the given task spec."
[task-spec]
- (lancet/mkdir {:dir (:destdir task-spec)})
- (lancet/javac task-spec))
+ (lancet.core/mkdir {:dir (:destdir task-spec)})
+ (lancet.core/javac task-spec))
(defn javac [project & [directory]]
(doseq [task (extract-javac-tasks project)
@@ -13,10 +13,10 @@
(def project (read-project "sample/project.clj"))
(defn- java-src-task []
- (extract-javac-task project (first (:java-source-path project))))
+ (extract-javac-task project (first (:javac-source-path project))))
(defn- java-test-task []
- (extract-javac-task project (second (:java-source-path project))))
+ (extract-javac-task project (second (:javac-source-path project))))
(defn- main-class-file []
(File. (str (expand-path project (:destdir (java-src-task)))

0 comments on commit 37b66d1

Please sign in to comment.