@@ -122,19 +122,21 @@ def get_module_mappings(label, attrs, vars, rule_kind, srcs = [], workspace_name
122122 elif label .workspace_root :
123123 mr = "%s/%s" % (label .workspace_root , mr )
124124
125- if mn in mappings and mappings [mn ] != mr :
126- fail (("duplicate module mapping at %s: %s maps to both %s and %s" %
127- (label , mn , mappings [mn ], mr )), "deps" )
128- _debug (vars , "target %s adding module mapping %s: %s" % (label , mn , mr ))
129-
130125 # since our module mapping is currently based on attribute names,
131126 # allow a special one to instruct the linker that the package has no output
132127 # directory and is therefore meant to be used as sources.
133128 # TODO: This belongs in a different mechanism like a package.json field.
134129 if getattr (attrs , "module_from_src" , False ):
135- mappings [ mn ] = ["src" , mr ]
130+ mr = ["src" , mr ]
136131 else :
137- mappings [mn ] = ["bin" , mr ]
132+ mr = ["bin" , mr ]
133+
134+ if mn in mappings and mappings [mn ] != mr :
135+ fail (("duplicate module mapping at %s: %s maps to both %s and %s" %
136+ (label , mn , mappings [mn ], mr )), "deps" )
137+ _debug (vars , "target %s adding module mapping %s: %s" % (label , mn , mr ))
138+
139+ mappings [mn ] = mr
138140 return mappings
139141
140142# When building a mapping for use at runtime, we need paths to be relative to
0 commit comments