From 0205e5146b50ab066d152fccda0fc8cef4eef852 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 3 Dec 2020 02:09:57 -0400 Subject: Detect duplicate files coming from dependencies. --- stdlib/source/program/compositor/import.lux | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'stdlib/source/program/compositor') 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 @@ ["" 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 []))) -- cgit v1.2.3