Skip to content

Commit

Permalink
Add is_modular_toolchain where it's needed
Browse files Browse the repository at this point in the history
b/294267479

Fix gn errors caused due to sb_is_modular being imported
before it's defined.

Change-Id: I99d89f67c354252a121ddd7f2e4c95c2f4aa2b2a
  • Loading branch information
niranjanyardi committed Aug 9, 2023
1 parent 9870f3d commit 7ec515d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 1 addition & 2 deletions build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions starboard/build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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") {
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down

0 comments on commit 7ec515d

Please sign in to comment.