GN needs some concept of "friend" for exposing private headers |
|||
Issue descriptionCurrently if you list sources in public, the non-public sources become private. This is useful because you can control what your component's public API is. But doing this also prevents things like tests from including private headers. In practice, attempting to define some headers as private seems to hit this issue very quickly, and private headers are almost unusable in Chrome. I propose a "friend" concept to bypass checks on private headers. I'm thinking it will be like visibility, and the most common annotation would be: friend = [ ":*" ] This would allow unit tests to use whatever headers they want without having to do awkward things with shared targets of only headers, or duplicating lists.
,
Apr 3 2018
,
Apr 5 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/28f3c4987aacf447643a4f36e4553cc830508b0b commit 28f3c4987aacf447643a4f36e4553cc830508b0b Author: Brett Wilson <brettw@chromium.org> Date: Thu Apr 05 01:14:20 2018 Implement "friend" for GN header checking. This allows a target to include private headers it wouldn't otherwise be able to include. A target can provide a list of patterns of friend targets that allow dependent targets to bypass public header checking. A proper dependency path is still required, this applies only to the concept of public/private headers on a target. Without this, it's difficult to make a target be explicit about its public headers while also allowing that target's own tests to use internal headers. BUG= 732993 Change-Id: I1cb94c7ac0db6f74cdcd49d08bcabedf70ea3eb0 Reviewed-on: https://chromium-review.googlesource.com/994453 Commit-Queue: Brett Wilson <brettw@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Cr-Commit-Position: refs/heads/master@{#548279} [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/binary_target_generator.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/binary_target_generator.h [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/functions_target.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/header_checker.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/header_checker.h [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/header_checker_unittest.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/label_pattern.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/label_pattern.h [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/target.h [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/variables.cc [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/variables.h [modify] https://crrev.com/28f3c4987aacf447643a4f36e4553cc830508b0b/tools/gn/visibility.cc
,
Apr 11 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by dtapu...@chromium.org
, Nov 10 2017