Skip to content

Commit

Permalink
Automatically merge data_readers.clj and `META-INF/plexus/component…
Browse files Browse the repository at this point in the history
…s.xml`, Support custom mergers, tools.deps updated to 0.9.763 (closes #1)
  • Loading branch information
tonsky committed Aug 19, 2020
1 parent 52b5090 commit c6af8dd
Show file tree
Hide file tree
Showing 27 changed files with 463 additions and 112 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ pom.xml.asc
.hg/
*.sublime-workspace
.DS_Store
.cpcache
.cpcache
!test_projects/mergers/project_c.jar
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
### 1.0.0 - Aug 19, 2020

- Automatically merge `data_readers.clj` and `META-INF/plexus/components.xml`
- Support custom mergers #1
- tools.deps updated to 0.9.763

### 0.1.11 - Aug 5, 2020

- Concat all `META-INF/services/**` files with matching names #2 #27 thx @jdf-id-au

### 0.1.10 - Mar 31, 2020

- tools.deps updated to 0.8.677

### 0.1.9 - Mar 31, 2020

- `--multi-release` / `:multi-release?` added #22 #23 thx @gavinkflam

### 0.1.8 - Jan 13, 2020

- Resolve `:paths` relative to `deps.edn` location

### 0.1.7 - Dec 20, 2019

- `--main-class` / `:main-class` option added #13 #18 thx @gnarroway
- tools.deps updated to 0.8.599

### 0.1.6 - Oct 4, 2019

- Replace `\` with `/` when building on Windows #16 #17 thx @gnarroway

### 0.1.5 - Oct 4, 2019

- Ignore non-jar dependencies #14 #15

### 0.1.4 - June 5, 2019

- Package paths before jars so that local files take priority over deps #9

### 0.1.3 - May 30, 2019

- Fixed NPE when target is located in current dir #7

### 0.1.2 - May 27, 2019

- Make target dirs if don’t exist #4

### 0.1.1 - May 3, 2019

- Normalize dependencies without namespaces #3

### 0.1.0 - April 29, 2019

- Initial version
72 changes: 34 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,56 +216,52 @@ Supported command-line options are:
(uberdeps/package deps "target/uber.jar" {:aliases #{:uberjar}})))
```

## Changelog
## Merging

### 0.1.11 - Aug 5, 2020
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:

- Concat all `META-INF/services/**` files with matching names #2 #27 thx @jdf-id-au

### 0.1.10 - Mar 31, 2020

- tools.deps updated to 0.8.677

### 0.1.9 - Mar 31, 2020

- `--multi-release` / `:multi-release?` added #22 #23 thx @gavinkflam

### 0.1.8 - Jan 13, 2020

- Resolve `:paths` relative to `deps.edn` location

### 0.1.7 - Dec 20, 2019

- `--main-class` / `:main-class` option added #13 #18 thx @gnarroway
- tools.deps updated to 0.8.599

### 0.1.6 - Oct 4, 2019

- Replace `\` with `/` when building on Windows #16 #17 thx @gnarroway

### 0.1.5 - Oct 4, 2019

- Ignore non-jar dependencies #14 #15
```clojure
META-INF/plexus/components.xml uberdeps.api/components-merger
#"META-INF/services/.*" uberdeps.api/services-merger
#"data_readers.clj[cs]?" uberdeps.api/clojure-maps-merger
```

### 0.1.4 - June 5, 2019
You can provide your own merger by passing a merge function to `uberdeps.api/package`:

- Package paths before jars so that local files take priority over deps #9
```clojure
(def readme-merger
{:collect
(fn [acc content]
(conj (or acc []) (str/upper-case content)))
:combine
(fn [acc]
(str/join "\n" acc))})
```

### 0.1.3 - May 30, 2019
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:

- Fixed NPE when target is located in current dir #7
```
((:collect readme-merger) acc content) -> acc'
```

### 0.1.2 - May 27, 2019
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`.

- Make target dirs if don’t exist #4
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:

### 0.1.1 - May 3, 2019
```
((:combine readme-merger) acc) -> content'
```

- Normalize dependencies without namespaces #3
Custom mergers can be passed to `uberdeps.api/package` in `:mergers` option along with file path regexp:

### 0.1.0 - April 29, 2019
```
(uberdeps.api/package
deps
"target/project.jar"
{:mergers {#"(?i)README(\.md|\.txt)?" readme-merger}})
```

- Initial version
Passing custom mergers does not remove the default ones, but you can override them.

## License

Expand Down
5 changes: 4 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{:deps
{org.clojure/clojure {:mvn/version "1.10.1"}
org.clojure/tools.deps.alpha {:mvn/version "0.8.677"}}}
org.clojure/tools.deps.alpha {:mvn/version "0.9.763"}}

:aliases
{:test {:extra-paths ["test"]}}}
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
:url "https://github.com/tonsky/uberdeps"
:dependencies
[[org.clojure/clojure "1.10.1"]
[org.clojure/tools.deps.alpha "0.8.677"]])
[org.clojure/tools.deps.alpha "0.9.763"]])
5 changes: 5 additions & 0 deletions script/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/zsh -euo pipefail

cd "`dirname $0`/.."

clj -A:test -m uberdeps.test
Loading

0 comments on commit c6af8dd

Please sign in to comment.