• Dirk Pranke's avatar
    Reland "Add a Str() function to gclient for use in DEPS files." · fdd2cd6e
    Dirk Pranke authored
    This relands c7eed83f with a fix to the way variables are
    propagated from parent dependencies into child dependencies.
    
    The original CL description from c7eed83f was:
    > gclient's existing functionality for handling variables is
    > ambiguous: the value of a variable can either be a string literal
    > or an expression fragment. The implementation is required to
    > parse a value as an expression, and, if it is legal, treat it
    > as an expression instead of a literal. This means that
    >
    >   gclient_gn_args_file = 'src/build/args.gni'
    >   gclient_gn_args = ['xcode_version']
    >   vars = {
    >     'xcode_version': 'xcode-12'
    >   }
    >
    > would cause a problem because gclient would try to parse the
    > variable as an expression, and 'xcode' would not be defined.
    >
    > This patch adds a workaround for this, where you can instead
    > use the Str() function to explicitly tell gclient to treat the
    > value as a string and not a potential expression.
    >
    > The above example would be changed to:
    >
    >   gclient_gn_args_file = 'src/build/args.gni'
    >   gclient_gn_args = ['xcode_version']
    >   vars = {
    >     'xcode_version': Str('xcode-12')
    >   }
    >
    > The variable may still be used in every context where it was legal
    > to be used before.
    >
    This reverts commit 84431987dd384c79c84515004d19db67345a1c00.
    
    Bug: 1099242
    TBR=ehmaldonado@chromium.org
    
    Change-Id: I047b871df47c367c1f34a3985e5813504e3c5c6f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2274152
    Commit-Queue: Dirk Pranke <dpranke@google.com>
    Reviewed-by: 's avatarBen Pastene <bpastene@chromium.org>
    fdd2cd6e
gclient_eval.py 31.6 KB