Scrooge gen: Cache resolved scrooge deps

Review Request #3790 — Created April 29, 2016 and submitted

nhoward_tw
pants
3305
pants-reviews
benjyw, jsirois, molsen, patricklaw
The current behavior is that we re-resolve the scrooge dependencies for each thrift target.

This changes scrooge gen so that only the first target created does a resolve and afterwards it is cached.

CI away on PR. Local testing against code gen targets.

  1. 
      
  2. Could @memoized_method or else turn it into a @memoized_property and adjust, but this looks good as it stands.
  3. 
      
  1. 
      
  2. language = self._thrift_defaults.language(target)
    resolved_dep = self._resolved_dep_info()
    if self._includes_a_service(target):
    return resolved_dep.service[language]
    else:
    return resolved_dep.structs[language]

    is easier for my brain to diff the two lines in the if, still unfortunate that structs and service are the same number of chars and both start with s.

  3. I find the any() equiv of this easier to mentally parse. Others may disagree.

  4. 
      
  1. Ship It!
  2. 
      
  1. Ship It!
  2. 
      
Review request changed

Status: Closed (submitted)

Change Summary:

https://github.com/pantsbuild/pants/commit/21abe297e0b16aa5038cc8d57dbc06b74b13c884

Loading...