diff options
author | Eduardo Julian | 2015-09-11 22:16:58 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-09-11 22:16:58 -0400 |
commit | 5148900e02c8e05808afc8a3ec7fc51a901bcc7b (patch) | |
tree | 8ea4d23410b23369f8498660f1089a68ebcf8827 /src/lux/compiler/package.clj | |
parent | 5a26c40dc215dfb22a77cad28455deff28ca9976 (diff) |
- Abandoned the old format for classes of having module names separated by underscores, and now using slashes and putting submodules inside the directories of their parent modules.
Diffstat (limited to 'src/lux/compiler/package.clj')
-rw-r--r-- | src/lux/compiler/package.clj | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lux/compiler/package.clj b/src/lux/compiler/package.clj index b1468e540..4f703f5d1 100644 --- a/src/lux/compiler/package.clj +++ b/src/lux/compiler/package.clj @@ -30,6 +30,7 @@ (defn ^:private write-class! [^String path ^File file ^JarOutputStream out] "(-> Text File JarOutputStream Unit)" + ;; (prn 'write-class! path file) (with-open [in (new BufferedInputStream (new FileInputStream file))] (let [buffer (byte-array (* 10 kilobyte))] (doto out @@ -42,11 +43,18 @@ )) )) -(defn ^:private write-module! [^File file ^JarOutputStream out] - "(-> File JarOutputStream Unit)" - (let [module-name (.getName file)] - (doseq [$class (.listFiles file)] - (write-class! module-name $class out)))) +(let [output-dir-size (.length &&/output-dir)] + (defn ^:private write-module! [^File file ^JarOutputStream out] + "(-> File JarOutputStream Unit)" + (let [module-name (.substring (.getPath file) output-dir-size) ;; (.getName file) + ;; _ (prn 'write-module! module-name file (.getPath file) (.substring (.getPath file) output-dir-size)) + inner-files (.listFiles file) + inner-modules (filter #(.isDirectory %) inner-files) + inner-classes (filter #(not (.isDirectory %)) inner-files)] + (doseq [$class inner-classes] + (write-class! module-name $class out)) + (doseq [$module inner-modules] + (write-module! $module out))))) ;; [Resources] (defn package [module] |