Skip to content

Commit ba82e34

Browse files
authored
Merge pull request #61 from cgay/dev
Fix workspace/registry bugs
2 parents 1b2c50f + f31ed43 commit ba82e34

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

documentation/source/index.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,19 @@ package dependencies for you.
304304
registry files specifically for the current platform, e.g.,
305305
``x86_64-linux``.
306306

307+
Git Submodules
308+
--------------
309+
310+
It generally shouldn't be necessary to use Git submodules when using Deft. In fact, if
311+
your workspace has a submodule which is also pulled in as a package dependency it will
312+
confuse Deft because it will find multiple LID files for the same library. In that case
313+
Deft will issue a warning and choose one arbitrarily. Use the package instead of a
314+
submodule.
315+
316+
If you need to pull in some code from another repository that doesn't have a Deft package
317+
there should be no conflict.
318+
319+
307320
Platform-specific Libraries
308321
---------------------------
309322

sources/workspaces/lid.dylan

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,30 @@ end function;
8181
define function matches-current-platform?
8282
(lid :: <lid>) => (matches? :: <bool>)
8383
let current-platform = as(<string>, os/$platform-name);
84-
let platform = lid-value(lid, $platforms-key);
85-
// Assume that if the LID is included in another LID then it contains the
84+
let platforms = lid-values(lid, $platforms-key) | #[];
85+
// Assume that if the LID is included in another LID then it contains only the
8686
// platform-independent attributes of a multi-platform project and is not a top-level
8787
// library.
88-
platform = current-platform
89-
| (~platform & lid.library-name & empty?(lid.lid-included-in))
88+
member?(current-platform, platforms, test: \=)
89+
| (empty?(platforms) & lid.library-name & empty?(lid.lid-included-in))
9090
end function;
9191

9292
define function add-lid
9393
(ws :: <workspace>, active-package :: false-or(pm/<release>), lid :: <lid>)
9494
=> ()
9595
if (matches-current-platform?(lid))
96-
let library = lid-value(lid, $library-key);
97-
if (library)
98-
let lids = element(ws.%lids-by-library, library, default: #());
99-
ws.%lids-by-library[library] := pair(lid, lids);
100-
end;
101-
ws.%lids-by-pathname[as(<string>, lid.lid-locator)] := lid;
102-
if (active-package)
103-
let lids = element(ws.%lids-by-release, active-package, default: #());
104-
ws.%lids-by-release[active-package] := pair(lid, lids);
96+
let path = as(<string>, lid.lid-locator);
97+
unless (element(ws.%lids-by-pathname, path, default: #f))
98+
ws.%lids-by-pathname[path] := lid;
99+
let library = lid-value(lid, $library-key);
100+
if (library)
101+
let lids = element(ws.%lids-by-library, library, default: #());
102+
ws.%lids-by-library[library] := pair(lid, lids);
103+
end;
104+
if (active-package)
105+
let lids = element(ws.%lids-by-release, active-package, default: #());
106+
ws.%lids-by-release[active-package] := pair(lid, lids);
107+
end;
105108
end;
106109
end;
107110
end function;

0 commit comments

Comments
 (0)