diff options
Diffstat (limited to 'stdlib/source/program/aedifex')
-rw-r--r-- | stdlib/source/program/aedifex/input.lux | 59 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/local.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/profile.lux | 3 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/project.lux | 3 |
4 files changed, 64 insertions, 5 deletions
diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux new file mode 100644 index 000000000..ffed02d28 --- /dev/null +++ b/stdlib/source/program/aedifex/input.lux @@ -0,0 +1,59 @@ +(.module: + [lux #* + [abstract + [monad (#+ Monad do)]] + [control + [pipe (#+ do>)] + ["." try (#+ Try)] + [parser + ["<c>" code]] + [security + ["!" capability]]] + [data + [binary (#+ Binary)] + ["." text + ["." encoding]]] + [meta + ["." location]] + [tool + [compiler + [language + [lux + ["." syntax]]]]] + [world + ["." file]]] + ["." // #_ + ["#" profile (#+ Profile)] + ["#." action (#+ Action)] + ["#." project (#+ Project)] + ["#." parser]]) + +(def: (parse-lux source-code) + (-> Text (Try Code)) + (let [parse (syntax.parse "" + syntax.no-aliases + (text.size source-code))] + (case (parse [location.dummy 0 source-code]) + (#.Left [_ error]) + (#try.Failure error) + + (#.Right [_ lux-code]) + (#try.Success lux-code)))) + +(def: parse-project + (-> Binary (Try Project)) + (|>> (do> try.monad + [encoding.from-utf8] + [..parse-lux] + [(list) (<c>.run //parser.project)]))) + +(def: #export (read monad fs profile) + (All [!] (-> (Monad !) (file.System !) Text (! (Try Profile)))) + (do (try.with monad) + [project-file (!.use (:: fs file) //project.file) + project-file (!.use (:: project-file content) [])] + (:: monad wrap + (|> project-file + (do> try.monad + [..parse-project] + [(//project.profile profile)]))))) diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux index bc2dbfb91..c7c72c827 100644 --- a/stdlib/source/program/aedifex/local.lux +++ b/stdlib/source/program/aedifex/local.lux @@ -137,13 +137,13 @@ [pom (encoding.from-utf8 pom) pom (:: xml.codec decode pom) profile (<xml>.run //pom.parser pom)] - (wrap [pom (set.to-list (get@ #/.dependencies profile))]))) + (wrap [pom (get@ #/.dependencies profile)]))) library (..read! system (format prefix (//artifact/extension.extension type))) sha1 (..read! system (format prefix //artifact/extension.sha1)) md5 (..read! system (format prefix //artifact/extension.md5))] (wrap {#//dependency/resolution.library library #//dependency/resolution.pom pom - #//dependency/resolution.dependencies dependencies + #//dependency/resolution.dependencies (set.to-list dependencies) #//dependency/resolution.sha1 (|> sha1 (:coerce (//hash.Hash //hash.SHA-1)) (:: //hash.sha1-codec encode)) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index d8ebf9b18..190ed3714 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -24,9 +24,6 @@ ["." artifact (#+ Artifact)] ["." dependency]]) -(def: #export file - "project.lux") - (type: #export Distribution #Repo #Manual) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 071f54b12..9bc80c462 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -17,6 +17,9 @@ ["." // #_ ["#" profile (#+ Name Profile)]]) +(def: #export file + "project.lux") + (type: #export Project (Dictionary Name Profile)) |