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

Issue 624564 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit 26 days ago
Closed: Jul 2016
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

GN target function doesn't apply target defaults

Project Member Reported by brettw@chromium.org, Jun 29 2016

Issue description

This:
  target("static_library", "foo") { ... }
Should be the same as:
  static_library("foo") { ... }
But currently target() doesn't apply the defaults based on the first parameter. This limits the usefulness of target() to cases where there is a set_defaults (basically just component).
 

Comment 1 by brettw@chromium.org, Jul 13 2016

Turns out calling
  target("foo", "bar")
where "foo" is a template is applying the defaults for the function named "target" (since this is the function call) rather than "foo".

This works properly when "foo" is not a template.
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 14 2016

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

commit af92718f5526ce94ea8fcb4118f850fb9a7517b3
Author: brettw <brettw@chromium.org>
Date: Thu Jul 14 19:43:53 2016

GN: Use the correct defaults for templates invoked via target().

Previously calling
  target("foo", "bar")
where "foo" is a template applied the defaults for the function named "target"
(since this is the function call) rather than "foo".

This change properly applies the defaults for "foo" in this case.

BUG= 624564 

Review-Url: https://codereview.chromium.org/2148093002
Cr-Commit-Position: refs/heads/master@{#405547}

[modify] https://crrev.com/af92718f5526ce94ea8fcb4118f850fb9a7517b3/tools/gn/functions.cc
[modify] https://crrev.com/af92718f5526ce94ea8fcb4118f850fb9a7517b3/tools/gn/functions_target.cc
[modify] https://crrev.com/af92718f5526ce94ea8fcb4118f850fb9a7517b3/tools/gn/functions_target_unittest.cc
[modify] https://crrev.com/af92718f5526ce94ea8fcb4118f850fb9a7517b3/tools/gn/template.cc
[modify] https://crrev.com/af92718f5526ce94ea8fcb4118f850fb9a7517b3/tools/gn/template.h

Comment 3 by brettw@chromium.org, Jul 14 2016

Status: Fixed (was: Started)

Sign in to add a comment