Skip to content

Commit 9671e03

Browse files
committed
remove debug
1 parent 4d661fb commit 9671e03

2 files changed

Lines changed: 8 additions & 40 deletions

File tree

src/main/clojure/clojure/tools/build/tasks/uber.clj

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,21 @@
6868

6969
(defn- conflict-append
7070
[{:keys [path in]}]
71-
{:write {path {:string (str (System/lineSeparator) (stream->string in)), :append true}}})
71+
{:write {path {:string (str "\n" (stream->string in)), :append true}}})
7272

7373
(defn- conflict-append-dedupe
74-
[{:keys [lib path in ^File existing state] :as _params}]
74+
[{:keys [path in ^File existing state] :as _params}]
7575
(let [existing-content (slurp existing)
7676
existing-lower (str/lower-case existing-content)
7777
new-content (stream->string in)
7878
new-content-lower (str/lower-case new-content)
7979
seen (or (get-in state [:append-dedupe path]) #{existing-lower})]
80-
(println "\nconflict-append-dedupe" path lib)
81-
(println "state:" state)
82-
(println "seen:" seen)
83-
(println "existing:" existing-lower)
84-
(println "new content:" new-content-lower)
85-
(println "contains:" (contains? seen new-content-lower))
86-
(println)
8780
(if (contains? seen new-content-lower)
8881
;; already seen
8982
{:state (assoc-in state [:append-dedupe path] seen)}
9083
;; record and append
9184
{:state (assoc-in state [:append-dedupe path] (conj seen new-content))
92-
:write {path {:string (str (System/lineSeparator) new-content), :append true}}})))
85+
:write {path {:string (str "\n" new-content), :append true}}})))
9386

9487
(defn conflict-data-readers
9588
[{:keys [path in ^File existing]}]
@@ -116,23 +109,19 @@
116109
[^FileTime last-modified-time buffer out-dir path write-spec]
117110
(let [{:keys [string stream append] :or {append false}} write-spec
118111
out-file (jio/file out-dir path)]
119-
(when (and append string)
120-
(prn "APPEND" path string))
121112
(if string
122113
(spit out-file string :append ^boolean append)
123114
(copy-stream! ^InputStream stream (BufferedOutputStream. (FileOutputStream. out-file ^boolean append)) buffer))
124115
(Files/setLastModifiedTime (.toPath out-file) last-modified-time)))
125116

126117
(defn- handle-conflict
127-
[handlers last-modified-time buffer out-dir {:keys [lib state path] :as handler-params}]
118+
[handlers last-modified-time buffer out-dir {:keys [state path] :as handler-params}]
128119
(let [use-handler (loop [[[re handler] & hs] (dissoc handlers :default)]
129120
(if re
130121
(if (re-matches re path)
131122
handler
132123
(recur hs))
133124
(:default handlers)))]
134-
(when (= "META-INF/LICENSE.txt" path)
135-
(println "handle-conflict" (.getPath ^File out-dir) path lib (.getName (class use-handler))))
136125
(if use-handler
137126
(let [{new-state :state, write :write} (use-handler handler-params)]
138127
(when write
@@ -156,11 +145,6 @@
156145
Returns possibly updated state for further exploding."
157146
[^InputStream is ^String path dir? ^FileTime last-modified-time
158147
^File out-file lib {:keys [out-dir buffer exclude handlers] :as context} state]
159-
(when (= path "META-INF\\LICENSE.txt")
160-
(println "in explode1"
161-
(exclude-from-uber? exclude path)
162-
dir?
163-
(.exists out-file)))
164148
(cond
165149
;; excluded or directory - do nothing
166150
(or (exclude-from-uber? exclude path) dir?)
@@ -217,8 +201,6 @@
217201
(let [path (.toString (.relativize source-path (.toPath f)))
218202
source-time (FileTime/fromMillis (.lastModified f))
219203
out-file (jio/file out-dir path)]
220-
(when (str/includes? path "LICENSE")
221-
(println "explode1 path" path source-path))
222204
(explode1 is path (.isDirectory f) source-time out-file lib context the-state))
223205
(finally
224206
(when is (.close ^InputStream is))))]

src/test/clojure/clojure/tools/build/tasks/test_uber.clj

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,16 @@
127127
(slurp (project-path "target/unzip/overwrite.txt"))))
128128

129129
;; append files append
130-
(is (= (str (slurp (project-path "j1/append.txt")) (System/lineSeparator)
130+
(is (= (str (slurp (project-path "j1/append.txt")) "\n"
131131
(slurp (project-path "j2/append.txt")))
132132
(slurp (project-path "target/unzip/append.txt"))))
133133

134134
;; LICENSE files append but no dupes - include j1 and j2, but not j3 (dupe of j1)
135-
(is (= (str (slurp (project-path "j1/META-INF/LICENSE.txt")) (System/lineSeparator)
135+
(is (= (str (slurp (project-path "j1/META-INF/LICENSE.txt")) "\n"
136136
(slurp (project-path "j2/META-INF/LICENSE.txt")))
137137
(slurp (project-path "target/unzip/META-INF/LICENSE.txt"))))))
138138

139139
(deftest test-conflicts-but-files
140-
(println "\n>>>test-conflicts-but-files")
141140
(with-test-dir "test-data/uber-conflict"
142141
(api/set-project-root! (.getAbsolutePath *test-dir*))
143142

@@ -193,28 +192,15 @@
193192
(slurp (project-path "target/unzip/overwrite.txt"))))
194193

195194
;; append files append
196-
(is (= (str (slurp (project-path "j1/append.txt")) (System/lineSeparator)
195+
(is (= (str (slurp (project-path "j1/append.txt")) "\n"
197196
(slurp (project-path "j2/append.txt")))
198197
(slurp (project-path "target/unzip/append.txt"))))
199198

200-
;(println "j1: " (slurp (project-path "j1/META-INF/LICENSE.txt")))
201-
;(println "j2: " (slurp (project-path "j2/META-INF/LICENSE.txt")))
202-
;(println "j3: " (slurp (project-path "j3/META-INF/LICENSE.txt")))
203-
;(println "unzip: " (slurp (project-path "target/unzip/META-INF/LICENSE.txt")))
204-
205-
(println "<<<test-conflicts-but-files")
206-
(println)
207-
208199
;; LICENSE files append but no dupes - include j1 and j2, but not j3 (dupe of j1)
209-
(is (= (str (slurp (project-path "j1/META-INF/LICENSE.txt")) (System/lineSeparator)
200+
(is (= (str (slurp (project-path "j1/META-INF/LICENSE.txt")) "\n"
210201
(slurp (project-path "j2/META-INF/LICENSE.txt")))
211202
(slurp (project-path "target/unzip/META-INF/LICENSE.txt"))))))
212203

213-
(comment
214-
(run-tests)
215-
(test-conflicts-but-files)
216-
)
217-
218204
(deftest test-case-sensitive-dir-file-collision
219205
(with-test-dir "test-data/case-sensitive-collision"
220206
(api/set-project-root! (.getAbsolutePath *test-dir*))

0 commit comments

Comments
 (0)