Skip to content

Instantly share code, notes, and snippets.

@polypus74
Created August 25, 2010 19:02
Show Gist options
  • Save polypus74/550072 to your computer and use it in GitHub Desktop.
Save polypus74/550072 to your computer and use it in GitHub Desktop.
;; the project file
(defproject lein-javafx "0.1.0"
:dependencies [[javafxc "1.3.1"]]
:hooks [leiningen.hooks.lein-javafx-hooks])
;; the javafxc task file
(ns leiningen.javafxc
(:import com.sun.tools.javafx.ant.JavaFxAntTask
java.io.File)
(:use [lancet :only (ant-project set-properties!)]
[leiningen.classpath :only (make-path get-classpath)]))
(defn- javafx-ant-task [props]
(doto (JavaFxAntTask.)
(.init)
(.setProject ant-project)
(set-properties! props)))
(defn javafxc [project]
(let [props {:srcdir (make-path (:javafx-source-path project "src/javafx"))
:destdir (File. (:compile-path project))
:executable (:javafxc-bin project "javafxc")
:classpath (apply make-path
(get-classpath project))}]
(.execute (javafx-ant-task props))))
;; the hooks file
(ns leiningen.hooks.lein-javafx-hooks
(:require [leiningen.compile :as lc])
(:use leiningen.javafx
leiningen.javafxc
robert.hooke))
(add-hook #'lc/compile
(fn [compile-task project & args]
(apply compile-task project args)
(javafxc project)))
(add-hook #'javafx
(fn [javafx-task project & args]
(lc/compile project)
(apply javafx-task project args)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment