summaryrefslogtreecommitdiffstats
path: root/build/config
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 19:31:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 19:31:36 +0000
commitafb30e39c6791afed6cd12f085649400e4d80ae8 (patch)
treed70c0df0f227870789f6c5e9fdcb4e06de926f80 /build/config
parentdb7cb05b956953a7868d6c4e359ead2f644965eb (diff)
downloadchromium_src-afb30e39c6791afed6cd12f085649400e4d80ae8.zip
chromium_src-afb30e39c6791afed6cd12f085649400e4d80ae8.tar.gz
chromium_src-afb30e39c6791afed6cd12f085649400e4d80ae8.tar.bz2
Support private values in GN.
This adds special handling for variables that begin with underscores, which is inspired by Dart. Such variables are not imported when doing an import, which gives .gni files a way to have intermediate private variables that won't pollute the scopes of the files that include them. This also applies to the root build config, which can have private values now. Adds some missing unused variable checks. This was disabled because processing imports would mean all imported variables were unused, and files not using all of them would get unused variable errors. This adds the option to mark merged values on a scope as used, which is used for imported values. BUG=341738 R=cjhopman@chromium.org Review URL: https://codereview.chromium.org/287693002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/config')
-rw-r--r--build/config/BUILDCONFIG.gn207
1 files changed, 96 insertions, 111 deletions
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index d4d585a..c1146b7 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -180,10 +180,6 @@ if (is_win) {
# to each assignment or appending to the sources variable and matches are
# automatcally removed.
#
-# We define lists of filters for each platform for all builds so they can
-# be used by individual targets if necessary (a target can always change
-# sources_assignment_filter on itself if it needs something more specific).
-#
# Note that the patterns are NOT regular expressions. Only "*" and "\b" (path
# boundary = end of string or slash) are supported, and the entire string
# muct match the pattern (so you need "*.cc" to match all .cc files, for
@@ -191,102 +187,91 @@ if (is_win) {
# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
# below.
-windows_sources_filters = [
- "*_win.cc",
- "*_win.h",
- "*_win_unittest.cc",
- "*\bwin/*",
- "*.rc",
-]
-mac_sources_filters = [
- "*_mac.h",
- "*_mac.cc",
- "*_mac.mm",
- "*_mac_unittest.h",
- "*_mac_unittest.cc",
- "*_mac_unittest.mm",
- "*\bmac/*",
- "*_cocoa.h",
- "*_cocoa.cc",
- "*_cocoa.mm",
- "*_cocoa_unittest.h",
- "*_cocoa_unittest.cc",
- "*_cocoa_unittest.mm",
- "*\bcocoa/*",
-]
-ios_sources_filters = [
- "*_ios.h",
- "*_ios.cc",
- "*_ios.mm",
- "*_ios_unittest.h",
- "*_ios_unittest.cc",
- "*_ios_unittest.mm",
- "*\bios/*",
-]
-objective_c_sources_filters = [
- "*.mm",
-]
-linux_sources_filters = [
- "*_linux.h",
- "*_linux.cc",
- "*_linux_unittest.h",
- "*_linux_unittest.cc",
- "*\blinux/*",
-]
-android_sources_filters = [
- "*_android.h",
- "*_android.cc",
- "*_android_unittest.h",
- "*_android_unittest.cc",
- "*\bandroid/*",
-]
-posix_sources_filters = [
- "*_posix.h",
- "*_posix.cc",
- "*_posix_unittest.h",
- "*_posix_unittest.cc",
- "*\bposix/*",
-]
-chromeos_sources_filters = [
- "*_chromeos.h",
- "*_chromeos.cc",
- "*_chromeos_unittest.h",
- "*_chromeos_unittest.cc",
- "*\bchromeos/*",
-]
-# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
-# below.
-
-# Construct the full list of sources we're using for this platform.
sources_assignment_filter = []
-if (is_win) {
- sources_assignment_filter += posix_sources_filters
-} else {
- sources_assignment_filter += windows_sources_filters
+if (!is_posix) {
+ sources_assignment_filter += [
+ "*_posix.h",
+ "*_posix.cc",
+ "*_posix_unittest.h",
+ "*_posix_unittest.cc",
+ "*\bposix/*",
+ ]
+}
+if (!is_win) {
+ sources_assignment_filter += [
+ "*_win.cc",
+ "*_win.h",
+ "*_win_unittest.cc",
+ "*\bwin/*",
+ "*.rc",
+ ]
}
if (!is_mac) {
- sources_assignment_filter += mac_sources_filters
+ sources_assignment_filter += [
+ "*_mac.h",
+ "*_mac.cc",
+ "*_mac.mm",
+ "*_mac_unittest.h",
+ "*_mac_unittest.cc",
+ "*_mac_unittest.mm",
+ "*\bmac/*",
+ "*_cocoa.h",
+ "*_cocoa.cc",
+ "*_cocoa.mm",
+ "*_cocoa_unittest.h",
+ "*_cocoa_unittest.cc",
+ "*_cocoa_unittest.mm",
+ "*\bcocoa/*",
+ ]
}
if (!is_ios) {
- sources_assignment_filter += ios_sources_filters
+ sources_assignment_filter += [
+ "*_ios.h",
+ "*_ios.cc",
+ "*_ios.mm",
+ "*_ios_unittest.h",
+ "*_ios_unittest.cc",
+ "*_ios_unittest.mm",
+ "*\bios/*",
+ ]
}
if (!is_mac && !is_ios) {
- sources_assignment_filter += objective_c_sources_filters
+ sources_assignment_filter += [
+ "*.mm",
+ ]
}
if (!is_linux) {
- sources_assignment_filter += linux_sources_filters
+ sources_assignment_filter += [
+ "*_linux.h",
+ "*_linux.cc",
+ "*_linux_unittest.h",
+ "*_linux_unittest.cc",
+ "*\blinux/*",
+ ]
}
if (!is_android) {
- sources_assignment_filter += android_sources_filters
+ sources_assignment_filter += [
+ "*_android.h",
+ "*_android.cc",
+ "*_android_unittest.h",
+ "*_android_unittest.cc",
+ "*\bandroid/*",
+ ]
}
if (!is_chromeos) {
- sources_assignment_filter += chromeos_sources_filters
+ sources_assignment_filter += [
+ "*_chromeos.h",
+ "*_chromeos.cc",
+ "*_chromeos_unittest.h",
+ "*_chromeos_unittest.cc",
+ "*\bchromeos/*",
+ ]
}
+# DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
+# below.
# Actually save this list.
#
-# DO NOT ADD MORE PATTERNS TO THIS LIST.
-#
# These patterns are executed for every file in the source tree of every run.
# Therefore, adding more patterns slows down the build for everybody. We should
# only add automatic patterns for configurations affecting hundreds of files
@@ -326,7 +311,7 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
# Holds all configs used for making native executables and libraries, to avoid
# duplication in each target below.
-native_compiler_configs = [
+_native_compiler_configs = [
"//build/config:feature_flags",
"//build/config/compiler:compiler",
@@ -336,25 +321,25 @@ native_compiler_configs = [
"//build/config/compiler:runtime_library",
]
if (is_win) {
- native_compiler_configs += [
+ _native_compiler_configs += [
"//build/config/win:lean_and_mean",
"//build/config/win:sdk",
"//build/config/win:unicode",
]
} else if (is_linux) {
- native_compiler_configs += [ "//build/config/linux:sdk", ]
+ _native_compiler_configs += [ "//build/config/linux:sdk", ]
} else if (is_mac) {
- native_compiler_configs += [ "//build/config/mac:sdk", ]
+ _native_compiler_configs += [ "//build/config/mac:sdk", ]
} else if (is_ios) {
- native_compiler_configs += [ "//build/config/ios:sdk", ]
+ _native_compiler_configs += [ "//build/config/ios:sdk", ]
} else if (is_android) {
- native_compiler_configs += [ "//build/config/android:sdk", ]
+ _native_compiler_configs += [ "//build/config/android:sdk", ]
}
if (!is_win) {
- native_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
+ _native_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
}
if (is_clang) {
- native_compiler_configs += [
+ _native_compiler_configs += [
"//build/config/clang:find_bad_constructs",
"//build/config/clang:extra_warnings",
]
@@ -362,13 +347,13 @@ if (is_clang) {
# Optimizations and debug checking.
if (is_debug) {
- native_compiler_configs += [ "//build/config:debug" ]
- default_optimization_config = "//build/config/compiler:no_optimize"
+ _native_compiler_configs += [ "//build/config:debug" ]
+ _default_optimization_config = "//build/config/compiler:no_optimize"
} else {
- native_compiler_configs += [ "//build/config:release" ]
- default_optimization_config = "//build/config/compiler:optimize"
+ _native_compiler_configs += [ "//build/config:release" ]
+ _default_optimization_config = "//build/config/compiler:optimize"
}
-native_compiler_configs += [ default_optimization_config ]
+_native_compiler_configs += [ _default_optimization_config ]
# Symbol setup.
if (is_clang && (is_linux || is_android)) {
@@ -376,29 +361,29 @@ if (is_clang && (is_linux || is_android)) {
# For now, don't create debug information with clang.
# See http://crbug.com/70000
# TODO(brettw) This just copies GYP. Why not do this on Mac as well?
- default_symbols_config = "//build/config/compiler:no_symbols"
+ _default_symbols_config = "//build/config/compiler:no_symbols"
} else if (symbol_level == 2) {
- default_symbols_config = "//build/config/compiler:symbols"
+ _default_symbols_config = "//build/config/compiler:symbols"
} else if (symbol_level == 1) {
- default_symbols_config = "//build/config/compiler:minimal_symbols"
+ _default_symbols_config = "//build/config/compiler:minimal_symbols"
} else if (symbol_level == 0) {
- default_symbols_config = "//build/config/compiler:no_symbols"
+ _default_symbols_config = "//build/config/compiler:no_symbols"
} else {
assert(false, "Bad value for symbol_level.")
}
-native_compiler_configs += [ default_symbols_config ]
+_native_compiler_configs += [ _default_symbols_config ]
# Windows linker setup for EXEs and DLLs.
if (is_win) {
if (is_debug) {
- default_incremental_linking_config =
+ _default_incremental_linking_config =
"//build/config/win:incremental_linking"
} else {
- default_incremental_linking_config =
+ _default_incremental_linking_config =
"//build/config/win:no_incremental_linking"
}
- windows_linker_configs = [
- default_incremental_linking_config,
+ _windows_linker_configs = [
+ _default_incremental_linking_config,
"//build/config/win:sdk_link",
"//build/config/win:common_linker_setup",
# Default to console-mode apps. Most of our targets are tests and such
@@ -408,11 +393,11 @@ if (is_win) {
}
set_defaults("executable") {
- configs = native_compiler_configs + [
+ configs = _native_compiler_configs + [
"//build/config:default_libs",
]
if (is_win) {
- configs += windows_linker_configs
+ configs += _windows_linker_configs
} else if (is_mac) {
configs += [
"//build/config/mac:mac_dynamic_flags",
@@ -423,22 +408,22 @@ set_defaults("executable") {
}
set_defaults("static_library") {
- configs = native_compiler_configs
+ configs = _native_compiler_configs
}
set_defaults("shared_library") {
- configs = native_compiler_configs + [
+ configs = _native_compiler_configs + [
"//build/config:default_libs",
]
if (is_win) {
- configs += windows_linker_configs
+ configs += _windows_linker_configs
} else if (is_mac) {
configs += [ "//build/config/mac:mac_dynamic_flags" ]
}
}
set_defaults("source_set") {
- configs = native_compiler_configs
+ configs = _native_compiler_configs
}
# ==============================================================================