Zachary Anderson f202a1fdce Move libpng to //flutter/third_party/libpng (flutter/engine#50571)
This is an example of moving a dependency to `//flutter/third_party`
that requires forward/aliasing through the secondary build directory.
Without forwarding, and only making changes to the `DEPS` file and
rewriting paths in the engine repo, a `gn` invocation gets the following
error:
```
ERROR at //third_party/freetype2/BUILD.gn:85:5: Can't load input file.
    "//third_party/libpng",
    ^---------------------
Unable to load:
  /Users/zra/flutter/engine/src/third_party/libpng/BUILD.gn
I also checked in the secondary tree for:
  /Users/zra/flutter/engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn
```

Another dependency, with a `BUILD.gn` file outside of the engine repo,
is still referring to `libpng` by the old path. However, `gn` tells us
that it is also checking under the secondary tree. We can put whatever
we want in that `BUILD.gn` file to make `freetype2` happy. In this case
it's easy, we just add a build rule there that forwards to `libpng`'s
new location. There's only one wrinkle, which is that the dependency in
the `group` target has to be `public_deps` rather than a simple `deps`.
This is so that `public_deps` and `public_configs` of
`//flutter/third_party/libpng` are correctly inherited by dependents of
`//third_party/libpng`.
2024-02-13 07:08:45 -08:00
..