Skip to content

Commit f612519

Browse files
committed
doc: lake: require @ git in README (#4849)
Demonstrates `require @ git` in Lake's README and tweaks related documentation. (cherry picked from commit 3ecbf4a)
1 parent 532c349 commit f612519

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/lake/Lake/DSL/Require.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ syntax verSpec :=
6767
&"git "? term:max
6868

6969
/--
70-
The version of the package to lookup in Lake's package index.
71-
A Git revision can be specified via `@ git "<rev>"`.
70+
The version of the package to require.
71+
To specify a Git revision, use the syntax `@ git <rev>`.
7272
-/
7373
syntax verClause :=
7474
" @ " verSpec
@@ -131,8 +131,8 @@ the different forms this clause can take.
131131
132132
Without a `from` clause, Lake will lookup the package in the default
133133
registry (i.e., Reservoir) and use the information there to download the
134-
package at the specified `version`. The optional `scope` is used to
135-
disambiguate which package with `pkg-name` to lookup. In Reservoir, this scope
134+
package at the requested `version`. The `scope` is used to disambiguate between
135+
packages in the registry with the same `pkg-name`. In Reservoir, this scope
136136
is the package owner (e.g., `leanprover` of `@leanprover/doc-gen4`).
137137
138138
The `with` clause specifies a `NameMap String` of Lake options

src/lake/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ For theorem proving packages which depend on `mathlib`, you can also run `lake n
337337

338338
**NOTE:** For mathlib in particular, you should run `lake exe cache get` prior to a `lake build` after adding or updating a mathlib dependency. Otherwise, it will be rebuilt from scratch (which can take hours). For more information, see mathlib's [wiki page](https://github.com/leanprover-community/mathlib4/wiki/Using-mathlib4-as-a-dependency) on using it as a dependency.
339339

340-
## Lean `require`
340+
### Lean `require`
341341

342342
The `require` command in Lean Lake configuration follows the general syntax:
343343

@@ -347,31 +347,34 @@ require ["<scope>" /] <pkg-name> [@ <version>]
347347
```
348348

349349
The `from` clause tells Lake where to locate the dependency.
350-
Without a `from` clause, Lake will lookup the package in the default registry (i.e., [Reservoir](https://reservoir.lean-lang.org/@lean-dojo/LeanCopilot)) and use the information there to download the package at the specified `version`. The optional `scope` is used to disambiguate which package with `pkg-name` to lookup. In Reservoir, this scope is the package owner (e.g., `leanprover` of [@leanprover/doc-gen4](https://reservoir.lean-lang.org/@leanprover/doc-gen4)).
350+
Without a `from` clause, Lake will lookup the package in the default registry (i.e., [Reservoir](https://reservoir.lean-lang.org)) and use the information there to download the package at the requested `version`. To specify a Git revision, use the syntax `@ git <rev>`.
351+
352+
The `scope` is used to disambiguate between packages in the registry with the same `pkg-name`. In Reservoir, this scope is the package owner (e.g., `leanprover` of [@leanprover/doc-gen4](https://reservoir.lean-lang.org/@leanprover/doc-gen4)).
353+
351354

352355
The `with` clause specifies a `NameMap String` of Lake options used to configure the dependency. This is equivalent to passing `-K` options to the dependency on the command line.
353356

354-
## Supported Sources
357+
### Supported Sources
355358

356359
Lake supports the following types of dependencies as sources in a `from` clause.
357360

358-
### Path Dependencies
361+
#### Path Dependencies
359362

360363
```
361364
from <path>
362365
```
363366

364367
Lake loads the package located a fixed `path` relative to the requiring package's directory.
365368

366-
### Git Dependencies
369+
#### Git Dependencies
367370

368371
```
369372
from git <url> [@ <rev>] [/ <subDir>]
370373
```
371374

372375
Lake clones the Git repository available at the specified fixed Git `url`, and checks out the specified revision `rev`. The revision can be a commit hash, branch, or tag. If none is provided, Lake defaults to `master`. After checkout, Lake loads the package located in `subDir` (or the repository root if no subdirectory is specified).
373376

374-
## TOML `require`
377+
### TOML `require`
375378

376379
To `require` a package in a TOML configuration, the parallel syntax for the above examples is:
377380

@@ -383,6 +386,12 @@ scope = "<scope>"
383386
version = "<version>"
384387
options = {<options>}
385388

389+
# A Reservoir Git dependency
390+
[[require]]
391+
name = "<pkg-name>"
392+
scope = "<scope>"
393+
rev = "<rev>"
394+
386395
# A path dependency
387396
[[require]]
388397
name = "<pkg-name>"

0 commit comments

Comments
 (0)