diff options
author | Eduardo Julian | 2020-12-03 02:09:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-03 02:09:57 -0400 |
commit | 0205e5146b50ab066d152fccda0fc8cef4eef852 (patch) | |
tree | da2d89132da8f09344e26db78d0e43ca1095ee7f /stdlib/source/program/compositor | |
parent | 28c724857d76afdc40b5b036f415cc151eb66263 (diff) |
Detect duplicate files coming from dependencies.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/compositor/import.lux | 25 |
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 []))) |