Skip to content

Commit a73275f

Browse files
targosrichardlau
authored andcommitted
deps: V8: cherry-pick 7b3332844212
Original commit message: [build] Move split_static_library.gni from Chromium repo We'll remove the file from Chromium in a follow up after V8 has rolled + 2 days. Bug: v8:9911 Change-Id: I69fe56855f1ba83bec0d39e0fb6acb7e4182c6b7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1897826 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#64742} Refs: v8/v8@7b33328 PR-URL: #39245 Refs: nodejs/build#2696 Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 492b0d6 commit a73275f

File tree

3 files changed

+80
-2
lines changed

3 files changed

+80
-2
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Reset this number to 0 on major V8 upgrades.
3636
# Increment by one for each non-official patch applied to deps/v8.
37-
'v8_embedder_string': '-node.50',
37+
'v8_embedder_string': '-node.51',
3838

3939
##### V8 defaults for Node.js #####
4040

deps/v8/gni/split_static_library.gni

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright 2019 the V8 project authors. All rights reserved.
2+
# Copyright 2016 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
import("//build/config/compiler/compiler.gni")
7+
8+
template("split_static_library") {
9+
assert(defined(invoker.split_count),
10+
"Must define split_count for split_static_library")
11+
12+
# In many conditions the number of inputs will be 1 (because the
13+
# count will be conditional on platform or configuration) and for
14+
# some build configurations it's unnecessary to split libraries
15+
# since the tooling will never create files of a problematic size.
16+
if (invoker.split_count == 1 || use_lld) {
17+
static_library(target_name) {
18+
forward_variables_from(invoker, "*")
19+
}
20+
} else {
21+
group_name = target_name
22+
23+
generated_static_libraries = []
24+
current_library_index = 0
25+
foreach(current_sources, split_list(invoker.sources, invoker.split_count)) {
26+
current_name = "${target_name}_$current_library_index"
27+
assert(
28+
current_sources != [],
29+
"Your values for splitting a static library generate one that has no sources.")
30+
generated_static_libraries += [ ":$current_name" ]
31+
32+
static_library(current_name) {
33+
# Generated static library shard gets everything but sources (which
34+
# we're redefining) and visibility (which is set to be the group
35+
# below).
36+
forward_variables_from(invoker,
37+
"*",
38+
[
39+
"check_includes",
40+
"sources",
41+
"visibility",
42+
])
43+
sources = current_sources
44+
visibility = [ ":$group_name" ]
45+
46+
# When splitting a target's sources up into a series of static
47+
# libraries, those targets will naturally include headers from each
48+
# other arbitrarily. We could theoretically generate a web of
49+
# dependencies and allow_circular_includes_from between all pairs of
50+
# targets, but that's very cumbersome. Typical usage in Chrome is that
51+
# only official Windows builds use split static libraries due to the
52+
# Visual Studio size limits, and this means we'll still get header
53+
# checking coverage for the other configurations.
54+
check_includes = false
55+
56+
# Uniquify the output name if one is specified.
57+
if (defined(invoker.output_name)) {
58+
output_name = "${invoker.output_name}_$current_library_index"
59+
}
60+
}
61+
62+
current_library_index = current_library_index + 1
63+
}
64+
65+
group(group_name) {
66+
public_deps = generated_static_libraries
67+
forward_variables_from(invoker,
68+
[
69+
"testonly",
70+
"visibility",
71+
])
72+
}
73+
}
74+
}
75+
76+
set_defaults("split_static_library") {
77+
configs = default_compiler_configs
78+
}

deps/v8/gni/v8.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import("//build/config/sanitizers/sanitizers.gni")
66
import("//build/config/v8_target_cpu.gni")
7-
import("//build/split_static_library.gni")
7+
import("split_static_library.gni")
88

99
declare_args() {
1010
# Set flags for tracking code coverage. Uses gcov with gcc and sanitizer

0 commit comments

Comments
 (0)