You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes assembling uberjar requires combining multiple files with the same name (coming from different libraries, for example) into a single file. Uberdeps does that automatically for these:
222
222
223
-
- Concat all `META-INF/services/**` files with matching names #2#27 thx @jdf-id-au
You can provide your own merger by passing a merge function to `uberdeps.api/package`:
251
230
252
-
- Package paths before jars so that local files take priority over deps #9
231
+
```clojure
232
+
(defreadme-merger
233
+
{:collect
234
+
(fn [acc content]
235
+
(conj (or acc []) (str/upper-case content)))
236
+
:combine
237
+
(fn [acc]
238
+
(str/join"\n" acc))})
239
+
```
253
240
254
-
### 0.1.3 - May 30, 2019
241
+
Merger is a map with two keys: `:collect` and `:combine`. Collect accumulates values as they come. It takes an accumulator and a next file content, and must return the new accumulator:
255
242
256
-
- Fixed NPE when target is located in current dir #7
243
+
```
244
+
((:collect readme-merger) acc content) -> acc'
245
+
```
257
246
258
-
### 0.1.2 - May 27, 2019
247
+
File content is always a string. Accumulator can be any data structure you find useful for storing merged files. In `readme-merger` accumulator is a string, in `clojure-maps-merger` it is a clojure map, etc. On a first call to your merger accumulator will be `nil`.
259
248
260
-
- Make target dirs if don’t exist #4
249
+
Combine is called when all files with the same name have been processed and it is time to write the resulting single merged file to the jar. It will be called with your accumulator and must return a string with file content:
261
250
262
-
### 0.1.1 - May 3, 2019
251
+
```
252
+
((:combine readme-merger) acc) -> content'
253
+
```
263
254
264
-
- Normalize dependencies without namespaces #3
255
+
Custom mergers can be passed to `uberdeps.api/package` in `:mergers` option along with file path regexp:
0 commit comments