Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: build/split_static_library.gni

Issue 2105513002: Use split_static_library in GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_list
Patch Set: merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 template("split_static_library") {
6 assert(defined(invoker.split_count),
7 "Must define split_count for split_static_library")
8
9 # In many conditions the number of inputs will be 1 (because the count will
10 # be conditional on platform or configuration) so optimize that.
11 if (invoker.split_count == 1) {
12 static_library(target_name) {
13 forward_variables_from(invoker, "*")
14 }
15 } else {
16 group_name = target_name
17
18 generated_static_libraries = []
19 current_library_index = 0
20 foreach(current_sources, split_list(invoker.sources, invoker.split_count)) {
21 current_name = "${target_name}_$current_library_index"
22 assert(
23 current_sources != [],
24 "Your values for splitting a static library generate one that has no s ources.")
25 generated_static_libraries += [ ":$current_name" ]
26
27 static_library(current_name) {
28 # Generated static library shard gets everything but sources (which
29 # we're redefining) and visibility (which is set to be the group
30 # below).
31 forward_variables_from(invoker,
32 "*",
33 [
34 "sources",
35 "visibility",
36 ])
37 sources = current_sources
38 visibility = [ ":$group_name" ]
39 }
40
41 current_library_index = current_library_index + 1
42 }
43
44 group(group_name) {
45 public_deps = generated_static_libraries
46 forward_variables_from(invoker,
47 [
48 "testonly",
49 "visibility",
50 ])
51 }
52 }
53 }
OLDNEW
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698