Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Snapshot determinism #4614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/python/pants/engine/legacy/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ def _eager_fileset_with_spec(spec_path, filespec, snapshot):
relpath_adjusted_filespec['exclude'] = [FilesetRelPathWrapper.to_filespec(e['globs'], spec_path)
for e in filespec['exclude']]

# NB: In order to preserve declared ordering, we record a list of matched files
# independent of the file hash dict.
return EagerFilesetWithSpec(spec_path,
relpath_adjusted_filespec,
files=files,
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/engine/subsystem/native_engine_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d73c4576f61ddf0cbeb57e07122adb17ef09b3bd
af2e5b09cb7eee743c8d4e065258ac046c8a19ac
8 changes: 4 additions & 4 deletions src/rust/engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/rust/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ignore = "0.1.8"
lazy_static = "0.2.2"
ordermap = "0.2.8"
petgraph = "0.4.4"
# TODO: Waiting for a 0.4.11 release: https://github.com/alexcrichton/tar-rs/pull/99
tar = { git = "https://github.com/alexcrichton/tar-rs", branch = "master" }
# TODO: See https://github.com/alexcrichton/tar-rs/pull/107.
tar = { git = "https://github.com/stuhood/tar-rs", rev = "893a96e89c84f44f60f0e2398d27ae3267d196f8" }
tempdir = "0.3.5"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
target(
dependencies=[
'testprojects/src/resources/org/pantsbuild/testproject/ordering'
'testprojects/src/resources/org/pantsbuild/testproject/ordering:literal'
],
description='''This target exists at path {}.'''.format(buildfile_path()),
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
SOURCES=['p', 'a', 'n', 't', 's', 'b', 'u', 'i', 'l', 'd', 'p', 'a', 'n', 't', 's']

resources(
sources=['p', 'a', 'n', 't', 's', 'b', 'u', 'i', 'l', 'd', 'p', 'a', 'n', 't', 's'],
name='literal',
sources=SOURCES,
)

resources(
name='globs',
sources=globs(*SOURCES),
)
13 changes: 9 additions & 4 deletions tests/python/pants_test/engine/legacy/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,18 @@ def test_invalidate_fsnode_incremental(self):
node_count, last_node_count = scheduler.node_count(), node_count
self.assertLess(node_count, last_node_count)

def test_sources_ordering(self):
spec = 'testprojects/src/resources/org/pantsbuild/testproject/ordering'
def _ordering_test(self, spec, expected_sources=None):
expected_sources = expected_sources or ['p', 'a', 'n', 't', 's', 'b', 'u', 'i', 'l', 'd']
with self.open_scheduler([spec]) as (graph, _, _):
target = graph.get_target(Address.parse(spec))
sources = [os.path.basename(s) for s in target.sources_relative_to_buildroot()]
self.assertEquals(['p', 'a', 'n', 't', 's', 'b', 'u', 'i', 'l', 'd'],
sources)
self.assertEquals(expected_sources, sources)

def test_sources_ordering_literal(self):
self._ordering_test('testprojects/src/resources/org/pantsbuild/testproject/ordering:literal')

def test_sources_ordering_glob(self):
self._ordering_test('testprojects/src/resources/org/pantsbuild/testproject/ordering:globs')

def test_target_macro_override(self):
"""Tests that we can "wrap" an existing target type with additional functionality.
Expand Down