Skip to content

Commit

Permalink
update links to new clojure cli reference
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Jan 6, 2024
1 parent c9b111f commit 5f18515
Show file tree
Hide file tree
Showing 9 changed files with 546 additions and 2,176 deletions.
22 changes: 11 additions & 11 deletions content/news/2021/07/09/source-libs-builds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Fogus

ifdef::env-github,env-browser[:outfilesuffix: .adoc]

Several years ago, Clojure introduced <<xref/../../../../../reference/deps_and_cli#_deps_edn,deps.edn>> (a data definition for dependencies), https://github.com/clojure/tools.deps.alpha/[tools.deps] (a library for computing classpaths), and the
<<xref/../../../../../reference/deps_and_cli#,Clojure CLI>> to run programs. The Clojure community has widely adopted these and we are excited today to provide a clear path for users looking to use these same tools to build their projects:
Several years ago, Clojure introduced <<xref/../../../../../reference/deps_edn#,deps.edn>> (a data definition for dependencies), https://github.com/clojure/tools.deps.alpha/[tools.deps] (a library for computing classpaths), and the
<<xref/../../../../../reference/clojure_cli#,Clojure CLI>> to run programs. The Clojure community has widely adopted these and we are excited today to provide a clear path for users looking to use these same tools to build their projects:

* https://github.com/clojure/tools.build/[tools.build] - a library for building artifacts
* CLI updates to make working with source repos as libs easier
Expand Down Expand Up @@ -34,7 +34,7 @@ For more details and full examples, see the following:

== Source Repos as Libs

Due to Clojure’s dynamic nature, we can directly use source repositories as libraries without the overhead of making, distributing, and consuming artifacts. This release provides some <<xref/../../../../../reference/deps_and_cli#_git,updates for git libraries>>:
Due to Clojure’s dynamic nature, we can directly use source repositories as libraries without the overhead of making, distributing, and consuming artifacts. This release provides some <<xref/../../../../../reference/deps_edn#deps_git,updates for git libraries>>:

* Git repository urls are now optional and inferred if the library name follows a naming convention
* Git tag and short git sha prefix are now sufficient to identify a git lib version. The prefix is included to verify that the tag has not moved (both must point to the same commit).
Expand All @@ -53,7 +53,7 @@ The Clojure CLI library checks that the `:ensure` directory exists and if it’s
clj -X:deps prep
```

This command will find the unprepped libs, and run the `compile` function using the `:build` alias, presumably filling the `target/classes` directory with necessary classes to put on the classpath (`"target/classes"` should be in the project `:paths`). More information on supporting unprepped dependencies is available in the <<xref/../../../../../reference/deps_and_cli#prep,Clojure CLI reference>>.
This command will find the unprepped libs, and run the `compile` function using the `:build` alias, presumably filling the `target/classes` directory with necessary classes to put on the classpath (`"target/classes"` should be in the project `:paths`). More information on supporting unprepped dependencies is available in the <<xref/../../../../../reference/clojure_cli#deps_prep,Clojure CLI reference>>.

== Tools

Expand All @@ -77,7 +77,7 @@ clj -X:deps help/doc :ns help

To look at the documentation for the `clojure.tools.cli.help` namespace.

More information on the new <<xref/../../../../../reference/deps_and_cli#tool_install,tools support in the CLI>> is available in the reference docs.
More information on the new <<xref/../../../../../reference/clojure_cli#tool_install,tools support in the CLI>> is available in the reference docs.

== Installation

Expand All @@ -93,22 +93,22 @@ All items below are additive updates, there should be no changes required for ex
** https://clojure.github.io/tools.build[API] - what's available
** <<xref/../../../../../guides/tools_build#,Guide>> - how to use it
* deps.edn:
** <<xref/../../../../../reference/deps_and_cli#_git,git deps>>
** <<xref/../../../../../reference/deps_edn#deps_git,git deps>>
*** If a git library name follows the repo convention names, the `:git/url` can now be inferred (`:git/url` can also be specified explicitly and takes precedence)
*** `:git/tag` and short `:git/sha` can now be specified instead of the full sha. Both must point to the same commit.
*** `:sha` has been renamed to `:git/sha` but the original is still supported for backwards compatibility
** A new `:deps/prep-lib` top-level key is used to say how a lib is prepared with the following keys: `:alias`, `:fn`, and `:ensures`. See <<xref/../../../../../reference/deps_and_cli#prep,prep>> docs for more.
** A new `:deps/prep-lib` top-level key is used to say how a lib is prepared with the following keys: `:alias`, `:fn`, and `:ensures`. See <<xref/../../../../../reference/clojure_cli#deps_prep,prep>> docs for more.
** A new `:tools/usage` top-level key is used to provide the `:ns-default` and `:ns-aliases` context for a tool
* <<xref/../../../../../reference/deps_and_cli#,Clojure CLI>>
* <<xref/../../../../../reference/clojure_cli#,Clojure CLI>>
** New `-T` switch is like `-X` (invokes a function) but omits the project `:paths` and `:deps` and adds `:paths ["."]` to provide a clean tool classpath. `-T:aliases` is same as -X, `-Ttoolname` - resolves and uses tool context.
** New API <<xref/../../../../../reference/deps_and_cli#_other_programs,help functions>> available via the built-in `:deps` alias: `help/doc` and `help/dir`
** New API <<xref/../../../../../reference/clojure_cli#fn_help,help functions>> available via the built-in `:deps` alias: `help/doc` and `help/dir`
** New API function `basis` that can be used to provide a custom basis to use, in combination with other tools that take a basis
** New API program `prep` that is used to <<xref/../../../../../reference/deps_and_cli#prep,prep>> source libs
** New API program `prep` that is used to <<xref/../../../../../reference/clojure_cli#deps_prep,prep>> source libs
* https://github.com/clojure/tools.deps.alpha[tools.deps.alpha]
** New library API: `create-basis` (also available in tools.build - use that one if writing a build program)
* https://github.com/clojure/tools.tools[tools.tools] - a tool library for managing tools
** https://clojure.github.io/tools.tools[API]
** <<xref/../../../../../reference/deps_and_cli#tool_install,Reference>>
** <<xref/../../../../../reference/clojure_cli#tool_install,Reference>>
** tools.tools is auto-installed by the Clojure CLI as a tool named `tools` (invoke with `-Ttools`)

You may also want to check out https://www.youtube.com/watch?v=BTAx-gFz6Ks[Alex Miller's talk] about this release at clojureD.
Expand Down
4 changes: 2 additions & 2 deletions content/news/2023/04/14/clojure-1-12-alpha2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Library resolution and download are provided by https://github.com/clojure/tools

== Invoke tool functions out of process

There are many useful tools you can use at development time, but which are not part of your project's actual dependencies. The Clojure CLI provides explicit support for <<xref/../../../../../reference/deps_and_cli#tool_install,tools>> with their own classpath, but there was not previously a way to invoke these interactively.
There are many useful tools you can use at development time, but which are not part of your project's actual dependencies. The Clojure CLI provides explicit support for <<xref/../../../../../reference/clojure_cli#tool_install,tools>> with their own classpath, but there was not previously a way to invoke these interactively.

Now Clojure includes https://clojure.github.io/clojure/branch-master/clojure.tools.deps.interop-api.html#clojure.tools.deps.interop/invoke-tool[clojure.tools.deps.interop/invoke-tool] to invoke a tool function out of process. The classpath for the tool is defined in your deps.edn so you do not need to add the tool's dependencies to your project classpath.

`add-lib` functionality is built using `invoke-tool` but you can also use it to build or invoke your own tools for interactive use. Find more about the function execution protocol on the <<xref/../../../../../reference/deps_and_cli#function_protocol,deps reference>>.
`add-lib` functionality is built using `invoke-tool` but you can also use it to build or invoke your own tools for interactive use. Find more about the function execution protocol on the <<xref/../../../../../reference/clojure_cli#function_protocol,deps reference>>.

== Start and control external processes

Expand Down
Loading

0 comments on commit 5f18515

Please sign in to comment.