|
220 | 220 | (core/deftask add-dir
|
221 | 221 | "Add files in resource directories to fileset.
|
222 | 222 |
|
223 |
| - The filters option specifies a set of regular expressions (as strings) that |
224 |
| - will be used to filter the resource files. If no filters are specified, or if |
225 |
| - any of the filter regexes match the path of the resource file relative to the |
226 |
| - resource dir, then the file is added to the fileset." |
| 223 | + The include and exclude options specify sets of regular expressions (strings) |
| 224 | + that will be used to filter the source files. If no filters are specified then |
| 225 | + all files are added to the fileset." |
227 | 226 |
|
228 | 227 | [d dirs PATH #{str} "The set of resource directories."
|
229 |
| - f filters REGEX #{str} "The set of regular expressions to match against."] |
| 228 | + i include REGEX #{str} "The set of regexes that paths must match." |
| 229 | + x exclude REGEX #{str} "The set of regexes that paths must not match."] |
230 | 230 |
|
231 | 231 | (let [tgt (core/mktgtdir! ::add-dir-tgt)]
|
232 | 232 | (core/with-pre-wrap
|
233 | 233 | (util/info "Adding resource directories...\n")
|
234 |
| - (binding [file/*filters* (mapv re-pattern filters)] |
| 234 | + (binding [file/*include* (mapv re-pattern include) |
| 235 | + file/*exclude* (mapv re-pattern exclude)] |
235 | 236 | (apply file/sync :time tgt dirs)))))
|
236 | 237 |
|
237 | 238 | (core/deftask add-src
|
238 | 239 | "Add source files to fileset.
|
239 | 240 |
|
240 |
| - The filters option specifies a set of regular expressions (as strings) that |
241 |
| - will be used to filter the source files. If no filters are specified, or if |
242 |
| - any of the filter regexes match the path of the source file relative to its |
243 |
| - source dir, then the file is added to the fileset." |
| 241 | + The include and exclude options specify sets of regular expressions (strings) |
| 242 | + that will be used to filter the source files. If no filters are specified then |
| 243 | + all files are added to the fileset." |
244 | 244 |
|
245 |
| - [f filters REGEX #{str} "The set of regular expressions to match against."] |
| 245 | + [i include REGEX #{str} "The set of regexes that paths must match." |
| 246 | + x exclude REGEX #{str} "The set of regexes that paths must not match."] |
246 | 247 |
|
247 | 248 | (let [tgt (core/mktgtdir! ::add-srcs-tgt)]
|
248 | 249 | (core/with-pre-wrap
|
249 | 250 | (when-let [dirs (seq (remove core/tmpfile? (core/get-env :src-paths)))]
|
250 | 251 | (util/info "Adding src files...\n")
|
251 |
| - (binding [file/*filters* (mapv re-pattern filters)] |
| 252 | + (binding [file/*include* (mapv re-pattern include) |
| 253 | + file/*exclude* (mapv re-pattern exclude)] |
252 | 254 | (apply file/sync :time tgt dirs))))))
|
253 | 255 |
|
254 | 256 | (core/deftask uber
|
|
258 | 260 | to the fileset: compile, runtime, and provided. The exclude option may be used
|
259 | 261 | to exclude dependencies with the given scope(s).
|
260 | 262 |
|
261 |
| - The filters option specifies a set of regular expressions (as strings) that |
262 |
| - will be used to filter the jar entries. If no filters are specified, or if |
263 |
| - any of the filter regexes match the path of the jar entry, then the entry is |
264 |
| - added to the fileset." |
| 263 | + The include and exclude options specify sets of regular expressions (strings) |
| 264 | + that will be used to filter the entries. If no filters are specified then all |
| 265 | + entries are added to the fileset." |
265 | 266 |
|
266 |
| - [x exclude-scope SCOPE #{str} "The set of excluded scopes." |
267 |
| - f filters REGEX #{str} "The set of regular expressions to match against."] |
| 267 | + [S exclude-scope SCOPE #{str} "The set of excluded scopes." |
| 268 | + i include REGEX #{str} "The set of regexes that paths must match." |
| 269 | + x exclude REGEX #{str} "The set of regexes that paths must not match."] |
268 | 270 |
|
269 | 271 | (let [tgt (core/mktgtdir! ::uber-tgt)
|
270 | 272 | dfl-scopes #{"compile" "runtime" "provided"}
|
271 | 273 | scopes (set/difference dfl-scopes exclude-scope)
|
272 |
| - filters (map re-pattern filters) |
273 |
| - keep? (when (seq filters) |
274 |
| - (apply some-fn (map (partial partial re-find) filters)))] |
| 274 | + include (map re-pattern include) |
| 275 | + exclude (map re-pattern exclude)] |
275 | 276 | (core/with-pre-wrap
|
276 | 277 | (let [scope? #(contains? scopes (:scope (util/dep-as-map %)))
|
277 | 278 | urls (-> (core/get-env)
|
278 | 279 | (update-in [:dependencies] (partial filter scope?))
|
279 | 280 | pod/jar-entries-in-dep-order)]
|
280 | 281 | (util/info "Adding uberjar entries...\n")
|
281 |
| - (doseq [[relpath url-str] urls] |
282 |
| - (when (or (empty? filters) (keep? relpath)) |
| 282 | + (doseq [[relpath url-str] urls :let [f (io/file relpath)]] |
| 283 | + (when (file/keep-filters? include exclude f) |
283 | 284 | (let [segs (file/split-path relpath)
|
284 | 285 | outfile (apply io/file tgt segs)]
|
285 | 286 | (when-not (or (.exists outfile) (= "META-INF" (first segs)))
|
|
0 commit comments