2023-04-25 18:37:27 +02:00
|
|
|
import Lake
|
|
|
|
|
open Lake DSL
|
|
|
|
|
|
2023-11-09 17:51:20 +01:00
|
|
|
-- Using this assumes that each dependency has a tag of the form `v4.X.0`.
|
|
|
|
|
def leanVersion : String := s!"v{Lean.versionString}"
|
|
|
|
|
|
2023-05-04 11:48:58 +02:00
|
|
|
def LocalGameServer : Dependency := {
|
|
|
|
|
name := `GameServer
|
|
|
|
|
src := Source.path "../lean4game/server"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def RemoteGameServer : Dependency := {
|
|
|
|
|
name := `GameServer
|
2023-11-09 17:51:20 +01:00
|
|
|
src := Source.git "https://github.com/leanprover-community/lean4game.git" leanVersion "server"
|
2023-05-04 11:48:58 +02:00
|
|
|
}
|
|
|
|
|
|
2023-11-09 17:51:20 +01:00
|
|
|
/- Choose GameServer dependency depending on the environment variable `LEAN4GAME`. -/
|
2023-05-04 11:48:58 +02:00
|
|
|
open Lean in
|
|
|
|
|
#eval (do
|
2023-11-09 17:51:20 +01:00
|
|
|
let gameServerName := match (← IO.getEnv "LEAN4GAME") with
|
|
|
|
|
| none => ``RemoteGameServer
|
|
|
|
|
| some "" => ``RemoteGameServer
|
|
|
|
|
| some "local" => ``LocalGameServer
|
|
|
|
|
| some _ => panic "env var LEAN4GAME must be 'local' or unset."
|
2023-05-04 11:48:58 +02:00
|
|
|
modifyEnv (fun env => Lake.packageDepAttr.ext.addEntry env gameServerName)
|
2023-11-09 17:51:20 +01:00
|
|
|
: Elab.Command.CommandElabM Unit)
|
|
|
|
|
|
|
|
|
|
/-! # USER SECTION
|
|
|
|
|
|
|
|
|
|
Below are all the dependencies the game needs. Add or remove packages here as you need them.
|
|
|
|
|
|
|
|
|
|
Note: If your package (like `mathlib` or `Std`) has tags of the form `v4.X.0` then
|
|
|
|
|
you can use `require mathlib from git "[URL]" @ leanVersion`
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require mathlib from git "https://github.com/leanprover-community/mathlib4.git" @ leanVersion
|
|
|
|
|
|
|
|
|
|
|
2023-05-04 11:48:58 +02:00
|
|
|
|
2023-11-09 17:51:20 +01:00
|
|
|
/-! # END USER SECTION -/
|
2023-08-04 17:14:49 +02:00
|
|
|
|
2023-10-17 16:05:46 +02:00
|
|
|
-- NOTE: We abuse the `trace.debug` option to toggle messages in VSCode on and
|
|
|
|
|
-- off when calling `lake build`. Ideally there would be a better way using `logInfo` and
|
|
|
|
|
-- an option like `lean4game.verbose`.
|
2023-05-15 15:05:02 +02:00
|
|
|
package Game where
|
2023-11-09 17:51:20 +01:00
|
|
|
moreLeanArgs := #[
|
|
|
|
|
"-Dtactic.hygienic=false",
|
|
|
|
|
"-Dlinter.unusedVariables.funArgs=false",
|
2023-10-18 11:37:07 +02:00
|
|
|
"-Dtrace.debug=false"]
|
2023-11-09 17:51:20 +01:00
|
|
|
moreServerArgs := #[
|
|
|
|
|
"-Dtactic.hygienic=false",
|
|
|
|
|
"-Dlinter.unusedVariables.funArgs=true",
|
2023-10-18 11:37:07 +02:00
|
|
|
"-Dtrace.debug=true"]
|
2023-10-17 16:05:46 +02:00
|
|
|
weakLeanArgs := #[]
|
2023-04-25 18:37:27 +02:00
|
|
|
|
|
|
|
|
@[default_target]
|
2023-05-15 15:05:02 +02:00
|
|
|
lean_lib Game
|