Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set sb_is_modular appropriately for modular builds #1181

Closed

Conversation

niranjanyardi
Copy link
Contributor

@niranjanyardi niranjanyardi commented Aug 7, 2023

b/294267479
b/294230277

Modular builds are of 2 types:

  1. evergreen
  2. cobalt toolchain with platform native linker builds

This change consolidates the build system to have mostly 2 flags for modular builds - sb_is_modular, sb_is_evergreen

  1. sb_is_modular : Includes common GN flags and variables related to modular and evergreen GN configurations.
  2. sb_is_evergreen: Includes only evergreen-specific GN flags and variables
  3. build_with_separate_cobalt_toolchain: Passed as a command line GN arg for cobalt toolchain with platform native linker builds : This flag is used very minimally in the GN code as most of the changes are governed by combinations of sb_is_modular , sb_is_evergreen

Set sb_is_modular = build_with_separate_cobalt_toolchain || sb_is_evergreen
in starboard/build/config/modular/helper_variables.gni.

Change-Id: Ie1e38b2e0487d01960db9a975899f9760bc78415

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #1181 (953faab) into main (0e3e107) will increase coverage by 0.04%.
Report is 3 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1181      +/-   ##
==========================================
+ Coverage   56.53%   56.57%   +0.04%     
==========================================
  Files        1899     1900       +1     
  Lines       94300    94334      +34     
==========================================
+ Hits        53308    53365      +57     
+ Misses      40992    40969      -23     

see 18 files with indirect coverage changes

@niranjanyardi niranjanyardi marked this pull request as draft August 8, 2023 13:41
@niranjanyardi niranjanyardi changed the title Intoduce is_modular_toolchain flag for modular builds Set sb_is_modular appropriately for modular and evergreen builds Aug 9, 2023
@niranjanyardi niranjanyardi marked this pull request as ready for review August 9, 2023 00:10
Copy link
Contributor

@y4vor y4vor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did 1st pass.

build/toolchain/gcc_toolchain.gni Outdated Show resolved Hide resolved
cobalt/BUILD.gn Outdated Show resolved Hide resolved
components/update_client/BUILD.gn Outdated Show resolved Hide resolved
starboard/BUILD.gn Outdated Show resolved Hide resolved
starboard/BUILD.gn Outdated Show resolved Hide resolved
@niranjanyardi niranjanyardi force-pushed the use_modular_toolchain branch 5 times, most recently from f98b85c to 7ec515d Compare August 9, 2023 06:06
base/BUILD.gn Outdated Show resolved Hide resolved
@@ -149,7 +150,6 @@ template("gcc_toolchain") {
toolchain_args = {
# Populate toolchain args from the invoker.
forward_variables_from(invoker_toolchain_args, "*")
build_with_separate_cobalt_toolchain = build_with_separate_cobalt_toolchain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You instead should be passing through is_modular_toolchain to propagate it to other toolchains

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the toolchain need the argument if we have a global variable to indicate we are building modular?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable is only global to the toolchain, it doesn't propagate to the other toolchains unless passed to them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont understand, GN normally complains if the variable is not needed/ not set . None of he tests fail in the GN step because of this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GN normally complains if the variable is not needed/ not set

The variable is needed and is set, it's just a question of what it's set to. It works now as (I believe) it is implicitly passing the variable from the outer scope to the scope captured by toolchain_args—so it is set correctly, but brittle and it's better to be explicit about passing the same value through

See https://gn.googlesource.com/gn/+/master/docs/reference.md#toolchain-overview for more info

build/toolchain/gcc_toolchain.gni Show resolved Hide resolved
@@ -79,10 +81,8 @@ group("default") {
"//components/crx_file",
"//components/prefs",
"//components/update_client",
"//third_party/llvm-project/libunwind:unwind_evergreen",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't directly part of this PR, but this if block should not be nested in this if (sb_is_modular) block, it should be its own conditional (for cleanliness)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you are maybe fighting the agreement that evergreen builds are modular.
I think this should remain here, otherwise it looks out of place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@y4vor thoughts ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not—it would just clean up the code to unnest this. sb_is_modular && sb_is_evergreen is just equivalent to sb_is_evergreen

components/update_client/BUILD.gn Outdated Show resolved Hide resolved
starboard/build/config/BUILDCONFIG.gn Show resolved Hide resolved
@niranjanyardi niranjanyardi marked this pull request as draft August 9, 2023 17:12
@niranjanyardi niranjanyardi force-pushed the use_modular_toolchain branch 3 times, most recently from ec7b9ee to 914a5bd Compare August 10, 2023 01:01
@niranjanyardi niranjanyardi changed the title Set sb_is_modular appropriately for modular and evergreen builds Set sb_is_modular appropriately for modular builds Aug 10, 2023
@niranjanyardi niranjanyardi force-pushed the use_modular_toolchain branch 2 times, most recently from c15bb40 to 7d8e74a Compare August 10, 2023 01:10
@niranjanyardi niranjanyardi marked this pull request as ready for review August 10, 2023 01:19
b/294267479

Set sb_is_modular = is_modular_toolchain || sb_is_evergreen in
starboard/build/config/modular/helper_variables.gni.

Replace instances of build_with_separate_cobalt_toolchain  with sb_is_modular, sb_is_evergreen.
In certain places during starboard/build/config/BUILDCONFIG.gn
build_with_separate_cobalt_toolchain cannot be replaced with sb_is_modular, sb_is_evergreen

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

Change-Id: I99d89f67c354252a121ddd7f2e4c95c2f4aa2b2a
b/294230277

Change-Id: I00c3832e12f8bd012a34ec9b962e70e82cc85f99
@niranjanyardi
Copy link
Contributor Author

Got resolved and merged in 2 separate PR's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants