• Darren Shen's avatar
    Revert "Centralize externs_list BUILD.gn declarations" · a44133cd
    Darren Shen authored
    This reverts commit 82a1baac.
    
    Reason for revert: Compile error when building all targets locally. Reverting the patch locally fixes it. The error message was:
    
    -------------------------------------------
    [316/344] ACTION //ui/file_manager/file_manager/background/js:media_import_handler_compile(//build/toolchain/linux:clang_x64)
    FAILED: gen/ui/file_manager/file_manager/background/js/media_import_handler_compile.js 
    python ../../third_party/closure_compiler/js_binary.py --compiler ../../third_party/closure_compiler/compiler/compiler.jar --output gen/ui/file_manager/file_manager/background/js/media_import_handler_compile.js --deps gen/ui/file_manager/file_manager/background/js/media_import_handler.js_library --sources --flags extra_annotation_name=attribute extra_annotation_name=demo extra_annotation_name=element extra_annotation_name=group extra_annotation_name=hero extra_annotation_name=homepage extra_annotation_name=status extra_annotation_name=submodule compilation_level=SIMPLE_OPTIMIZATIONS jscomp_error=accessControls jscomp_error=ambiguousFunctionDecl jscomp_error=checkTypes jscomp_error=checkVars jscomp_error=constantProperty jscomp_error=deprecated jscomp_error=externsValidation jscomp_error=globalThis jscomp_error=invalidCasts jscomp_error=missingProperties jscomp_error=missingReturn jscomp_error=nonStandardJsDocs jscomp_error=suspiciousCode jscomp_error=undefinedNames jscomp_error=undefinedVars jscomp_error=unknownDefines jscomp_error=uselessCode jscomp_error=visibility language_in=ECMASCRIPT_2017 language_out=ECMASCRIPT5_STRICT chrome_pass polymer_pass jscomp_off=duplicate --externs ../../third_party/closure_compiler/externs/chrome.js ../../third_party/closure_compiler/externs/polymer-1.0.js
    ../../ui/file_manager/file_manager/common/js/metrics.js:58: ERROR - variable analytics is undeclared
        metrics.analytics_ = analytics.getService('Files app', chromeVersion[1]);
                             ^^^^^^^^^
    
    ../../ui/file_manager/file_manager/common/js/metrics.js:79: ERROR - variable goog is undeclared
      var deferred = new goog.async.Deferred();
                         ^^^^
    
    2 error(s), 0 warning(s)
    ------------------------------------------------------
    
    
    Original change's description:
    > Centralize externs_list BUILD.gn declarations
    > 
    > The externs_list is used by the Closure compiler, to type check imported
    > terms like 'chrome.fileManagerPrivate.foo', and to ensure that when
    > minimizing JS code from 'foo.bar.baz()' to 'a.b.c()', well known names
    > like 'chrome' aren't minimized.
    > 
    > However, the files_manager app does not ship Closure-compiled code in
    > production. It ships uncompiled code - the .js files as written by the
    > programmer. Instead, the externs_list is used indirectly by the
    > js_type_check("closure_compile") rules as a lint-style check.
    > 
    > Prior to this CL, maintaining the externs_list was therefore ad hoc and
    > indirect. For example, the hand-written and hand-maintained BUILD.gn
    > files would contain rules like:
    > 
    > js_library("foo") {
    >   deps = [
    >     "../../common/js:elephant",
    >     "../../common/js:giraffe",
    >   ]
    >   externs_list = [
    >     "../../../externs/apple.js",
    >     "../../../externs/banana.js",
    >   ]
    > }
    > 
    > where foo.js might not refer to externs/apple.js any longer, and it
    > might actually depend on externs/pear.js that is only coincidentally
    > satisfied because common/js/giraffe.js happens to list externs/pear.js
    > on its externs_list. This might be true at any particular point in time,
    > but as new code is added, and as existing code is refactored, the
    > externs_list entries become stale.
    > 
    > After this CL, each js_type_check("closure_compile") target has an
    > associated js_library("closure_compile_externs") BUILD.gn target. This
    > gives exactly one place to list all the external dependencies of every
    > Closure compilation target.
    > 
    > Future commits may re-organize the very fine grained (only 1 .js file
    > per js_library BUILD.gn target) js_library targets into larger units,
    > and in doing so, push duplicated externs_list entries from the leaves of
    > the BUILD.gn dependency tree towards the root. This could arguably help
    > us move towards shipping Closure compiled JS instead of hand-written JS.
    > But the first step is to get a handle on the dependencies (i.e.
    > externs_list entries) in the first place.
    > 
    > Test: "ninja ui/file_manager:closure_compile" runs without error
    > Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
    > Change-Id: I1a3b029b5223db12abd38077d56914ad9d28a396
    > Reviewed-on: https://chromium-review.googlesource.com/1092399
    > Reviewed-by: calamity <calamity@chromium.org>
    > Reviewed-by: Sasha Morrissey <sashab@chromium.org>
    > Commit-Queue: Nigel Tao <nigeltao@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#567072}
    
    TBR=calamity@chromium.org,sashab@chromium.org,nigeltao@chromium.org
    
    Change-Id: Ifd6b7f91e942e9f560a9c2f0ed4f73c087cee60c
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
    Reviewed-on: https://chromium-review.googlesource.com/1100555Reviewed-by: default avatarDarren Shen <shend@chromium.org>
    Commit-Queue: Darren Shen <shend@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#567122}
    a44133cd
BUILD.gn 1.11 KB