import Lake
open Lake DSL

-- The manual genre of the Lean reference manual is pinned to the tag
-- matching the toolchain; verso is NOT required explicitly but resolved
-- through the reference manual's own pin (its v4.33.0-rc2 tag needs a
-- verso nightly, not the verso tag of the same name).  Mathlib is
-- pinned to the same commit as before (a master snapshot on toolchain
-- v4.33.0-rc2).  Mathlib comes LAST so that its pins of shared
-- dependencies (batteries, …) take precedence — otherwise
-- `lake exe cache get` refuses to work.
require «verso-manual» from git
  "https://github.com/leanprover/reference-manual.git"@"v4.33.0-rc2"
require mathlib from git
  "https://github.com/leanprover-community/mathlib4"@"87adeaebd370a3b6a41ac4f044fddd4bf81803ad"

package «AlgebraInLean» where
  -- building the C code costs much more than the optimizations save
  moreLeancArgs := #["-O0"]
  -- work around clang emitting invalid linker optimization hints that lld rejects
  moreLinkArgs :=
    if System.Platform.isOSX then
      #["-Wl,-ignore_optimization_hints"]
    else #[]

/-- The exercise files that students open in VS Code. -/
@[default_target]
lean_lib «AlgebraInLean» where

/-- The Verso sources of the course notes. -/
@[default_target]
lean_lib «Book» where

/-- The generator executable: `lake exe algebrainlean --output _out`
renders the course notes to `_out/html-multi`. -/
@[default_target]
lean_exe «algebrainlean» where
  srcDir := "./"
  root := `Main
