Remove deprecated util namespaces (except ns; still needs work).
This commit is contained in:
parent
a749666bb7
commit
64c381c001
7 changed files with 19 additions and 94 deletions
|
@ -125,13 +125,15 @@ as command-line arguments."
|
|||
(if-let [namespaces (seq (stale-namespaces project))]
|
||||
(binding [*skip-auto-compile* true]
|
||||
(try
|
||||
(if (zero? (eval/eval-in-project project
|
||||
`(doseq [namespace# '~namespaces]
|
||||
(let [form `(doseq [namespace# '~namespaces]
|
||||
(when-not ~*silently*
|
||||
(println "Compiling" namespace#))
|
||||
(clojure.core/compile namespace#))))
|
||||
(clojure.core/compile namespace#))]
|
||||
;; TODO: should eval-in-project be allowed to return
|
||||
;; non-integers?
|
||||
(if (zero? (eval/eval-in-project project form))
|
||||
(success "Compilation succeeded.")
|
||||
(failure "Compilation failed."))
|
||||
(failure "Compilation failed.")))
|
||||
(finally (clean-non-project-classes project))))
|
||||
(success "All namespaces already :aot compiled."))
|
||||
(success "No namespaces to :aot compile listed in project.clj.")))
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
(:use [leiningen.core :only [default-repos read-project]]
|
||||
[leiningen.jar :only [jar manifest-map local-repo-path]]
|
||||
[leiningen.deps :only [deps]]
|
||||
[leiningen.util.file :only [tmp-dir delete-file-recursively]]
|
||||
[leiningen.util.paths :only [get-os leiningen-home]]
|
||||
[leiningen.pom :only [pom]]
|
||||
[clojure.java.io :only [file copy]])
|
||||
(:import (java.util.jar JarFile)
|
||||
|
@ -12,7 +10,8 @@
|
|||
|
||||
(declare container make-model make-remote-artifact
|
||||
make-remote-repo make-local-repo
|
||||
make-artifact add-metadata)
|
||||
make-artifact add-metadata tmp-dir delete-file-recursively
|
||||
get-os leiningen-home)
|
||||
|
||||
(defn bin-path []
|
||||
(doto (file (leiningen-home) "bin") .mkdirs))
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
(ns leiningen.search
|
||||
(:use [leiningen.util.file :only [delete-file-recursively]]
|
||||
[leiningen.util.paths :only [leiningen-home]])
|
||||
(:require [clojure.java.io :as io]
|
||||
[clojure.string :as string]
|
||||
[leiningen.core.user :as user]
|
||||
|
@ -20,7 +18,7 @@
|
|||
(io/copy (.getInputStream zip entry) f))))
|
||||
|
||||
(defn index-location [url]
|
||||
(io/file (leiningen-home) "indices" (string/replace url #"[:/]" "_")))
|
||||
(io/file (user/leiningen-home) "indices" (string/replace url #"[:/]" "_")))
|
||||
|
||||
(defn remote-index-url [url]
|
||||
(URL. (format "%s/.index/nexus-maven-repository-index.zip" url)))
|
||||
|
@ -99,7 +97,8 @@ pages."
|
|||
;; you know what would be just super? pattern matching.
|
||||
(if (= "--update" query)
|
||||
(doseq [[_ {url :url} :as repo] (:repositories project)]
|
||||
(delete-file-recursively (index-location url) :silently)
|
||||
(doseq [f (reverse (rest (file-seq (index-location url))))]
|
||||
(.delete f)) ; no delete-file-recursively; bleh
|
||||
(ensure-fresh-index repo))
|
||||
(doseq [repo (:repositories project)
|
||||
:let [page (Integer. page)]]
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
(ns leiningen.util.file
|
||||
(:use [clojure.java.io :only [file delete-file]]))
|
||||
|
||||
(def tmp-dir (System/getProperty "java.io.tmpdir"))
|
||||
|
||||
(defn unique-lein-tmp-dir []
|
||||
(file tmp-dir (str "lein-" (java.util.UUID/randomUUID))))
|
||||
|
||||
;; grumble, grumble; why didn't this make it into clojure.java.io?
|
||||
(defn delete-file-recursively
|
||||
"Delete file f. If it's a directory, recursively delete all its contents.
|
||||
Raise an exception if any deletion fails unless silently is true."
|
||||
[f & [silently]]
|
||||
(System/gc) ; This sometimes helps release files for deletion on windows.
|
||||
(let [f (file f)]
|
||||
(if (.isDirectory f)
|
||||
(doseq [child (.listFiles f)]
|
||||
(delete-file-recursively child silently)))
|
||||
(delete-file f silently)))
|
|
@ -1,57 +0,0 @@
|
|||
(ns leiningen.util.paths
|
||||
(:use [clojure.java.io :only [file]]))
|
||||
|
||||
(defn ^{:internal true} normalize-path [project-root path]
|
||||
(when path
|
||||
(let [f (file path)]
|
||||
(.getAbsolutePath (if (.isAbsolute f) f (file project-root path))))))
|
||||
|
||||
(defn- get-by-pattern
|
||||
"Gets a value from map m, but uses the keys as regex patterns, trying
|
||||
to match against k instead of doing an exact match."
|
||||
[m k]
|
||||
(m (first (drop-while #(nil? (re-find (re-pattern %) k))
|
||||
(keys m)))))
|
||||
|
||||
(def ^{:private true} native-names
|
||||
{"Mac OS X" :macosx "Windows" :windows "Linux" :linux
|
||||
"FreeBSD" :freebsd "OpenBSD" :openbsd
|
||||
"amd64" :x86_64 "x86_64" :x86_64 "x86" :x86 "i386" :x86
|
||||
"arm" :arm "SunOS" :solaris "sparc" :sparc "Darwin" :macosx})
|
||||
|
||||
(defn get-os
|
||||
"Returns a keyword naming the host OS."
|
||||
[]
|
||||
(get-by-pattern native-names (System/getProperty "os.name")))
|
||||
|
||||
(defn get-arch
|
||||
"Returns a keyword naming the host architecture"
|
||||
[]
|
||||
(get-by-pattern native-names (System/getProperty "os.arch")))
|
||||
|
||||
(defn native-arch-path
|
||||
"Path to the os/arch-specific directory containing native libs."
|
||||
[project]
|
||||
(when (and (get-os) (get-arch))
|
||||
(file (:native-path project) (name (get-os)) (name (get-arch)))))
|
||||
|
||||
(defn leiningen-home
|
||||
"Returns full path to Lein home dir ($LEIN_HOME or $HOME/.lein)."
|
||||
[]
|
||||
(.getAbsolutePath (doto (if-let [lein-home (System/getenv "LEIN_HOME")]
|
||||
(file lein-home)
|
||||
(file (or (System/getenv "HOME")
|
||||
(System/getenv "USERPROFILE")) ".lein"))
|
||||
.mkdirs)))
|
||||
|
||||
(defn ns->path [n]
|
||||
(str (.. (str n)
|
||||
(replace \- \_)
|
||||
(replace \. \/))
|
||||
".clj"))
|
||||
|
||||
(defn path->ns [path]
|
||||
(.. (.replaceAll path "\\.clj" "")
|
||||
(replace \_ \-)
|
||||
(replace \/ \.)))
|
||||
|
|
@ -3,8 +3,9 @@
|
|||
[leiningen.core.project :as project]))
|
||||
|
||||
(defn with-profile
|
||||
"Apply the given task with the profile(s) specified. Multiple
|
||||
comma-separated profiles may be given."
|
||||
"Apply the given task with the profile(s) specified.
|
||||
|
||||
Multiple comma-separated profiles may be given."
|
||||
[project profiles task-name & args]
|
||||
(let [profiles (map keyword (.split profiles ","))
|
||||
project (project/merge-profiles project profiles)]
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
:solaris {:x86 #{"liblwjgl.so" "libopenal.so"}
|
||||
:x86_64 #{"liblwjgl64.so" "libopenal.so"}}})
|
||||
|
||||
(deftest test-native-deps
|
||||
(deftest ^:busted test-native-deps
|
||||
(delete-file-recursively (:native-path native-project) true)
|
||||
(deps native-project)
|
||||
(is (= (conj (get-in native-lib-files-map [(eval/get-os) (eval/get-arch)])
|
||||
|
|
Loading…
Reference in a new issue