New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 834415 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

GN friend declarations don't work for Android tests in Chromium

Project Member Reported by davidben@chromium.org, Apr 18 2018

Issue description

We ran into this trying to get gn check working for //third_party/boringssl. Patchset 3 of https://chromium-review.googlesource.com/c/chromium/src/+/1014028/3 should have a repro.

The problem appears to be that the test template on Android places the sources under a separate internal target, so the friend declaration does not match.
https://cs.chromium.org/chromium/src/testing/test.gni?rcl=1f4382b7fc13da2ec7563f7cd5556802d8794355&l=27

Is the expectation that people write down the inner target names too? That seems a bit awkward and abstraction-breaking. I could also imagine taking the test files and splitting them into a source_set that the test target depends on, but that's a bit of boilerplate.

Do GN targets track what template instantiated them? Maybe friend declarations should match those too. Or perhaps there should be a way for :foo_unittests to say "pass on my friend privileges to :foo_unittests__impl". (I don't think forward_variables_from would work because the friend variable is on the library target, not the test target.)
 

Comment 1 by brettw@chromium.org, Apr 18 2018

This has come up for visibility too and it's annoying and difficult to fix.

I would write a wildcard friend rule for the whole directory. Normally the targets in your same dir are trustworthy.
Ah, okay. Maybe worth mentioning on the thread then, since probably just about every friend declaration in Chromium will be a test template.
Project Member

Comment 3 by bugdroid1@chromium.org, Apr 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/145465a79bc9ea86e8b1a00305ae81c71132bbfb

commit 145465a79bc9ea86e8b1a00305ae81c71132bbfb
Author: Steven Valdez <svaldez@chromium.org>
Date: Wed Apr 18 21:54:21 2018

Enable gn checking for BoringSSL.

This sets friend to be a wildcard to allow all third_party/boringssl to
depend on internals.

Bug: 834415
Change-Id: I38c3a923abe57fca2bb86c9c1b30c443aeb7fa0d
Reviewed-on: https://chromium-review.googlesource.com/1017780
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Steven Valdez <svaldez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551839}
[modify] https://crrev.com/145465a79bc9ea86e8b1a00305ae81c71132bbfb/.gn
[modify] https://crrev.com/145465a79bc9ea86e8b1a00305ae81c71132bbfb/third_party/boringssl/BUILD.gn

Sign in to add a comment