Skip to content

Commit

Permalink
Changes how to calculate sources and bases in spindle
Browse files Browse the repository at this point in the history
Calculate the source roots for all spindle targets in the graph rather than just the invalid ones.

Testing Done:
All Travis CI tests are green.

Bugs closed: 1603

Reviewed at https://rbcommons.com/s/twitter/r/2282/
  • Loading branch information
Mathew Jennings authored and Patrick Lawson committed Jun 1, 2015
1 parent 1210b1f commit b7aceaa
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from pants.contrib.spindle.targets.spindle_thrift_library import SpindleThriftLibrary


class SpindleGen(NailgunTask):
def __init__(self, context, workdir):
super(SpindleGen, self).__init__(context, workdir)
Expand Down Expand Up @@ -84,7 +83,11 @@ def sources_generated_by_target(self, target):
]

def execute_codegen(self, targets):
bases, sources = self._calculate_sources(targets, lambda t: isinstance(t, SpindleThriftLibrary))
sources = self._calculate_sources(targets, lambda t: isinstance(t, SpindleThriftLibrary))
bases = set(
target.target_base
for target in self.context.targets(lambda t: isinstance(t, SpindleThriftLibrary))
)
scalate_workdir = os.path.join(self.workdir, 'scalate_workdir')
safe_mkdir(self.namespace_out)
safe_mkdir(scalate_workdir)
Expand Down Expand Up @@ -207,16 +210,13 @@ def execute(self):
self.update_artifact_cache(vts_artifactfiles_pairs.items())

def _calculate_sources(self, thrift_targets, target_filter):
bases = set()
sources = set()
def collect_sources(target):
if target_filter(target):
bases.add(target.target_base)
sources.update(target.sources_relative_to_buildroot())

for target in thrift_targets:
target.walk(collect_sources)
return bases, sources
return sources


# Slightly hacky way to figure out which files get generated from a particular thrift source.
Expand Down

0 comments on commit b7aceaa

Please sign in to comment.