refactor: move main into Lake.Main which is not imported by Lake

This commit is contained in:
tydeu 2021-09-25 19:18:10 -04:00
parent 1d052a1b39
commit efadebd5ef
4 changed files with 43 additions and 11 deletions

View file

@ -1,16 +1,29 @@
/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Copyright (c) 2021 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Gabriel Ebner, Sebastian Ullrich, Mac Malone
Authors: Mac Malone
-/
import Lake.Async
import Lake.BuildBin
import Lake.BuildModule
import Lake.BuildMonad
import Lake.BuildPackage
import Lake.BuildTarget
import Lake.BuildTargets
import Lake.BuildTop
import Lake.Cli
import Lake.CliT
import Lake.Compile
import Lake.Git
import Lake.Glob
import Lake.Help
import Lake.Init
import Lake.LeanConfig
import Lake.LeanVersion
import Lake.Package
import Lake.Resolve
import Lake.SearchPath
def main (args : List String) : IO UInt32 := do
try
Lake.setupLeanSearchPath
Lake.cli args
pure 0
catch e =>
IO.eprintln <| "error: " ++ toString e -- avoid "uncaught exception: ..."
pure 1
import Lake.Target
import Lake.Task
import Lake.Trace
import Lake.Version

16
Lake/Main.lean Normal file
View file

@ -0,0 +1,16 @@
/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Gabriel Ebner, Sebastian Ullrich, Mac Malone
-/
import Lake.Cli
import Lake.SearchPath
def main (args : List String) : IO UInt32 := do
try
Lake.setupLeanSearchPath
Lake.cli args
pure 0
catch e =>
IO.eprintln <| "error: " ++ toString e -- avoid "uncaught exception: ..."
pure 1

View file

@ -7,6 +7,7 @@ def package : PackageConfig := {
srcDir := FilePath.mk ".." / ".."
oleanDir := "."
leancArgs := #["-O3", "-DNDEBUG"]
binRoot := `Lake.Main
linkArgs :=
if Platform.isWindows then
#["-Wl,--export-all"]

View file

@ -1 +1,3 @@
set -ex
${LAKE:-../../build/bin/lake} build-lib
${LAKE:-../../build/bin/lake} build-bin