diff --git a/Lake/CLI/Help.lean b/Lake/CLI/Help.lean index d39df21a00..1101fde499 100644 --- a/Lake/CLI/Help.lean +++ b/Lake/CLI/Help.lean @@ -24,7 +24,7 @@ COMMANDS: new create a Lean package in a new directory init create a Lean package in the current directory build [...] 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 [-- ...] @@ -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 := diff --git a/Lake/CLI/Init.lean b/Lake/CLI/Init.lean index bdd75ebebc..3a71a93640 100644 --- a/Lake/CLI/Init.lean +++ b/Lake/CLI/Init.lean @@ -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\"" diff --git a/Lake/CLI/Main.lean b/Lake/CLI/Main.lean index 9bdabcbca0..4b36861fb4 100644 --- a/Lake/CLI/Main.lean +++ b/Lake/CLI/Main.lean @@ -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 diff --git a/Lake/Config/Package.lean b/Lake/Config/Package.lean index e67d44cb1d..c603375cf8 100644 --- a/Lake/Config/Package.lean +++ b/Lake/Config/Package.lean @@ -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) diff --git a/README.md b/README.md index 3469dc58c4..734ab24cc7 100644 --- a/README.md +++ b/README.md @@ -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.