|
132 | 132 | ign? (git/make-gitignore-matcher (core/get-env :src-paths))]
|
133 | 133 | (fn [continue]
|
134 | 134 | (fn [event]
|
| 135 | + (util/info "Starting file watcher (CTRL-C to quit)...\n") |
135 | 136 | (loop [ret (util/guard [(.take q)])]
|
136 | 137 | (when ret
|
137 | 138 | (if-let [more (.poll q (or debounce 10) TimeUnit/MILLISECONDS)]
|
|
209 | 210 | xmlfile (io/file pomdir "pom.xml")
|
210 | 211 | propfile (io/file pomdir "pom.properties")]
|
211 | 212 | (when-not (and (.exists xmlfile) (.exists propfile))
|
| 213 | + (util/info "Writing %s and %s...\n" (.getName xmlfile) (.getName propfile)) |
212 | 214 | (pod/call-worker
|
213 | 215 | `(boot.pom/spit-pom! ~(.getPath xmlfile) ~(.getPath propfile) ~opts)))))))
|
214 | 216 |
|
|
225 | 227 |
|
226 | 228 | (let [tgt (core/mktgtdir! ::add-dir-tgt)]
|
227 | 229 | (core/with-pre-wrap
|
| 230 | + (util/info "Adding resource directories...\n") |
228 | 231 | (binding [file/*filters* (mapv re-pattern filters)]
|
229 | 232 | (apply file/sync :time tgt dirs)))))
|
230 | 233 |
|
|
241 | 244 | (let [tgt (core/mktgtdir! ::add-srcs-tgt)]
|
242 | 245 | (core/with-pre-wrap
|
243 | 246 | (when-let [dirs (seq (remove core/tmpfile? (core/get-env :src-paths)))]
|
| 247 | + (util/info "Adding src files...\n") |
244 | 248 | (binding [file/*filters* (mapv re-pattern filters)]
|
245 | 249 | (apply file/sync :time tgt dirs))))))
|
246 | 250 |
|
|
270 | 274 | urls (-> (core/get-env)
|
271 | 275 | (update-in [:dependencies] (partial filter scope?))
|
272 | 276 | pod/jar-entries-in-dep-order)]
|
| 277 | + (util/info "Adding uberjar entries...\n") |
273 | 278 | (doseq [[relpath url-str] urls]
|
274 | 279 | (when (or (empty? filters) (keep? relpath))
|
275 | 280 | (let [segs (file/split-path relpath)
|
|
294 | 299 | (when-not (.exists xmlfile)
|
295 | 300 | (-> (and (symbol? serve) (namespace serve))
|
296 | 301 | (assert "no serve function specified"))
|
| 302 | + (util/info "Adding servlet impl...\n") |
297 | 303 | (pod/copy-dependency-jar-entries
|
298 | 304 | (core/get-env) tgt implp implv #"^tailrecursion/.*\.(class|clj)$")
|
| 305 | + (util/info "Writing %s...\n" (.getName xmlfile)) |
299 | 306 | (pod/call-worker
|
300 | 307 | `(boot.web/spit-web! ~(.getPath xmlfile) ~serve ~create ~destroy))))))
|
301 | 308 |
|
|
315 | 322 | (when-not (.exists jarfile)
|
316 | 323 | (let [index (->> (core/tgt-files)
|
317 | 324 | (map (juxt core/relative-path (memfn getPath))))]
|
| 325 | + (util/info "Writing %s...\n" (.getName jarfile)) |
318 | 326 | (pod/call-worker
|
319 | 327 | `(boot.jar/spit-jar! ~(.getPath jarfile) ~index ~manifest ~main))
|
320 | 328 | (doseq [[_ f] index] (core/consume-file! (io/file f)))))))))
|
|
335 | 343 | r
|
336 | 344 | (.getPath (apply io/file "WEB-INF" "classes" r'))))
|
337 | 345 | index (->> (core/tgt-files) (map (juxt ->war (memfn getPath))))]
|
| 346 | + (util/info "Writing %s...\n" (.getName warfile)) |
338 | 347 | (pod/call-worker
|
339 | 348 | `(boot.jar/spit-jar! ~(.getPath warfile) ~index {} nil))
|
340 | 349 | (doseq [[_ f] index] (core/consume-file! (io/file f)))))))))
|
341 | 350 |
|
342 | 351 | (core/deftask install
|
343 |
| - "Install project jar to local Maven repository." |
| 352 | + "Install project jar to local Maven repository. |
| 353 | +
|
| 354 | + The file option allows installation of arbitrary jar files. If no file option |
| 355 | + is given then any jar artifacts created during the build will be installed. |
| 356 | +
|
| 357 | + Note that installation requires the jar to contain a pom.xml file." |
344 | 358 |
|
345 | 359 | [f file PATH str "The jar file to install."]
|
346 | 360 |
|
|
351 | 365 | (doseq [jarfile jarfiles]
|
352 | 366 | (util/info "Installing %s...\n" (.getName jarfile))
|
353 | 367 | (pod/call-worker
|
354 |
| - `(boot.aether/install ~(.getPath jarfile))))))) |
| 368 | + `(boot.aether/install ~(core/get-env) ~(.getPath jarfile))))))) |
| 369 | + |
| 370 | +(core/deftask deploy |
| 371 | + "Deploy project jar to a Maven repository. |
| 372 | +
|
| 373 | + Both the file and repo options are required. The jar file must contain a |
| 374 | + pom.xml entry." |
| 375 | + |
| 376 | + [f file PATH str "The jar file to deploy." |
| 377 | + r repo ALIAS str "The alias of the deploy repository."] |
| 378 | + |
| 379 | + (core/with-pre-wrap |
| 380 | + (let [f (io/file file) |
| 381 | + r (-> (->> (core/get-env :repositories) (into {})) (get repo))] |
| 382 | + (when-not (and r (.exists f)) |
| 383 | + (throw (Exception. "missing jar file or repo alias option"))) |
| 384 | + (util/info "Deploying %s...\n" (.getName f)) |
| 385 | + (pod/call-worker |
| 386 | + `(boot.aether/deploy ~(core/get-env) ~[repo r] ~(.getPath f)))))) |
355 | 387 |
|
356 | 388 | (core/deftask push
|
357 |
| - "Push project jar to Clojars." |
| 389 | + "Push project jar to Clojars. |
| 390 | +
|
| 391 | + The file option is required, and the jar file must contain a pom.xml entry." |
358 | 392 |
|
359 |
| - [f file PATH str "The jar file to push to Clojars."] |
| 393 | + [f file PATH str "The path to the jar file."] |
360 | 394 |
|
361 | 395 | (let [tmp (core/mktmpdir! ::push-tmp)]
|
362 | 396 | (core/with-pre-wrap
|
363 |
| - (let [jarfiles (or (and file [(io/file file)]) |
364 |
| - (->> (core/tgt-files) (core/by-ext [".jar"])))] |
365 |
| - (when-not (seq jarfiles) (throw (Exception. "can't find jar file"))) |
366 |
| - (doseq [jarfile jarfiles] |
367 |
| - (if-let [xml (pod/pom-xml jarfile)] |
368 |
| - (let [pom (doto (io/file tmp "pom.xml") (spit xml))] |
369 |
| - (( helpers/sh "scp" ( .getPath jarfile) ( .getPath pom) "[email protected]:"))) |
370 |
| - (throw (Exception. "jar file has no pom.xml")))))))) |
| 397 | + (let [jarfile (io/file file)] |
| 398 | + (when-not (.exists jarfile) (throw (Exception. "can't find jar file"))) |
| 399 | + (if-let [xml (pod/pom-xml jarfile)] |
| 400 | + (let [pom (doto (io/file tmp "pom.xml") (spit xml))] |
| 401 | + (util/info "Pushing %s to Clojars...\n" (.getName jarfile)) |
| 402 | + (( helpers/sh "scp" ( .getPath jarfile) ( .getPath pom) "[email protected]:"))) |
| 403 | + (throw (Exception. "jar file does not contain a pom.xml entry"))))))) |
0 commit comments