diff --git a/README b/README index d8893c9..4df3e54 100644 --- a/README +++ b/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 - diff --git a/project.clj b/project.clj index 1bbb3ca..62e68ed 100644 --- a/project.clj +++ b/project.clj @@ -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"]]) diff --git a/sample/project.clj b/sample/project.clj index 19627bc..6dc8295 100644 --- a/sample/project.clj +++ b/sample/project.clj @@ -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"}) diff --git a/src/leiningen/javac.clj b/src/leiningen/javac.clj index 035997e..18d755c 100644 --- a/src/leiningen/javac.clj +++ b/src/leiningen/javac.clj @@ -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) diff --git a/test/leiningen/test/javac.clj b/test/leiningen/test/javac.clj index 2834a80..ee54ff7 100644 --- a/test/leiningen/test/javac.clj +++ b/test/leiningen/test/javac.clj @@ -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)))