[rust png] Restrict `libpng` visibility to `libwebp:cwebp` exe. The `libwebp` **library** doesn't depend on `libpng`. This CL makes this more explicit, by tweaking visibilities of GN rules that cover `libwebp` and `libpng` libraries. In particular, this CL: * Only allows depending on `libpng` from `libwebp:imagedec`. This consequently disallows depending on `libpng` from other parts of `libwebp` (e.g. from the `libwebp` library). This consequence is the main motivation/goal for this CL. * Only allows depending on `libwebp:imagedec` from `libwebp:cwebp` (the latter is an `executable` target) * Only allows depending on `libwebp:cwebp` from specific directories related to Android builds * Deletes the `libwebp:dwebp` `executable` target (which was not used elsewhere in Chromium). And consequently delete the `libwebp:imageenc` target which was only used from `libwebp:dwebp`. Bug: 443128323 Change-Id: I28dc6553593c6db6e9317d3dd7e828ca093cf3ed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6977689 Reviewed-by: James Zern <jzern@google.com> Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by: Rick Byers <rbyers@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1523731} NOKEYCHECK=True GitOrigin-RevId: 269786b942d89b7695fbb89550fc191d1f2079d4
diff --git a/visibility.gni b/visibility.gni index 00d19fa..b6546f5 100644 --- a/visibility.gni +++ b/visibility.gni
@@ -1,4 +1,5 @@ # This list tracks all current users of libpng. +# # libpng is actively being migrated, and calls to libpng should instead go # through Skia's `SkPngRustDecoder`. No new entries should be added to this # list. @@ -29,10 +30,22 @@ # Other dependency edges that seem like Chrome => ... => libpng dependencies # but really aren't. TODO: Clarify this comment in follow-up CLs. - "//third_party/libwebp:*", "//third_party/weston/*", ] +# Dependencies that do not really flow into Chrome binaries. +visibility += [ + # `build/config/android/*.gni` => + # => `libwebp:cwebp` (`executable`) + # => `libwebp:imagedec` + # => `libpng` dependency. + # The `cwebp` `executable` is used during build process, but depending on it + # does not result in linking the `libpng` library into Chrome binary. See + # also `cwebp_exe_allowed_visibility` in + # `//third_party/libwebp/visibility.gni`. + "//third_party/libwebp:imagedec", +] + # Test/tool-only dependencies under `//third_party/angle` # (migrating these to `libpng_testonly_visibility` would require editing # ANGLE's `BUILD.gn` files to depend on the `libpng_for_testonly` target).