Proposal: Add public_inputs variable to action target

3 views
Skip to first unread message

Takuto Ikuta (生田 拓人)

unread,
3:42 AM (3 hours ago) 3:42 AM
to gn-dev, Junji Watanabe, Matt Stark, David Turner
Hi,

Currently, I'm working to improve the correctness of the input specification for build targets in Chromium. And I sometimes want to propagate inputs from action targets to dependent targets.
e.g. imported proto files for protobuf compilation, or imported TS files for TypeScript compilation

But if we want to propagate inputs in an action to dependent targets, we need to use config with public_configs like
```
config("A_input") {
  inputs = [ "A.proto" ]
}

action("A") {
  script = "run_protoc.py"
  args = [...]
  public_configs = [ ":A_input" ] # This adds A.proto as inputs for this action.
}

action("B") {
  script = "run_protoc.py"
  args = [ ... ]
  inputs = [ "B.proto" ] # This imports A.proto
  deps = [ ":A" ] # A's public_configs propagate A.proto as inputs for B.
}
```

To simplify such configs, I'd like to introduce public_inputs variable for action target and write the above action like
```
action("A") {
  script = "run_protoc.py"
  args = [...]
  public_inputs = [ "A.proto" ]
}

action("B") {
  script = "run_protoc.py"
  args = [ ... ]
  inputs = [ "B.proto" ] # This imports A.proto
  deps = [ ":A" ] # A's public_inputs propagate A.proto as inputs for B.
}
```

I choose `public_` prefix as this also mathces with public variable for C/C++'s public header variable in source_set/shared_library/executable target.

With this feature, we can simplify some existing configs using both config and public_configs in chromium.


Let me know if you have any concerns or alternative designs to support this.

Thanks,
Takuto
--
Takuto Ikuta
Software Engineer in Tokyo
Chrome Ops (chrome browser build team)

David Turner

unread,
5:59 AM (1 hour ago) 5:59 AM
to Takuto Ikuta (生田 拓人), gn-dev, Junji Watanabe, Matt Stark
Thanks for starting this thread.

This feature makes sense, and will be useful for everything that generates source core (our source-like artifacts). I've approved it with review comments :)


Reply all
Reply to author
Forward
0 new messages