Merge pull request #161 from cgrindel/gh0055_missing_target_under_license

fix: ensure `gather_metadata_info_common()` returns providers with  `target_under_license` set
diff --git a/rules/licenses_core.bzl b/rules/licenses_core.bzl
index fff3b82..921cb06 100644
--- a/rules/licenses_core.bzl
+++ b/rules/licenses_core.bzl
@@ -151,7 +151,12 @@
     # fully resolved. If exec is in the bin_dir path, then the current
     # configuration is probably cfg = exec.
     if "-exec-" in ctx.bin_dir.path:
-        return [provider_factory(deps = depset(), licenses = depset(), traces = [])]
+        return [provider_factory(
+            target_under_license = target.label,
+            deps = depset(),
+            licenses = depset(),
+            traces = [],
+        )]
 
     # Now gather transitive collection of providers from the targets
     # this target depends upon.
@@ -164,7 +169,12 @@
     _get_transitive_metadata(ctx, trans_licenses, trans_other_metadata, trans_package_info, trans_deps, traces, provider_factory, filter_func)
 
     if not licenses and not trans_licenses:
-        return [provider_factory(deps = depset(), licenses = depset(), traces = [])]
+        return [provider_factory(
+            target_under_license = target.label,
+            deps = depset(),
+            licenses = depset(),
+            traces = [],
+        )]
 
     # If this is the target, start the sequence of traces.
     if ctx.attr._trace[TraceInfo].trace and ctx.attr._trace[TraceInfo].trace in str(ctx.label):