Commit 73b00094 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Add GN assert for enable_resource_allowlist_generation

Improves error messages for existing asserts, and adds one for
blink_symbol_level=0

Bug: 1126200
Change-Id: I6624f6858ee568a33b5174ab8ba7c1834c1d5f56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401853
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805578}
parent f26536bf
...@@ -20,9 +20,8 @@ if (is_nacl) { ...@@ -20,9 +20,8 @@ if (is_nacl) {
declare_args() { declare_args() {
# Enables whitelist generation for IDR_ grit defines seen by the compiler. # Enables whitelist generation for IDR_ grit defines seen by the compiler.
# Currently works only on some platforms and enabled by default for release # Currently works only on some platforms and enabled by default for official
# builds. # builds. Requires debug info.
# Requires debug info, so disabled for symbol_level=0 & strip_debug_info=true.
enable_resource_allowlist_generation = enable_resource_allowlist_generation =
is_official_build && is_official_build &&
# Don't enable for Android-on-Chrome OS so that they can build with # Don't enable for Android-on-Chrome OS so that they can build with
...@@ -36,6 +35,21 @@ if ((is_linux || is_chromeos) && target_os == "android") { ...@@ -36,6 +35,21 @@ if ((is_linux || is_chromeos) && target_os == "android") {
enable_resource_allowlist_generation = false enable_resource_allowlist_generation = false
} }
# Ensure enable_resource_allowlist_generation is enabled only when it will work.
if (enable_resource_allowlist_generation) {
assert(symbol_level >= 1,
"enable_resource_allowlist_generation=true requires symbol_level >= 1")
assert(
!strip_debug_info,
"enable_resource_allowlist_generation=true requires strip_debug_info=false")
assert(
!is_component_build,
"enable_resource_allowlist_generation=true requires is_component_build=false")
assert(
target_os == "android" || target_os == "win",
"enable_resource_allowlist_generation=true does not work for target_os=$target_os")
}
# This template defines a toolchain for something that works like gcc # This template defines a toolchain for something that works like gcc
# (including clang). # (including clang).
# #
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import("//build/config/compiler/compiler.gni") import("//build/config/compiler/compiler.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//third_party/blink/public/public_features.gni") import("//third_party/blink/public/public_features.gni")
if (is_android) { if (is_android) {
...@@ -82,6 +83,9 @@ if (blink_symbol_level == 2) { ...@@ -82,6 +83,9 @@ if (blink_symbol_level == 2) {
} else if (blink_symbol_level == 1) { } else if (blink_symbol_level == 1) {
blink_symbols_config = [ "//build/config/compiler:minimal_symbols" ] blink_symbols_config = [ "//build/config/compiler:minimal_symbols" ]
} else if (blink_symbol_level == 0) { } else if (blink_symbol_level == 0) {
assert(
!enable_resource_allowlist_generation,
"enable_resource_allowlist_generation=true requires blink_symbol_level >= 1")
blink_symbols_config = [ "//build/config/compiler:no_symbols" ] blink_symbols_config = [ "//build/config/compiler:no_symbols" ]
} else { } else {
blink_symbols_config = [ "//build/config/compiler:default_symbols" ] blink_symbols_config = [ "//build/config/compiler:default_symbols" ]
......
...@@ -91,14 +91,6 @@ import("//build/config/compute_inputs_for_analyze.gni") ...@@ -91,14 +91,6 @@ import("//build/config/compute_inputs_for_analyze.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/toolchain/gcc_toolchain.gni") import("//build/toolchain/gcc_toolchain.gni")
import("//tools/grit/grit_defines.gni") import("//tools/grit/grit_defines.gni")
if (enable_resource_allowlist_generation) {
assert(target_os == "android" || target_os == "win",
"unsupported platform for resource allowlist generation")
assert(
symbol_level > 0 && !strip_debug_info && !is_component_build,
"resource allowlist generation only works on non-component builds with debug info enabled.")
}
_strip_resource_files = is_android && is_official_build _strip_resource_files = is_android && is_official_build
_js_minifier = "//tools/grit/minify_with_uglify.py" _js_minifier = "//tools/grit/minify_with_uglify.py"
_css_minifier = "//tools/grit/minimize_css.py" _css_minifier = "//tools/grit/minimize_css.py"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment