diff --git a/build.boot b/build.boot deleted file mode 100644 index 600dc0c..0000000 --- a/build.boot +++ /dev/null @@ -1,43 +0,0 @@ - ;-*- mode: Clojure;-*- -(set-env! :resource-paths #{"src"} - :dependencies '[[org.clojure/clojure "1.7.0-alpha5"] - [com.taoensso/timbre "3.3.1" :exclusions [com.taoensso/carmine]] - [org.clojure/core.typed "0.2.77"] - [clojure-jsr-223 "0.1.0"] - - [boot-deps "0.1.2" :scope "test"] - [midje "1.6.3" :scope "test"] - [adzerk/bootlaces "0.1.9" :scope "test"] - [zilti/boot-midje "0.2.1-SNAPSHOT" :scope "test"] - [zilti/boot-typed "0.1.1" :scope "test"]]) - -(require '[zilti.boot-midje :refer [midje]] - '[zilti.boot-typed :refer [typed]] - '[adzerk.bootlaces :refer :all]) - -(def +version+ "0.1.0-SNAPSHOT") -(bootlaces! +version+) - -(task-options! - pom {:project 'clojurefx - :version +version+ - :description "A Clojure JavaFX wrapper." - :url "https://bitbucket.com/zilti/clojurefx" - :scm {:url "https://bitbucket.com/zilti/clojurefx"} - :license {"name" "GNU Lesser General Public License 3.0" - "url" "http://www.gnu.org/licenses/lgpl-3.0.txt"}} - midje {:test-paths #{"test"} - :sources #{"src" "test"}} - typed {:namespaces #{'clojurefx.clojurefx 'clojurefx.protocols 'clojurefx.scripting}} - repl {:server true}) - -(deftask develop - [] - (task-options! - midje {:autotest true}) - - (comp (repl) - (midje) - (watch) - (typed))) - diff --git a/project.clj b/project.clj index 25e2704..20461c3 100644 --- a/project.clj +++ b/project.clj @@ -1,8 +1,7 @@ -(defproject clojurefx "0.1.0-SNAPSHOT" +(defproject clojurefx "0.0.16" :dependencies [[org.clojure/clojure "1.8.0"] [com.taoensso/timbre "4.7.4" :exclusions [com.taoensso/carmine]] - [org.clojure/core.typed "0.3.26"] [clojure-jsr-223 "0.1.0"]] - :injections [(require 'clojure.core.typed) - (clojure.core.typed/install)] - :profiles {:uberjar {:aot :all}}) + :profiles {:uberjar {:aot :all}} + :source-paths ["src"] + :java-source-paths ["src"]) diff --git a/src/clojurefx/AppWrap.java b/src/clojurefx/AppWrap.java new file mode 100644 index 0000000..fcd0cc5 --- /dev/null +++ b/src/clojurefx/AppWrap.java @@ -0,0 +1,26 @@ +package clojurefx; + +import clojure.java.api.Clojure; +import clojure.lang.IFn; +import javafx.application.Application; +import javafx.stage.Stage; + +/** + * Created by zilti on 07.01.2017. + */ +public class AppWrap extends Application { + + String ns, fn; + + public AppWrap(String ns, String fn) { + super(); + this.ns = ns; + this.fn = fn; + } + + @Override + public void start(Stage stage) throws Exception { + IFn handler = Clojure.var(ns, fn); + handler.invoke(stage); + } +} diff --git a/src/clojurefx/clojurefx.clj b/src/clojurefx/clojurefx.clj index f14c1d8..8ef2bc0 100644 --- a/src/clojurefx/clojurefx.clj +++ b/src/clojurefx/clojurefx.clj @@ -1,11 +1,14 @@ -1(ns clojurefx.clojurefx - (:require [taoensso.timbre :as timbre] - [clojure.java.io :as io] - [clojure.zip :as zip] - [clojurefx.protocols :as p] - [clojure.java.io :refer :all])) +(ns clojurefx.clojurefx + (:require [taoensso.timbre :as timbre] + [clojure.java.io :as io] + [clojure.zip :as zip] + [clojurefx.protocols :as p] + [clojure.java.io :refer :all]) + (:import (clojurefx AppWrap))) -(defonce force-toolkit-init (javafx.embed.swing.JFXPanel.)) +(defn gen-stage! [nspc fun] + (let [appwrap (AppWrap. nspc fun)] + (.launch appwrap))) ;; ## Threading helpers