• dpranke's avatar
    Modify the gn version of 'mb analyze' to handle GN group targets as well. · 067d014b
    dpranke authored
    Previously, if a group target like 'mandoline:all' was specified as
    an additional_compile_target that we wanted to build, the gn implementation
    of 'analyze' would not handle it correctly (it could only handle dependencies
    on files that existed in the build directory, like executables).
    
    This patch modifies the MB implementation to also handle label-like targets
    (the ninja mandoline:all target is the equivalent of the GN //mandonline:all
    target); we do this by calling 'gn refs' twice, once looking for a list
    of output paths to match against the compile targets and once looking for
    a list of phony labels to match against the compile targets.
    
    We also will match against just the target_name, so 'chrome_shell_apk' will
    also match "//chrome/android:chrome_shell_apk'. This may result in
    too many targets being rebuilt, but we can adjust that if need be.
    
    This is somewhat inefficient, but the alternatives would be to either
    1) force the user to specify the stamp files for a group, which would be
       ugly, or
    2) force the user to specify all the compile targets in terms of GN labels,
       which would be different from how the recipes work w/ GYP and possibly
       require us to map binary names to targets outside of GN, which would
       be a maintenance headache.
    
    R=scottmg@chromium.org,brettw@chromium.org
    BUG=487035
    CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_rel;tryserver.chromium.win:win8_chromium_gn_rel
    
    Review URL: https://codereview.chromium.org/1135743005
    
    Cr-Commit-Position: refs/heads/master@{#329964}
    067d014b
mb.py 20.3 KB