This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save resolved packages in a manifest
closes #31
- Loading branch information
Showing
4 changed files
with
136 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/- | ||
Copyright (c) 2022 Mac Malone. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Mac Malone | ||
-/ | ||
import Lean.Data.Json | ||
|
||
open Lean | ||
|
||
namespace Lake | ||
|
||
/-- An entry for a package in the manifest. -/ | ||
structure PackageEntry where | ||
name : String | ||
url : String | ||
rev : String | ||
deriving Inhabited, Repr, FromJson, ToJson | ||
|
||
/-- Manifest file format. -/ | ||
structure Manifest where | ||
version : Nat := 1 | ||
packages : Array PackageEntry | ||
deriving Inhabited, Repr, FromJson, ToJson | ||
|
||
namespace Manifest | ||
|
||
def toMap (self : Manifest) : NameMap PackageEntry := | ||
self.packages.foldl (fun map entry => map.insert entry.name entry) {} | ||
|
||
def fromMap (map : NameMap PackageEntry) : Manifest := { | ||
packages := map.fold (fun a k v => a.push v) #[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters