diff options
Diffstat (limited to '')
-rw-r--r-- | lux-lein/src/leiningen/lux/packager.clj | 14 | ||||
-rw-r--r-- | luxc/src/lux/compiler/base.clj | 11 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache.clj | 7 |
3 files changed, 20 insertions, 12 deletions
diff --git a/lux-lein/src/leiningen/lux/packager.clj b/lux-lein/src/leiningen/lux/packager.clj index 80062b327..81a0f62d2 100644 --- a/lux-lein/src/leiningen/lux/packager.clj +++ b/lux-lein/src/leiningen/lux/packager.clj @@ -57,7 +57,9 @@ "(-> File JarOutputStream Null)" [^File file ^JarOutputStream out output-dir] (let [output-dir-size (inc (.length output-dir)) - module-name (.substring (.getPath file) output-dir-size) + module-name (-> (.getPath file) + (.substring output-dir-size) + (.replace java.io.File/separator "/")) inner-files (.listFiles file) inner-modules (filter #(.isDirectory ^File %) inner-files) inner-classes (filter #(not (.isDirectory ^File %)) inner-files)] @@ -123,7 +125,7 @@ (recur (.getNextJarEntry is)))) )))) -(def default-manifest-file "./AndroidManifest.xml") +(def default-manifest-file (str "." java.io.File/separator "AndroidManifest.xml")) ;; [Resources] (defn package @@ -132,7 +134,7 @@ (let [output-dir (get-in project [:lux :target] &utils/output-dir) output-package-name (get project :jar-name &utils/output-package) output-dir (get-in project [:lux :target] &utils/output-dir) - output-package (str output-dir "/" output-package-name) + output-package (str output-dir java.io.File/separator output-package-name) !all-jar-files (atom {}) includes-android? (boolean (some #(-> % first (= 'com.google.android/android)) (get project :dependencies))) @@ -174,11 +176,11 @@ "[DX END]")) manifest-path (get-in project [:lux :android :manifest] default-manifest-file) sdk-path (get-in project [:lux :android :sdk]) - android-path (str sdk-path "/platforms/android-" (get-in project [:lux :android :version]) "/android.jar") + android-path (str sdk-path java.io.File/separator "platforms" java.io.File/separator "android-" (get-in project [:lux :android :version]) java.io.File/separator "android.jar") _ (assert (.exists (new File android-path)) (str "Can't find Android JAR: " android-path)) output-apk-unaligned-name (string/replace output-package-name #"\.jar$" ".apk.unaligned") - output-apk-unaligned-path (str output-dir "/" output-apk-unaligned-name) + output-apk-unaligned-path (str output-dir java.io.File/separator output-apk-unaligned-name) output-apk-path (string/replace output-package #"\.jar$" ".apk") current-working-dir (.getCanonicalPath (new File ".")) _ (do (.delete (new File output-apk-unaligned-path)) @@ -190,7 +192,7 @@ (apply str " " (interleave (repeat (count resources-dirs) "-S ") (->> (get-in project [:lux :android :resources] ["android-resources"]) - (map (partial str current-working-dir "/")) + (map (partial str current-working-dir java.io.File/separator)) (filter #(.exists (new File %))))))) nil "[AAPT PACKAGE BEGIN]" diff --git a/luxc/src/lux/compiler/base.clj b/luxc/src/lux/compiler/base.clj index c396504f4..1e508f6ea 100644 --- a/luxc/src/lux/compiler/base.clj +++ b/luxc/src/lux/compiler/base.clj @@ -50,11 +50,12 @@ (defn ^:private write-file [^String file-name ^bytes data] (do (assert (not (.exists (File. file-name))) (str "Can't overwrite file: " file-name)) (with-open [stream (BufferedOutputStream. (FileOutputStream. file-name))] - (.write stream data)))) + (.write stream data) + (.flush stream)))) (defn ^:private write-output [module name data] - (let [module* (&host/->module-class module) - module-dir (str @!output-dir java.io.File/separator module*)] + (let [^String module* (&host/->module-class module) + module-dir (str @!output-dir java.io.File/separator (.replace module* "/" java.io.File/separator))] (.mkdirs (File. module-dir)) (write-file (str module-dir java.io.File/separator name ".class") data))) @@ -86,14 +87,14 @@ (defn write-module-descriptor! [^String name ^String descriptor] (|do [_ (return nil) - :let [lmd-dir (str @!output-dir java.io.File/separator name) + :let [lmd-dir (str @!output-dir java.io.File/separator (.replace name "/" java.io.File/separator)) _ (.mkdirs (File. lmd-dir)) _ (write-file (str lmd-dir java.io.File/separator lux-module-descriptor-name) (.getBytes descriptor java.nio.charset.StandardCharsets/UTF_8))]] (return nil))) (defn read-module-descriptor! [^String name] (|do [_ (return nil)] - (return (slurp (str @!output-dir java.io.File/separator name java.io.File/separator lux-module-descriptor-name) + (return (slurp (str @!output-dir java.io.File/separator (.replace name "/" java.io.File/separator) java.io.File/separator lux-module-descriptor-name) :encoding "UTF-8")))) (do-template [<wrap-name> <unwrap-name> <class> <unwrap-method> <prim> <dup>] diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index 4bb144734..8c30f8c68 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -81,7 +81,12 @@ outdated-modules (->> (new File ^String @&&/!output-dir) .listFiles (filter #(.isDirectory ^File %)) (map module-dirs) doall (apply concat) - (map #(-> ^File % .getAbsolutePath (string/replace output-dir-prefix ""))) + (map (fn [^File dir-file] + (let [^String dir-module (-> dir-file + .getAbsolutePath + (string/replace output-dir-prefix "")) + corrected-dir-module (.replace dir-module java.io.File/separator "/")] + corrected-dir-module))) (filter outdated?))] (doseq [^String f outdated-modules] (clean-file (new File (str output-dir-prefix f)))) |