From ab397ddec4aefe0998afb2a1cad776c872b993e9 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Fri, 16 Dec 2022 11:08:01 +0100 Subject: [PATCH] Update WebRTC style guide about GN. No-Try: True Bug: None Change-Id: Iaee25f35eba70d05c0bd2abd1a578db44414ede9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288363 Reviewed-by: Harald Alvestrand Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#38907} --- g3doc/style-guide.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/g3doc/style-guide.md b/g3doc/style-guide.md index 44c752173b..fa0d3e6a78 100644 --- a/g3doc/style-guide.md +++ b/g3doc/style-guide.md @@ -222,16 +222,27 @@ guide. ### WebRTC-specific GN templates -Use the following [GN templates][gn-templ] to ensure that all our -[GN targets][gn-target] are built with the same configuration: +As shown in the table below, for library targets (`source_set` and +`static_library`), you should default on using `rtc_library` (which abstracts +away the complexity of using the correct target type for Chromium component +builds). -| instead of | use | -|------------------|----------------------| -| `executable` | `rtc_executable` | -| `shared_library` | `rtc_shared_library` | -| `source_set` | `rtc_source_set` | -| `static_library` | `rtc_static_library` | -| `test` | `rtc_test` | +The general rule is for library targets is: +1. Use `rtc_library`. +2. If the library is a header only target use `rtc_source_set`. +3. If you really need to generate a static library, use `rtc_static_library` + (same for shared libraries, in such case use `rtc_shared_library`). + +To ensure that all our [GN targets][gn-target] are built with the same +configuration, only use the following [GN templates][gn-templ]. + +| instead of | use | +|------------------|-----------------------------------------------------------------------------------------| +| `executable` | `rtc_executable` | +| `shared_library` | `rtc_shared_library` | +| `source_set` | `rtc_source_set` (only for header only libraries, for everything else use `rtc_library` | +| `static_library` | `rtc_static_library` (use `rtc_library` unless you really need `rtc_static_library` | +| `test` | `rtc_test` | [gn-templ]: https://gn.googlesource.com/gn/+/HEAD/docs/language.md#Templates