-
Notifications
You must be signed in to change notification settings - Fork 5
/
lakefile.lean
40 lines (32 loc) · 1.5 KB
/
lakefile.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Lake
open Lake DSL System
-- Usually the `tag` will be of the form `nightly-2021-11-22`.
-- If you would like to use an artifact from a PR build,
-- it will be of the form `pr-branchname-sha`.
def tag : String := "nightly-2024-08-13-06"
def releaseRepo : String := "leanprover-community/mathport"
def oleanTarName : String := "mathlib3-binport.tar.gz"
def untar (file : FilePath) : JobM PUnit := Lake.proc
{ cmd := "tar",
args := #["-xzf", file.fileName.getD "."] -- really should throw an error if `file.fileName = none`
cwd := file.parent }
def getReleaseArtifact (repo tag artifact : String) (to : FilePath) : JobM PUnit :=
download s!"https://github.com/{repo}/releases/download/{tag}/{artifact}" (to / artifact)
def untarReleaseArtifact (repo tag artifact : String) (to : FilePath) : JobM PUnit := do
getReleaseArtifact repo tag artifact to
untar (to / artifact)
package mathlib3port where
extraDepTargets := #[`fetchOleans]
target fetchOleans (_pkg) : Unit := Job.async do
let libDir : FilePath := __dir__ / ".lake" / "build" / "lib"
IO.FS.createDirAll libDir
let oldTrace := Hash.ofString tag
let _ ← buildFileUnlessUpToDate (libDir / oleanTarName) oldTrace do
logInfo "Fetching oleans for Mathbin"
untarReleaseArtifact releaseRepo tag oleanTarName libDir
return ((), .nil)
require lean3port from git "https://github.com/leanprover-community/lean3port.git"@"931526d2b9ca0a7966bef17835ebaf7d28a8c3a2"
@[default_target]
lean_lib Mathbin where
roots := #[]
globs := #[`Mathbin]