pbr.tasks

Standard implementations of common tools.build tasks.

antq-outdated

(antq-outdated opts)
Determine outdated dependencies, via antq. opts includes:

:antq -- opt: a map containing antq-specific configuration options. Currently unused.

antq-upgrade

(antq-upgrade opts)
Unconditionally upgrade any outdated dependencies, via antq. opts includes:

:antq -- opt: a map containing antq-specific configuration options. Currently unused.

calculate-version

(calculate-version major minor)(calculate-version major minor opts)
Returns a calculated version number, using the provided major.minor components. Returns nil if one cannot be determined.  Notes: this is a utility fn, not a task fn. This logic is specific to the author's tagging and branch naming scheme and may not work as intended in other setups.

check

(check opts)
Check the code by compiling it (and throwing away the result). No options.

check-release

(check-release opts)
Check that a release can be made from the current directory, using the provided opts. opts includes:

:lib        -- opt: a symbol identifying your project e.g. 'org.github.pmonks/pbr
:version    -- opt: a string containing the version of your project e.g. "1.0.0-SNAPSHOT"
:dev-branch -- opt: the name of the development branch containing the changes to be PRed (defaults to "dev")

classes-dir

(classes-dir opts)
Returns the classes dir (a String) for the given opts. Note: this is a utility fn, not a task fn.

clean

(clean opts)
Deletes the target directory. opts includes:

:target -- opt: a string specifying the name of the target directory (defaults to "target")

codox

(codox opts)
Generates codox documentation. opts includes:

:lib   -- opt: a symbol identifying your project e.g. 'org.github.pmonks/pbr
:codox -- opt: a codox options map (see https://github.com/weavejester/codox#project-options). Note that PBR will auto-include the :source-uri option for com.github.* projects

default-basis

(default-basis)

delete-dir

(delete-dir dir)
Deletes the given directory and all of its contents, recursively.  May throw IOException.  Note: this is a utility fn, not a task fn.

deploy

(deploy opts)
Builds and deploys the library's artifacts (pom.xml, JAR) to Clojars (or elsewhere), from the 'production' branch. opts includes:

:prod-branch -- opt: the name of the production branch where the deployment is to be initiated from (defaults to "main")
-- opts from the `pom task`, though note that :write-pom and :validate-pom are forced to true --
-- opts from the `jar` task --
-- opts from `deps-deploy/deploy` (see https://github.com/slipset/deps-deploy/blob/master/src/deps_deploy/deps_deploy.clj#L196-L214) --

deploy-info

(deploy-info opts)
Writes out a deploy-info EDN file, containing at least :hash and :date keys, and possibly also :repo and :tag keys. opts includes:

:deploy-info-file -- req: the name of the file to write to (e.g. "./resources/deploy-info.edn")

dev-branch

(dev-branch opts)
Returns the name of the dev branch (a String) for the given opts. Note: this is a utility fn, not a task fn.

eastwood

(eastwood opts)
Run the eastwood linter. opts includes:

:eastwood -- opt: a map containing eastwood-specific configuration options (see https://github.com/jonase/eastwood#running-eastwood-in-a-repl)

fq-jar-file-name

(fq-jar-file-name opts)
Returns the fully-qualified jar file name (with path) for the given opts. Note: this is a utility fn, not a task fn.

fq-uberjar-file-name

(fq-uberjar-file-name opts)
Returns the fuly-qualified uberjar file name (with path) for the given opts. Note: this is a utility fn, not a task fn.

github-url

(github-url lib)
Returns the base GitHub URL for the given lib (a namespaced symbol), or nil if it can't be determined. Note: this is a utility fn, not a task fn.

install

(install opts)
Installs a library JAR in the local Maven cache (typically ~/.m2/repository). opts includes:

-- opts from the `jar` task --
-- opts from the `tools.build/install` task --

is-directory?

(is-directory? f)
Returns true if f (a File or String) is a directory, or a symlink to a directory, or false otherwise.

jar

(jar opts)
Generates a library JAR for the project. opts includes:

:main   -- opt: the name of the JAR's main class (defaults to nil)
:target -- opt: a string specifying the name of the target directory (defaults to "target")
-- opts from the `pom` task --

jar-file-name

(jar-file-name opts)
Returns the jar file name (without path) for the given opts. Note: this is a utility fn, not a task fn.

jvm-version

(jvm-version)
Returns the version of the running JVM as an Integer.  Older versions (e.g.
1.6, 1.7, 1.8) have their minor version returned (i.e. 1.6 -> 6, 1.7 -> 7,
etc.)
Adapted from http-kit (Apache-2.0 licensed): https://github.com/http-kit/http-kit/blob/e00279f6d921efd3aad3b513ebfa42604d3cf3bd/src/org/httpkit/utils.clj#L6-L16

kondo

(kondo opts)
Run the clj-kondo linter. No options.

nvd

(nvd opts)
Run the NVD vulnerability checker

:nvd -- opt: a map containing nvd-clojure-specific configuration options. See https://github.com/rm-hull/nvd-clojure#configuration-options

Note: this task requires that you obtain and configure an NVD API token.

pom

(pom opts)
Generates a comprehensive pom.xml file. See https://github.com/pmonks/tools-pom/ for opts

pom-file-name

(pom-file-name opts)
Returns the pom file name (without path) for the given opts. Note: this is a utility fn, not a task fn.

prod-branch

(prod-branch opts)
Returns the name of the prod branch (a String) for the given opts. Note: this is a utility fn, not a task fn.

release

(release opts)
Release a new version of the code via a PR to the prod branch. opts includes:

:lib         -- req: a symbol identifying your project e.g. 'org.github.pmonks/pbr
:version     -- req: a string containing the version of your project e.g. "1.0.0-SNAPSHOT"
:dev-branch  -- opt: the name of the development branch containing the changes to be PRed (defaults to "dev")
:prod-branch -- opt: the name of the production branch where the PR is to be sent (defaults to "main")
:pr-desc     -- opt: a format string used for the PR description with two %s values passed in (%1$s = lib, %2$s = version) (defaults to "%1$s release v%2$s. See commit log for details of what's included in this release.")
-- opts from the `deploy-info` task, if you wish to generate deploy-info --

run-tests

(run-tests opts)
Runs unit tests (if any). opts includes:

:test-paths -- opt: a sequence of paths containing test code (defaults to ["test"])
:test-deps  -- opt: a dep map of dependencies to add while testing

src-dirs

(src-dirs)
Returns the source directories (a sequence of Strings) for the default basis. Note: this is a utility fn, not a task fn.

target-dir

(target-dir opts)
Returns the target dir (a String) for the given opts. Note: this is a utility fn, not a task fn.

test-dirs

(test-dirs opts)
Returns the test directories (a sequence of Strings) for the given opts.  Note: these directories may not exist. Note: this is a utility fn, not a task fn.

uber

(uber opts)
Create an uber jar. opts includes:

-- opts from the `pom` task --
-- opts from the `tools.build/uber` task --

uberexec

(uberexec opts)
Creates an executable uber jar (note: does not bundle a JRE, and one is still required). opts includes:

-- opts from the `pom` task --
-- opts from the `uber` task --

uberjar-file-name

(uberjar-file-name opts)
Returns the uberjar file name (without path) for the given opts. Note: this is a utility fn, not a task fn.