Liking cljdoc? Tell your friends :D

mranderson.core

Orchestrates the dependency-inlining pipeline: resolve dependencies, unzip each artifact under target/srcdeps, move and rewrite the namespaces (via mranderson.move), and repackage any bundled Java .class files through jarjar. inline-deps is the Leiningen-free entry point; mranderson is the lower-level workhorse it and the Leiningen task both call into. See doc/design.md for the architecture.

Orchestrates the dependency-inlining pipeline: resolve dependencies, unzip
each artifact under `target/srcdeps`, move and rewrite the namespaces (via
`mranderson.move`), and repackage any bundled Java `.class` files through
jarjar. `inline-deps` is the Leiningen-free entry point; `mranderson` is the
lower-level workhorse it and the Leiningen task both call into. See
doc/design.md for the architecture.
raw docstring

default-repositoriesclj

Maven repositories used to resolve dependencies when none are supplied.

Maven repositories used to resolve dependencies when none are supplied.
sourceraw docstring

inline-depsclj

(inline-deps {:keys [dependencies source-paths project-prefix target-path
                     repositories pname pversion skip-repackage-java-classes
                     prefix-exclusions unresolved-tree overrides expositions
                     watermark report]
              :or {target-path "target"
                   source-paths []
                   repositories default-repositories
                   pname "mranderson"
                   pversion "0.0.0"
                   skip-repackage-java-classes false
                   unresolved-tree false
                   watermark :mranderson/inlined}
              :as opts})

Inline and shadow :dependencies so they cannot interfere with the dependencies of downstream consumers.

This is the supported, Leiningen-free entry point (the leiningen.inline-deps plugin task is a thin wrapper over it). It takes a plain options map instead of a Leiningen project map, which makes it usable from a tools.build build script, the Clojure CLI, or the REPL:

(require '[mranderson.core :as mranderson])
(mranderson/inline-deps
 {:project-prefix "com.example.inlined"
  :source-paths   ["src"]
  :dependencies   '[[org.clojure/tools.namespace "1.5.1"]]})

or directly as a Clojure CLI tool function (clojure -T:mranderson inline-deps).

:source-paths is optional - omit it to just pull in and shadow the dependencies under :project-prefix (handy from the REPL), with no project sources to rewrite.

The project's own :source-paths and the resolved dependency sources are copied into <target-path>/srcdeps, with the dependency namespaces (and references to them, including those in the project's own sources) rewritten under :project-prefix.

Options:

  • :dependencies (required) vector of [lib version & kvs] coordinates to inline. Every entry is treated as an inline dep, so there is no need to attach ^:inline-dep meta yourself.
  • :source-paths the project's own source directories to copy into srcdeps and rewrite. Optional; defaults to none.
  • :project-prefix namespace/path prefix for the shadowed deps. Defaults to a random mranderson<hex> prefix; set a stable value for reproducible output.
  • :target-path build target directory. Defaults to "target"; output is written to <target-path>/srcdeps.
  • :repositories Maven repositories used for resolution. Defaults to Maven Central and Clojars (see default-repositories).
  • :pname project name, used when repackaging bundled Java classes. Defaults to "mranderson".
  • :pversion project version, used when repackaging bundled Java classes. Defaults to "0.0.0".
  • :skip-repackage-java-classes skip jarjar repackaging of bundled .class files. Defaults to false.
  • :prefix-exclusions seq of prefixes to leave untouched when rewriting Java imports.
  • :unresolved-tree use unresolved-tree mode (deeply nested isolation). Defaults to false.
  • :overrides overrides for unresolved-tree mode.
  • :expositions transitive deps to expose to the project's sources in unresolved-tree mode.
  • :watermark meta key marking inlined namespaces. Defaults to :mranderson/inlined.
  • :print-deps-tree when true, print the dependency tree that would be inlined and return without inlining anything. Defaults to false.
  • :report when true, print a per-file run report (which namespaces' references were rewritten in each file) after inlining. Resolved-tree mode only. Defaults to false.

Returns the resolved project prefix (handy when it was generated), or nil for a :print-deps-tree run.

Inline and shadow `:dependencies` so they cannot interfere with the
dependencies of downstream consumers.

This is the supported, Leiningen-free entry point (the `leiningen.inline-deps`
plugin task is a thin wrapper over it). It takes a plain options map instead of
a Leiningen project map, which makes it usable from a `tools.build` build
script, the Clojure CLI, or the REPL:

    (require '[mranderson.core :as mranderson])
    (mranderson/inline-deps
     {:project-prefix "com.example.inlined"
      :source-paths   ["src"]
      :dependencies   '[[org.clojure/tools.namespace "1.5.1"]]})

or directly as a Clojure CLI tool function (`clojure -T:mranderson inline-deps`).

`:source-paths` is optional - omit it to just pull in and shadow the
dependencies under `:project-prefix` (handy from the REPL), with no project
sources to rewrite.

The project's own `:source-paths` and the resolved dependency sources are
copied into `<target-path>/srcdeps`, with the dependency namespaces (and
references to them, including those in the project's own sources) rewritten
under `:project-prefix`.

Options:

- `:dependencies`    (required) vector of `[lib version & kvs]` coordinates to
                     inline. Every entry is treated as an inline dep, so there
                     is no need to attach `^:inline-dep` meta yourself.
- `:source-paths`    the project's own source directories to copy into
                     `srcdeps` and rewrite. Optional; defaults to none.
- `:project-prefix`  namespace/path prefix for the shadowed deps. Defaults to a
                     random `mranderson<hex>` prefix; set a stable value for
                     reproducible output.
- `:target-path`     build target directory. Defaults to `"target"`; output is
                     written to `<target-path>/srcdeps`.
- `:repositories`    Maven repositories used for resolution. Defaults to Maven
                     Central and Clojars (see `default-repositories`).
- `:pname`           project name, used when repackaging bundled Java classes.
                     Defaults to `"mranderson"`.
- `:pversion`        project version, used when repackaging bundled Java
                     classes. Defaults to `"0.0.0"`.
- `:skip-repackage-java-classes` skip jarjar repackaging of bundled `.class`
                     files. Defaults to `false`.
- `:prefix-exclusions` seq of prefixes to leave untouched when rewriting Java
                     imports.
- `:unresolved-tree` use unresolved-tree mode (deeply nested isolation).
                     Defaults to `false`.
- `:overrides`       overrides for unresolved-tree mode.
- `:expositions`     transitive deps to expose to the project's sources in
                     unresolved-tree mode.
- `:watermark`       meta key marking inlined namespaces. Defaults to
                     `:mranderson/inlined`.
- `:print-deps-tree` when true, print the dependency tree that would be inlined
                     and return without inlining anything. Defaults to `false`.
- `:report`          when true, print a per-file run report (which namespaces'
                     references were rewritten in each file) after inlining.
                     Resolved-tree mode only. Defaults to `false`.

Returns the resolved project prefix (handy when it was generated), or nil for a
`:print-deps-tree` run.
sourceraw docstring

(print-deps-tree repositories dependencies {:keys [unresolved-tree overrides]})

Resolves the inlinable entries of dependencies against repositories and prints the dependency tree that inlining would process, then returns nil without inlining anything. Prints the resolved tree, or the unresolved (deeply nested) tree when :unresolved-tree is set in opts (honoring :overrides), to match what the corresponding mode would actually walk. Backs the :print-deps-tree option.

Resolves the inlinable entries of `dependencies` against `repositories` and
prints the dependency tree that inlining would process, then returns nil
without inlining anything. Prints the resolved tree, or the unresolved (deeply
nested) tree when `:unresolved-tree` is set in `opts` (honoring `:overrides`),
to match what the corresponding mode would actually walk. Backs the
`:print-deps-tree` option.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close