@@ -81,27 +81,30 @@ end function;
8181define 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))
9090end function ;
9191
9292define 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 ;
107110end function ;
0 commit comments