aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor
diff options
context:
space:
mode:
authorEduardo Julian2020-12-03 02:09:57 -0400
committerEduardo Julian2020-12-03 02:09:57 -0400
commit0205e5146b50ab066d152fccda0fc8cef4eef852 (patch)
treeda2d89132da8f09344e26db78d0e43ca1095ee7f /stdlib/source/program/compositor
parent28c724857d76afdc40b5b036f415cc151eb66263 (diff)
Detect duplicate files coming from dependencies.
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/compositor/import.lux25
1 files changed, 20 insertions, 5 deletions
diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux
index 318c3705c..edc0160f5 100644
--- a/stdlib/source/program/compositor/import.lux
+++ b/stdlib/source/program/compositor/import.lux
@@ -1,5 +1,5 @@
(.module:
- [lux #*
+ [lux (#- Module)
[abstract
["." monad (#+ Monad do)]]
[control
@@ -13,12 +13,18 @@
["<b>" binary]]]
[data
[binary (#+ Binary)]
- ["." text]
+ ["." text
+ ["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
["." row]]
[format
["." tar]]]
+ [tool
+ [compiler
+ [meta
+ [archive
+ [descriptor (#+ Module)]]]]]
[world
["." file (#+ Path File)]]]
[//
@@ -29,6 +35,11 @@
(exception: #export useless-tar-entry)
+(exception: #export (duplicate {library Library} {module Module})
+ (exception.report
+ ["Module" (%.text module)]
+ ["Library" (%.text library)]))
+
(type: #export Import
(Dictionary Path Binary))
@@ -44,9 +55,13 @@
(monad.fold ! (function (_ entry import)
(case entry
(#tar.Normal [path instant mode ownership content])
- (dictionary.try-put (tar.from-path path)
- (tar.data content)
- import)
+ (let [path (tar.from-path path)]
+ (case (dictionary.try-put path (tar.data content) import)
+ (#try.Success import)
+ (wrap import)
+
+ (#try.Failure error)
+ (exception.throw ..duplicate [library path])))
_
(exception.throw ..useless-tar-entry [])))