File: Cache/IO.lean

full_name: System.FilePath.withoutParent
code: /-- Removes a parent path from the beginning of a path -/
def System.FilePath.withoutParent (path parent : FilePath) : FilePath 
goal: System.FilePath

full_name: System.FilePath.withoutParent.aux
code: /-- Removes a parent path from the beginning of a path -/
def System.FilePath.withoutParent (path parent : FilePath) : FilePath 
goal: List String → List String → List String

full_name: Nat.toHexDigits
code: def Nat.toHexDigits (n : Nat) : Nat → (res : String := "") → String
  
goal: Nat → optParam String "" → String

full_name: UInt64.asLTar
code: def UInt64.asLTar (n : UInt64) : String 
goal: String

full_name: Cache.IO.LIBDIR
code: /-- Target directory for build files -/
def LIBDIR : FilePath 
goal: System.FilePath

full_name: Cache.IO.IRDIR
code: /-- Target directory for IR files -/
def IRDIR : FilePath 
goal: System.FilePath

full_name: Cache.IO.CACHEDIR
code: /-- Target directory for caching -/
initialize CACHEDIR : FilePath ← do
  match ← IO.getEnv "XDG_CACHE_HOME" with
  | some path => return path / "mathlib"
  | none =>
    let home ← if System.Platform.isWindows then
      let drive ← IO.getEnv "HOMEDRIVE"
      let path ← IO.getEnv "HOMEPATH"
      pure <| return (← drive) ++ (← path)
    else IO.getEnv "HOME"
    match home with
    | some path => return path / ".cache" / "mathlib"
    | none => pure ⟨".cache"⟩
goal: System.FilePath

full_name: Cache.IO.initFn._@.Cache.IO._hyg.272
code: /-- Target directory for caching -/
initialize CACHEDIR : FilePath ← do
  match ← IO.getEnv "XDG_CACHE_HOME" with
  | some path => return path / "mathlib"
  | none =>
    let home ← if System.Platform.isWindows then
      let drive ← IO.getEnv "HOMEDRIVE"
      let path ← IO.getEnv "HOMEPATH"
      pure <| return (← drive) ++ (← path)
    else IO.getEnv "HOME"
    match home with
    | some path => return path / ".cache" / "mathlib"
    | none => pure ⟨".cache"⟩
goal: IO System.FilePath

full_name: Cache.IO.CURLCFG
code: /-- Target file path for `curl` configurations -/
def CURLCFG 
goal: System.FilePath

full_name: Cache.IO.CURLVERSION
code: /-- curl version at https://github.com/leanprover-community/static-curl -/
def CURLVERSION 
goal: String

full_name: Cache.IO.CURLBIN
code: def CURLBIN 
goal: System.FilePath

full_name: Cache.IO.LEANTARVERSION
code: /-- leantar version at https://github.com/digama0/leangz -/
def LEANTARVERSION 
goal: String

full_name: Cache.IO.EXE
code: def EXE 
goal: String

full_name: Cache.IO.LEANTARBIN
code: def LEANTARBIN 
goal: System.FilePath

full_name: Cache.IO.LAKEPACKAGESDIR
code: def LAKEPACKAGESDIR : FilePath 
goal: System.FilePath

full_name: Cache.IO.getCurl
code: def getCurl : IO String 
goal: IO String

full_name: Cache.IO.getLeanTar
code: def getLeanTar : IO String 
goal: IO String

full_name: Cache.IO.PackageDirs
code: abbrev PackageDirs 
goal: Type

full_name: Cache.IO.CacheM.Context
code: structure CacheM.Context where
  mathlibDepPath : FilePath
  packageDirs : PackageDirs
goal: Type

full_name: Cache.IO.CacheM.Context.packageDirs
code: structure CacheM.Context where
  mathlibDepPath : FilePath
  packageDirs : PackageDirs
goal: Cache.IO.PackageDirs

full_name: Cache.IO.CacheM.Context.mathlibDepPath
code: structure CacheM.Context where
  mathlibDepPath : FilePath
  packageDirs : PackageDirs
goal: System.FilePath

full_name: Cache.IO.CacheM
code: abbrev CacheM 
goal: Type

full_name: Cache.IO.isMathlibRoot
code: /-- Whether this is running on Mathlib repo or not -/
def isMathlibRoot : IO Bool 
goal: IO Bool

full_name: _private.Cache.IO.0.Cache.IO.parseMathlibDepPath
code: private def parseMathlibDepPath (json : Lean.Json) : Except String (Option FilePath) 
goal: Except String (Option System.FilePath)

full_name: _private.Cache.IO.0.Cache.IO.CacheM.mathlibDepPath
code: private def CacheM.mathlibDepPath : IO FilePath 
goal: IO System.FilePath

full_name: _private.Cache.IO.0.Cache.IO.CacheM.getContext
code: private def CacheM.getContext : IO CacheM.Context 
goal: IO Cache.IO.CacheM.Context

full_name: Cache.IO.CacheM.run
code: def CacheM.run (f : CacheM α) : IO α 
goal: IO α

full_name: Cache.IO.mathlibDepPath
code: def mathlibDepPath : CacheM FilePath 
goal: Cache.IO.CacheM System.FilePath

full_name: Cache.IO.getPackageDirs
code: def getPackageDirs : CacheM PackageDirs 
goal: Cache.IO.CacheM Cache.IO.PackageDirs

full_name: Cache.IO.getPackageDir
code: def getPackageDir (path : FilePath) : CacheM FilePath 
goal: Cache.IO.CacheM System.FilePath

full_name: Cache.IO.runCurlStreaming
code: /-- Runs a terminal command and retrieves its output, passing the lines to `processLine` -/
partial def runCurlStreaming (args : Array String) (init : α)
    (processLine : α → String → IO α) : IO α 
goal: IO α

full_name: Cache.IO.runCurlStreaming.loop
code: /-- Runs a terminal command and retrieves its output, passing the lines to `processLine` -/
partial def runCurlStreaming (args : Array String) (init : α)
    (processLine : α → String → IO α) : IO α 
goal: IO α

full_name: Cache.IO.runCmd
code: /-- Runs a terminal command and retrieves its output -/
def runCmd (cmd : String) (args : Array String) (throwFailure stderrAsErr := true) : IO String 
goal: IO String

full_name: Cache.IO.runCurl
code: def runCurl (args : Array String) (throwFailure stderrAsErr := true) : IO String 
goal: IO String

full_name: Cache.IO.validateCurl
code: def validateCurl : IO Bool 
goal: IO Bool

full_name: Cache.IO.Version
code: def Version 
goal: Type

full_name: Cache.IO.instOrdVersion
code: instance : Ord Version 
goal: Ord Cache.IO.Version

full_name: Cache.IO.instLEVersion
code: instance : LE Version 
goal: LE Cache.IO.Version

full_name: Cache.IO.parseVersion
code: def parseVersion (s : String) : Option Version 
goal: Option Cache.IO.Version

full_name: Cache.IO.validateLeanTar
code: def validateLeanTar : IO Unit 
goal: IO Unit

full_name: Cache.IO.getFilesWithExtension
code: /-- Recursively gets all files from a directory with a certain extension -/
partial def getFilesWithExtension
  (fp : FilePath) (extension : String) (acc : Array FilePath := #[]) :
    IO <| Array FilePath 
goal: IO (Array System.FilePath)

full_name: Cache.IO.HashMap
code: abbrev HashMap 
goal: Type

full_name: Cache.IO.HashMap.filterExists
code: /-- Filter the hashmap by whether the entries exist as files in the cache directory.

If `keep` is true, the result will contain the entries that do exist;
if `keep` is false, the result will contain the entries that do not exist.
-/
def filterExists (hashMap : HashMap) (keep : Bool) : IO HashMap 
goal: IO Cache.IO.HashMap

full_name: Cache.IO.HashMap.hashes
code: def hashes (hashMap : HashMap) : Lean.RBTree UInt64 compare 
goal: Lean.RBTree UInt64 compare

full_name: Cache.IO.mkDir
code: def mkDir (path : FilePath) : IO Unit 
goal: IO Unit

full_name: Cache.IO.mkBuildPaths
code: /--
Given a path to a Lean file, concatenates the paths to its build files.
Each build file also has a `Bool` indicating whether that file is required for caching to proceed.
-/
def mkBuildPaths (path : FilePath) : CacheM <| List (FilePath × Bool) 
goal: Cache.IO.CacheM (List (System.FilePath × Bool))

full_name: Cache.IO.allExist
code: /-- Check that all required build files exist. -/
def allExist (paths : List (FilePath × Bool)) : IO Bool 
goal: IO Bool

full_name: Cache.IO.packCache
code: /-- Compresses build files into the local cache and returns an array with the compressed files -/
def packCache (hashMap : HashMap) (overwrite verbose unpackedOnly : Bool)
    (comment : Option String := none) :
    CacheM <| Array String 
goal: Cache.IO.CacheM (Array String)

full_name: Cache.IO.getLocalCacheSet
code: /-- Gets the set of all cached files -/
def getLocalCacheSet : IO <| Lean.RBTree String compare 
goal: IO (Lean.RBTree String compare)

full_name: Cache.IO.isPathFromMathlib
code: def isPathFromMathlib (path : FilePath) : Bool 
goal: Bool

full_name: Cache.IO.unpackCache
code: /-- Decompresses build files into their respective folders -/
def unpackCache (hashMap : HashMap) (force : Bool) : CacheM Unit 
goal: Cache.IO.CacheM Unit

full_name: Cache.IO.instOrdFilePath_cache
code: instance : Ord FilePath 
goal: Ord System.FilePath

full_name: Cache.IO.cleanCache
code: /-- Removes all cache files except for what's in the `keep` set -/
def cleanCache (keep : Lean.RBTree FilePath compare := default) : IO Unit 
goal: IO Unit

full_name: Cache.IO.lookup
code: /-- Prints the LTAR file and embedded comments (in particular, the mathlib commit that built the
file) regarding the files with specified paths. -/
def lookup (hashMap : HashMap) (paths : List FilePath) : IO Unit 
goal: IO Unit