Skip to content

Chromium resources build fails when nwjs_sdk=false. #145

@llamasoft

Description

@llamasoft

When configured with gn gen "out/nw" '--args=is_debug=false is_component_ffmpeg=true target_cpu="x64" symbol_level=1 is_component_build=false nwjs_sdk=false ffmpeg_branding="Chromium"' (taken directly from this nw44_linux64 buildbot step), building the chrome/browser:resources_grit results in the following error:

/data/nwjs/src$ ninja -C out/nw 'chrome/browser:resources_grit'
ninja: Entering directory `out/nw'
[1/2] ACTION //chrome/browser:resources_grit(//build/toolchain/linux:clang_x64)
FAILED: gen/chrome/resources_stamp.d.stamp gen/chrome/grit/browser_resources.h gen/chrome/browser_resources.pak gen/chrome/browser_resources.pak.info
python ../../tools/grit/grit.py -i ../../chrome/browser/nwjs_resources.grd build -o gen/chrome --depdir . --depfile gen/chrome/resources_stamp.d --write-only-new=1 --depend-on-stamp -D scale_factors=2x -D _chromium -E CHROMIUM_BUILD=chromium -D desktop_linux -D toolkit_views -D use_aura -D use_nss_certs --brotli brotli -D enable_arcore=false -D enable_background_mode=true -D enable_background_contents=true -D enable_extensions=true -D enable_hangout_services_extension=false -D enable_plugins=true -D enable_print_preview=true -D enable_printing=true -D enable_service_discovery=true -D enable_supervised_users=false -D enable_vr=true -D enable_webui_tab_strip=false -D safe_browsing_mode=0 -D optimize_webui=true -E additional_modules_list_file=gen/chrome/browser/internal/additional_modules_list.txt -E root_gen_dir=gen -f ../../tools/gritsettings/resource_ids --assert-file-list=obj/chrome/browser/resources_expected_outputs.txt
Error processing node <?xml version="1.0" encoding="UTF-8"?>
<include allowexternalscript="true" compress="gzip" file="${root_gen_dir}\chrome\browser\resources\discards\graph_tab.html" name="IDR_DISCARDS_GRAPH_TAB_HTML" type="BINDATA" use_base_dir="false" />: [Errno 2] No such file or directory: u'../../out/nw/gen/chrome/browser/resources/discards/graph_tab.html'
Traceback (most recent call last):
  File "../../tools/grit/grit.py", line 23, in <module>
    sys.exit(grit.grit_runner.Main(sys.argv[1:]))
  File "/data/nwjs/src/tools/grit/grit/grit_runner.py", line 310, in Main
    return toolobject.Run(options, args[1:])
  File "/data/nwjs/src/tools/grit/grit/tool/build.py", line 272, in Run
    self.Process()
  File "/data/nwjs/src/tools/grit/grit/tool/build.py", line 404, in Process
    self.ProcessNode(self.res, output, outfile)
  File "/data/nwjs/src/tools/grit/grit/tool/build.py", line 331, in ProcessNode
    formatted = formatter(node, output_node.GetLanguage(), output_dir=base_dir)
  File "/data/nwjs/src/tools/grit/grit/format/data_pack.py", line 88, in Format
    value = node.GetDataPackValue(lang, UTF8)
  File "/data/nwjs/src/tools/grit/grit/node/include.py", line 107, in GetDataPackValue
    data = util.ReadFile(filename, util.BINARY)
  File "/data/nwjs/src/tools/grit/grit/util.py", line 210, in ReadFile
    with open(filename, mode) as f:
IOError: [Errno 2] No such file or directory: u'../../out/nw/gen/chrome/browser/resources/discards/graph_tab.html'
ninja: build stopped: subcommand failed.

This was done from a clean working environment building off of the nw44 branch.
@LeonardLaszlo was encountering a similar grit-related error as well.

The cause seems to be that the nwjs_sdk flag causes a different set of resources to be build. This is taken from chrome/browser/BUILD.gn:

grit("resources") {
  if (nwjs_sdk) {
    source = "browser_resources.grd"
  } else {
    source = "nwjs_resources.grd"
  }

The specific case regarding graph_tab.html seems to stem from the commit updating to Chromium 80.0.3987.0. It removes the graph_tab.html output from chrome/browser/resources/discards/BUILD.gn in favor of graph_tab.js instead.
Again, I think the reason this isn't an issue for nwjs_sdk=true builds is because browser_resources.grd only requires graph_tab.js, but nwjs_resources.grd requires graph_tab.js and graph_tab.html. I haven't done much digging aside from that, but it wouldn't surprise me if other resources are missing as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions