Skip to content
  • scottmg's avatar
    gn format //build · b199254f
    scottmg authored
    A starting point for doing all of src, and adding a PRESUBMIT.
    
    Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
    I haven't pushed new binaries yet.
    
    Generated via:
    > cd build
    > git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
    
    The only things that I don't love in the current output are:
    
    1. Turning
    
        args = [
          "--depfile", rebase_path(depfile, root_build_dir),
          "--android-sdk-tools", rebased_android_sdk_build_tools,
          "--dex-path", rebased_output,
        ]
    
    into:
    
        args = [
          "--depfile",
          rebase_path(depfile, root_build_dir),
          "--android-sdk-tools",
          rebased_android_sdk_build_tools,
          "--dex-path",
          rebased_output,
        ]
    
    The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
    as assignments to temporaries that are later assigned to args.
    
    2. Turning single line
    
        if (defined(invoker.inputs)) { inputs = invoker.inputs }
    
    into
    
        if (defined(invoker.inputs)) {
          inputs = invoker.inputs
        }
    
    This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
    allow single line in this case is worthwhile. I think there was discussion of new syntax for this
    case too, something like "inputs ?= invoker.inputs" maybe.
    
    In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
    case these if we decide it's worthwhile.
    
    R=brettw@chromium.org
    BUG=348474
    
    Review URL: https://codereview.chromium.org/766573003
    
    Cr-Commit-Position: refs/heads/master@{#306305}
    b199254f