Transporting a Lake workspace summary over Json #
This file defines WorkspaceSummary for summarizing a Lake workspace and getWorkspaceSummary for
transporting the bare minimum over a process boundary. (This is then used to compute a
WorkspaceModel, including import hierarchy data, with getWorkspaceModel from
ImportGraph.WorkspaceModel.Build.)
The motivation for this is the need to inspect the broader import hierarchy and lake workspace from
within the language server. However, loading the lake workspace from within the lake language
server causes a crash, so we must call out to an exe (import-graph-workspace-summary) across a
process boundary, and have it send back this data as json, which we then use (within the language
server) to compute the much richer WorkspaceModel.
getWorkspaceSummary also caches the resulting json in the .lake folder to avoid future external
calls if possible. Note that the module set is not included in the transported or cached json;
these are recomputed from the roots and globs stored in the json.
This shares BaseWorkspace with WorkspaceModel.
A summary of lean_lib data for transport over Json.
Instances For
A summary of a lake package for transport over Json. All paths are absolute.
The Lake indices of the package's direct dependencies (Lake's
depPkgs).- libs : Array LibrarySummary
The package's
lean_libs. - configFile : System.FilePath
The package's config file (absolute). We use this (only) for hashing.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
A summary of the lake workspace suitable for transport over Json. This may be obtained with
getWorkspaceSummary and enriched into a model of the workspace and its intradependencies via
getWorkspaceModel.
- packages : Array PackageSummary
The packages of the workspace, in Lake's workspace order (root first); each package's position is its
lakeIdx. - inputHash : UInt64
The hash of inputs to this workspace summary: the lakefile (and the lakefiles of required packages), the lake manifest, the
package-overrides.json, thelean-toolchainfile, and the lean githash.We unwrap lake's
Hashinto aUInt64to avoid a public lake dependency. - packageOverridesFile : System.FilePath
The
.lake/package-overrides.jsonfilepath (absolute). May not exist.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
The name of the executable with root ImportGraph.WorkspaceModel.Emit.
Should be synchronized with the lakefile.
Equations
- ImportGraph.Lake.WorkspaceSummary.exeName = "import-graph-workspace-summary"
Instances For
The "obvious" lakeDir given a workspace directory. TODO: Really, we ought to read this off of
the lakeDir field from the lake-manifest.json instead of just trying to append .lake.
Equations
- ImportGraph.Lake.lakeDirPath wsDir = do let __do_lift ← wsDir.getDM IO.currentDir pure (__do_lift / { toString := ".lake" })
Instances For
A (new) folder in the given .lake directory for storing import graph data.
Equations
- ImportGraph.Lake.importGraphBuildDirPath lakeDir = lakeDir / { toString := "importGraph" }
Instances For
The directory in which the cache lives. This is currently
importGraphBuildDirPath := .lake/importGraph/, a directory exclusively for special import graph
data such as the workspace summary cache.
Instances For
Given a special-purpose build folder in the lake directory, the path to
workspace-summary.json, where we cache the workspace summary.
Equations
- ImportGraph.Lake.WorkspaceSummary.cachePath cacheDir = cacheDir / { toString := "workspace-summary.json" }