Skip to content

Commit

Permalink
Do not render the coursier workunit unless it will run. (pantsbuild#7218
Browse files Browse the repository at this point in the history
)

### Problem

Currently the `bootstrap-coursier` workunit is rendered repeatedly, although it only actually runs once.

### Solution

Only render the workunit if it will run.
  • Loading branch information
Stu Hood authored Feb 6, 2019
1 parent b2f5a49 commit 121f98c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ def bootstrap_coursier(self, workunit_factory):

bootstrap_jar_path = os.path.join(coursier_bootstrap_dir, 'coursier.jar')

with workunit_factory(name='bootstrap-coursier', labels=[WorkUnitLabel.TOOL]) as workunit:

if not os.path.exists(bootstrap_jar_path):
if not os.path.exists(bootstrap_jar_path):
with workunit_factory(name='bootstrap-coursier', labels=[WorkUnitLabel.TOOL]) as workunit:
with safe_concurrent_creation(bootstrap_jar_path) as temp_path:
fetcher = Fetcher(get_buildroot())
checksummer = fetcher.ChecksumListener(digest=hashlib.sha1())
Expand All @@ -98,4 +97,4 @@ def bootstrap_coursier(self, workunit_factory):
else:
workunit.set_outcome(WorkUnit.SUCCESS)

return bootstrap_jar_path
return bootstrap_jar_path

0 comments on commit 121f98c

Please sign in to comment.