feat: only update deps in configure + don't ignore manifest.json

closes leanprover/lake#59, leanprover/lake#63
This commit is contained in:
tydeu 2022-05-23 20:38:54 -04:00
parent c1b4074d54
commit 85e3385aaa
5 changed files with 19 additions and 10 deletions

View file

@ -24,7 +24,7 @@ COMMANDS:
new <name> create a Lean package in a new directory
init <name> create a Lean package in the current directory
build [<targets>...] configure and build targets
configure download and build dependencies
configure update and build dependencies
clean remove build outputs
script manage and run workspace scripts
serve start the Lean language server
@ -79,10 +79,11 @@ TARGET EXAMPLES:
:bin build the root package's binary
A bare `build` command will build the default facet of the root package.
Arguments to the `Packager` itself can be specified with `args`."
Arguments to the `Packager` itself can be specified with `args`.
Package dependencies are not updated during a build."
def helpConfigure :=
"Download and build dependencies
"Update and build dependencies
USAGE:
lake configure [-- <args>...]
@ -92,8 +93,12 @@ This command sets up the directory with the package's dependencies
if specified.
For each (transitive) git dependency, the specified commit is checked out
into a sub-directory of `depsDir`. If there are dependencies on multiple
versions of the same package, the version materialized is undefined.
into a sub-directory of `packagesDir`. Already checked out dependencies are
updated to the latest version compatible with the package's configuration.
If there are dependencies on multiple versions of the same package, the
version materialized is undefined. The specific revision of the resolved
packages are cached in the `manifest.json` file of the `packagesDir`.
No copy is made of local dependencies."
def helpClean :=

View file

@ -5,6 +5,7 @@ Authors: Gabriel Ebner, Sebastian Ullrich, Mac Malone
-/
import Lake.Util.Git
import Lake.Config.Package
import Lake.Config.Workspace
import Lake.Config.Load
namespace Lake
@ -16,7 +17,10 @@ def toolchainFileName : FilePath :=
"lean-toolchain"
def gitignoreContents :=
s!"/{defaultBuildDir}\n/{defaultPackagesDir}\n"
s!"/{defaultBuildDir}
/{defaultPackagesDir}/*
!/{defaultPackagesDir}/{manifestFileName}
"
def libFileContents :=
s!"def hello := \"world\""

View file

@ -94,7 +94,7 @@ def loadPkg (args : List String := []) : CliStateM Package := do
setupLeanSearchPath (← getLeanInstall?) (← getLakeInstall?)
Package.load dir args (dir / file)
def loadWorkspace (args : List String := []) (updateDeps := true) : CliStateM Workspace := do
def loadWorkspace (args : List String := []) (updateDeps := false) : CliStateM Workspace := do
let pkg ← loadPkg args
let ws := Workspace.ofPackage pkg
let manifest ← do
@ -305,7 +305,7 @@ def command : (cmd : String) → CliM PUnit
runBuildM ws <| build (← takeArgs)
| "configure" => do
processOptions lakeOption
let ws ← loadWorkspace (← getSubArgs)
let ws ← loadWorkspace (← getSubArgs) (updateDeps := true)
noArgsRem <| runBuildM ws ws.root.buildDepOleans
| "print-paths" => do
processOptions lakeOption

View file

@ -47,7 +47,7 @@ The `src` of a `Dependency`.
In Lake, dependency sources currently come into flavors:
* Local `path`s relative to the package's directory.
* Remote `git` repositories that are download from a given `url`
into the packages's `depsDir`.
into the workspace's `packagesDir`.
-/
inductive Source where
| path (dir : FilePath)

View file

@ -78,7 +78,7 @@ package hello {
}
```
The next run of `lake build` (or refreshing dependencies in an editor like VSCode) will clone the mathlib repository and build it.
The next run of `lake build` (or refreshing dependencies in an editor like VSCode) will clone the mathlib repository and build it. Information on the specific revision cloned will then be saved to `manifest.json` in `lean_packages` to enable reproducibility. To update `mathlib` after this, you will need to run `lake configure` -- other commands do not update resolved dependencies.
Further examples of different package configurations can be found in the [`examples`](examples) folder of this repository.