From ddcc768d9d2e798814989037a286df9951840bcd Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 12 Aug 2020 01:01:30 -0400 Subject: WIP: New build-tool named Aedifex (can read project descriptions). --- stdlib/source/program/aedifex/dependency.lux | 14 +++ stdlib/source/program/aedifex/parser.lux | 140 +++++++++++++++++++++++++++ stdlib/source/program/aedifex/project.lux | 68 +++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 stdlib/source/program/aedifex/dependency.lux create mode 100644 stdlib/source/program/aedifex/parser.lux create mode 100644 stdlib/source/program/aedifex/project.lux (limited to 'stdlib/source/program/aedifex') diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux new file mode 100644 index 000000000..2507ad589 --- /dev/null +++ b/stdlib/source/program/aedifex/dependency.lux @@ -0,0 +1,14 @@ +(.module: + [lux (#- Type)]) + +(type: #export Type + Text) + +(template [ ] + [(def: #export + Type + )] + + ["tar" lux-library] + ["jar" jvm-library] + ) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux new file mode 100644 index 000000000..f3bdbe34f --- /dev/null +++ b/stdlib/source/program/aedifex/parser.lux @@ -0,0 +1,140 @@ +(.module: + [lux (#- type) + [abstract + [monad (#+ do)]] + [control + ["<>" parser + ["" code (#+ Parser)]]] + [data + ["." text]] + [world + [net (#+ URL)]]] + [// + ["/" project] + ["//." dependency]]) + +(def: group + (Parser /.Group) + .text) + +(def: name + (Parser /.Name) + .text) + +(def: version + (Parser /.Version) + .text) + +(def: artifact' + (Parser /.Artifact) + ($_ <>.and ..group ..name ..version)) + +(def: artifact + (Parser /.Artifact) + (.tuple ..artifact')) + +(def: url + (Parser URL) + .text) + +(def: scm + (Parser /.SCM) + ..url) + +(def: license + (Parser /.License) + (.tuple ($_ <>.and + ..name + ..url + (<>.default #/.Repo + (<>.or (.this! (' #repo)) + (.this! (' #manual))))))) + +(def: organization + (Parser /.Organization) + (<| .form + (<>.after (.this! (' #organization))) + ($_ <>.and + ..name + ..url))) + +(def: developer' + (Parser /.Developer) + ($_ <>.and + ..name + ..url + (<>.maybe ..organization) + )) + +(def: developer + (Parser /.Developer) + (<| .form + (<>.after (.this! (' #developer))) + ..developer')) + +(def: contributor + (Parser /.Contributor) + (<| .form + (<>.after (.this! (' #contributor))) + ..developer')) + +(def: no-info + /.Info + {#/.url #.None + #/.scm #.None + #/.description #.None + #/.licenses (list) + #/.organization #.None + #/.developers (list) + #/.contributors (list)}) + +(def: (bundle tag parser) + (All [a] (-> Code (Parser a) (Parser (List a)))) + (.form (<>.after (.this! tag) + (<>.some parser)))) + +(def: info + (Parser /.Info) + ($_ <>.and + (<>.maybe ..url) + (<>.maybe ..scm) + (<>.maybe .text) + (<>.default (list) (..bundle (' #licenses) ..license)) + (<>.maybe ..organization) + (<>.default (list) (..bundle (' #developers) ..developer)) + (<>.default (list) (..bundle (' #contributors) ..contributor)) + )) + +(def: repository + (Parser /.Repository) + ..url) + +(def: type + (Parser //dependency.Type) + .text) + +(def: dependency + (Parser /.Dependency) + (.tuple + ($_ <>.and + ..artifact' + (<>.default //dependency.lux-library ..type) + ))) + +(def: #export project + (Parser /.Project) + (<| .form + (<>.after (.this! (' project:))) + (`` ($_ <>.and + ..artifact + (<| (<>.default ..no-info) + .form + (<>.after (.this! (' #info))) + ..info) + (<| (<>.default (list)) + (..bundle (' #repositories)) + ..repository) + (<| (<>.default (list)) + (..bundle (' #dependencies)) + ..dependency) + )))) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux new file mode 100644 index 000000000..a0891951f --- /dev/null +++ b/stdlib/source/program/aedifex/project.lux @@ -0,0 +1,68 @@ +(.module: + [lux (#- Name Info) + [world + [net (#+ URL)]]] + [// + ["." dependency]]) + +(type: #export Group + Text) + +(type: #export Name + Text) + +(type: #export Version + Text) + +(type: #export Artifact + {#group Group + #name Name + #version Version}) + +(type: #export Distribution + #Repo + #Manual) + +(type: #export License + [Name + URL + Distribution]) + +(type: #export SCM + URL) + +(type: #export Organization + [Name + URL]) + +(type: #export Email + Text) + +(type: #export Developer + [Name + Email + (Maybe Organization)]) + +(type: #export Contributor + Developer) + +(type: #export Info + {#url (Maybe URL) + #scm (Maybe SCM) + #description (Maybe Text) + #licenses (List License) + #organization (Maybe Organization) + #developers (List Developer) + #contributors (List Contributor)}) + +(type: #export Repository + URL) + +(type: #export Dependency + [Artifact dependency.Type]) + +(type: #export Project + {#identity Artifact + #info Info + #repositories (List Repository) + #dependencies (List Dependency)}) -- cgit v1.2.3