 (ns leiningen.droid.compile
   "This part of the plugin is responsible for the project compilation."
   (:refer-clojure :exclude [compile])
-  (:require [leiningen compile javac]
+  (:require [bultitude.core :as bultitude]
             [clojure.java.io :as io]
-            [clojure.set :as sets]
+            [clojure.set :as set]
+            [clojure.string :as str]
+            [clostache.parser :as clostache]
+            [leiningen.compile :refer [stale-namespaces]]
+            [leiningen.core.classpath :refer [get-classpath]]
             [leiningen.core.eval :as eval]
-            [clojure.string :as st]
-            [clostache.parser :as clostache])
-  (:use [leiningen.droid.utils :only [get-sdk-android-jar sdk-binary
-                                      ensure-paths sh dev-build?]]            
-        [leiningen.new.templates :only [slurp-resource sanitize]]
-        [leiningen.droid.manifest :only [get-package-name generate-manifest]]
-        [leiningen.core
-         [main :only [debug info abort]]
-         [classpath :only [get-classpath]]]
-        [bultitude.core :only [namespaces-on-classpath]]))
+            [leiningen.core.main :refer [debug info abort]]
+            [leiningen.droid.manifest :refer [get-package-name generate-manifest]]
+            [leiningen.droid.utils :refer [get-sdk-android-jar sdk-binary
+                                           ensure-paths sh dev-build?]]
+            leiningen.javac
+            [leiningen.new.templates :refer [slurp-resource sanitize]])
+  (:import java.util.regex.Pattern))
 
 ;; ### Pre-compilation tasks
 

        external-resources
        "-I" android-jar
        "-J" gen-path
        "--generate-dependencies"))
  project)

(defn code-gen
  "Generates R.java and builds a manifest with the appropriate version

       constants))

(defn generate-build-constants
  [{{:keys [manifest-path gen-path build-config rename-manifest-package]}
    :android :as project}]
  (let [res                (io/resource "templates/BuildConfig.java")
        package-name       (get-package-name manifest-path)
        package-path       (apply io/file gen-path (str/split package-name #"\."))
        version-name       (-> project :version)
        application-id     (or rename-manifest-package package-name)
        template-constants (map-constants (merge {"VERSION_NAME"   version-name
                                                  "APPLICATION_ID" application-id}
                                                 build-config))]
