This PR adds support for plugins to the frontend and server. Implementation-wise, this adds a `plugins` argument to `runFrontend`, `processHeader`, amd `importModules`, a `plugins` field to `SetupImportsResult` and `FileSetupResult`. and a `pluginsPath` field to `LeanPaths`, and then threads the value through these.
32 lines
942 B
Text
32 lines
942 B
Text
/-
|
|
Copyright (c) 2021 Sebastian Ullrich. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Sebastian Ullrich
|
|
-/
|
|
prelude
|
|
import Lean.Data.Json
|
|
import Lean.Util.Path
|
|
|
|
/-! Communicating Lean search paths between processes -/
|
|
|
|
namespace Lean
|
|
|
|
open System
|
|
|
|
structure LeanPaths where
|
|
oleanPath : SearchPath
|
|
srcPath : SearchPath
|
|
loadDynlibPaths : Array FilePath := #[]
|
|
pluginPaths : Array FilePath := #[]
|
|
deriving ToJson, FromJson
|
|
|
|
def initSrcSearchPath (pkgSearchPath : SearchPath := ∅) : IO SearchPath := do
|
|
let srcSearchPath := (← IO.getEnv "LEAN_SRC_PATH")
|
|
|>.map System.SearchPath.parse
|
|
|>.getD []
|
|
let srcPath := (← IO.appDir) / ".." / "src" / "lean"
|
|
-- `lake/` should come first since on case-insensitive file systems, Lean thinks that `src/` also contains `Lake/`
|
|
return srcSearchPath ++ pkgSearchPath ++ [srcPath / "lake", srcPath]
|
|
|
|
end Lean
|