Skip to content

Commit

Permalink
coerce the provides key when fingerprinting targets
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Oct 14, 2019
1 parent b0395e2 commit ee31108
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/python/pants/engine/legacy/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def _coerce_key_values(self, key, value):
return (key, tuple(
str(req) for req in value
))
if key == 'provides':
return (key, repr(value))
return (key, value)

def get_sources(self):
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/rules/core/list_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def print_documented(target):
print_fn = print_documented
else:
assert with_fingerprints
# To get fingerprints of each target and its dependencies, we need transitive hydrated
# targets.
# To get fingerprints of each target and its dependencies, we have to request that information
# specifically.
collection = yield Get(FingerprintedTargetCollection, Specs, specs)

def print_fingerprinted(fingerprinted_target):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import json
import os
from textwrap import dedent

Expand Down Expand Up @@ -178,3 +179,11 @@ def test_list_documented(self):
' Further description.',
args=['--documented', '::'],
)

def test_list_with_fingerprints(self):
self.assert_console_output_ordered(
json.dumps({"was_root": True, "address": "f:alias", "intransitive": "77e220c58aa54b51c7321115b21cd6e4781939b4", "transitive": "2ecd51bf9eb89dd7fb50e0563015f46a40df798f"}),
json.dumps({"was_root": False, "address": "a/b/c:c3", "intransitive": "2e36109fb3a97737513744edc85c03d8b7845e8f", "transitive": "97d170e1550eee4afc0af065b78cda302a97674c"}),
json.dumps({"was_root": False, "address": "a/b/d:d", "intransitive": "eb212be02154e79f8936fce7e9a6f31d0ddd39ff", "transitive": "97d170e1550eee4afc0af065b78cda302a97674c"}),
args=['--with-fingerprints', 'f:alias'],
)

0 comments on commit ee31108

Please sign in to comment.