From 7ec515d27d61041a3e0bab6d5b5dae2952d4240a Mon Sep 17 00:00:00 2001 From: Niranjan Yardi Date: Tue, 8 Aug 2023 19:56:26 -0700 Subject: [PATCH] Add is_modular_toolchain where it's needed b/294267479 Fix gn errors caused due to sb_is_modular being imported before it's defined. Change-Id: I99d89f67c354252a121ddd7f2e4c95c2f4aa2b2a --- build/toolchain/gcc_toolchain.gni | 3 +-- starboard/build/config/BUILDCONFIG.gn | 5 ++--- starboard/build/config/base_configuration.gni | 6 ++---- .../x64x11/shared/platform_configuration/configuration.gni | 5 +---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index e2b5085dd97c..df9fc11f3358 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -118,7 +118,7 @@ if (enable_resource_allowlist_generation) { template("gcc_toolchain") { toolchain(target_name) { is_starboard_toolchain = target_name == "starboard" - if (!sb_is_modular && sb_is_evergreen) { + if (!sb_is_modular || sb_is_evergreen) { not_needed(["is_starboard_toolchain"]) } assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") @@ -150,7 +150,6 @@ template("gcc_toolchain") { toolchain_args = { # Populate toolchain args from the invoker. forward_variables_from(invoker_toolchain_args, "*") - sb_is_modular = sb_is_modular # The host toolchain value computed by the default toolchain's setup # needs to be passed through unchanged to all secondary toolchains to diff --git a/starboard/build/config/BUILDCONFIG.gn b/starboard/build/config/BUILDCONFIG.gn index 8e773444ce79..12b7d489f045 100644 --- a/starboard/build/config/BUILDCONFIG.gn +++ b/starboard/build/config/BUILDCONFIG.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//starboard/build/config/modular/helper_variables.gni") - _is_python2 = exec_script("//build/util/is_python2.py", [], "json") assert(!_is_python2, "`python` must resolve to Python 3 when building with GN.") @@ -100,7 +98,7 @@ if (target_cpu == "x86" || target_cpu == "arm") { } host_toolchain = "//starboard/build/toolchain/$host_os:$_host_toolchain_cpu" -if (sb_is_modular && !sb_is_evergreen) { +if (is_modular_toolchain) { # TODO(b/294450490): decide a way to set cobalt_toolchain for modular builds for all platforms. # we'll need more conditionals for other platforms. if (host_os == "win") { @@ -118,6 +116,7 @@ import("//starboard/build/config/toolchain_variables.gni") import("//$starboard_path/platform_configuration/configuration.gni") import("//starboard/build/config/build_assertions.gni") +import("//starboard/build/config/modular/helper_variables.gni") declare_args() { use_tsan = getenv("USE_TSAN") == 1 diff --git a/starboard/build/config/base_configuration.gni b/starboard/build/config/base_configuration.gni index 7e2086ce7adb..8e19f4c331e6 100644 --- a/starboard/build/config/base_configuration.gni +++ b/starboard/build/config/base_configuration.gni @@ -15,13 +15,12 @@ import("//cobalt/content/fonts/font_configuration.gni") import("//starboard/build/config/clang.gni") import("//starboard/build/config/enable_vr.gni") -import("//starboard/build/config/modular/helper_variables.gni") # NOTE: # All build arguments in this file must have documentation. # Please follow the formatting in this file when adding new ones. -if (sb_is_modular && !sb_is_evergreen) { +if (is_modular_toolchain) { default_target_type = "shared_library" } else { default_target_type = "executable" @@ -173,8 +172,7 @@ declare_args() { v8_enable_webassembly = false } -if (current_toolchain == starboard_toolchain && - (sb_is_modular && !sb_is_evergreen)) { +if (current_toolchain == starboard_toolchain && is_modular_toolchain) { declare_args() { # Target-specific configurations for executable targets. executable_configs = diff --git a/starboard/linux/x64x11/shared/platform_configuration/configuration.gni b/starboard/linux/x64x11/shared/platform_configuration/configuration.gni index 70fbc6e09974..7155f4ac873b 100644 --- a/starboard/linux/x64x11/shared/platform_configuration/configuration.gni +++ b/starboard/linux/x64x11/shared/platform_configuration/configuration.gni @@ -12,11 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//starboard/build/config/modular/helper_variables.gni") - # TODO(b/294230277): Remove evergreen configs from linux modular builds -if (current_toolchain == default_toolchain && - (sb_is_modular && !sb_is_evergreen)) { +if (current_toolchain == default_toolchain && is_modular_toolchain) { import("//starboard/evergreen/x64/platform_configuration/configuration.gni") platform_tests_path = "//starboard/linux/shared:starboard_platform_tests($starboard_toolchain)"