aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/compiler/base.clj11
-rw-r--r--luxc/src/lux/compiler/cache.clj7
2 files changed, 12 insertions, 6 deletions
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))))