Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include contents of symlinked directories in fileset #483

Merged
merged 2 commits into from
Jul 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion boot/pod/src/boot/file.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[java.net URI]
[java.io File]
[java.nio.file.attribute FileAttribute]
[java.nio.file Files StandardCopyOption]
[java.nio.file Files StandardCopyOption FileVisitOption]
[java.lang.management ManagementFactory])
(:refer-clojure :exclude [sync name file-seq]))

Expand Down Expand Up @@ -42,6 +42,13 @@

(def file-seq-nofollow #(file-seq % :follow-symlinks false))

(defn walk-file-tree
"Wrap java.nio.Files/walkFileTree to easily toggle symlink-following behavior."
[root visitor & {:keys [follow-symlinks]
:or {follow-symlinks true}}]
(let [walk-opts (if follow-symlinks #{FileVisitOption/FOLLOW_LINKS} #{})]
(Files/walkFileTree root walk-opts Integer/MAX_VALUE visitor)))

(defmacro guard [& exprs]
`(try (do ~@exprs) (catch Throwable _#)))

Expand Down
2 changes: 1 addition & 1 deletion boot/pod/src/boot/filesystem.clj
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
(FileSystemTree.
root
@(with-let [tree (atom {})]
(Files/walkFileTree root (mkvisitor root tree :ignore ignore))))))
(file/walk-file-tree root (mkvisitor root tree :ignore ignore))))))

(defn merge-trees
[{tree1 :tree} {tree2 :tree}]
Expand Down
2 changes: 1 addition & 1 deletion boot/pod/src/boot/tmpdir.clj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
[^File dir ^File blob]
(let [root (.toPath dir)]
@(with-let [tree (atom {})]
(Files/walkFileTree root (mkvisitor root blob tree *hard-link*)))))
(file/walk-file-tree root (mkvisitor root blob tree *hard-link*)))))

(defn- ^File cache-dir
[cache-key]
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.6.0
version=2.6.1-SNAPSHOT