Skip to content

Commit

Permalink
Take proper care with the order of operations when replacing tasks.
Browse files Browse the repository at this point in the history
This logic is fragile and should probably be removed entirely.

Testing Done:
Manually verified that this fixes foursquare.web's issues with replacing all tasks in a goal.

ci running.

Reviewed at https://rbcommons.com/s/twitter/r/1221/
  • Loading branch information
benjyw authored and Benjy committed Oct 24, 2014
1 parent 6c3b24f commit 1ea10df
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/python/pants/goal/goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ def install(self, task_registrar, first=False, replace=False, before=None, after
subclass_name = b'{0}_{1}'.format(task_registrar.task_type.__name__,
options_scope.replace('.', '_').replace('-', '_'))
task_type = type(subclass_name, (task_registrar.task_type,), {'options_scope': options_scope})
if replace:
self._task_type_by_name = {}
self._task_type_by_name[task_name] = task_type

otn = self._ordered_task_names
if replace:
for task_type in self.task_types():
task_type.options_scope = None
for tt in self.task_types():
tt.options_scope = None
del otn[:]
self._task_type_by_name = {}
if first:
otn.insert(0, task_name)
elif before in otn:
Expand All @@ -146,6 +144,7 @@ def install(self, task_registrar, first=False, replace=False, before=None, after
else:
otn.append(task_name)

self._task_type_by_name[task_name] = task_type
self.dependencies.update(task_registrar.dependencies)

if task_registrar.serialize:
Expand Down

0 comments on commit 1ea10df

Please sign in to comment.