def test_unpack_aar_files_and_invalidation(self):
with temporary_dir() as temp:
aar = self.create_aarfile(temp, "org.pantsbuild.android.test")
self.create_unpack_build_file()
target_name = "unpack:test"
self._make_android_dependency("test-jar", aar, "1.0")
files = self.unpack_libraries(target_name, aar)
self.assertIn("Foo.class", files)
// Reset build graph to dismiss all the created targets.
self.reset_build_graph()
// Create a new copy of the archive- adding a sentinel file but without bumping the version.
new_aar = self.create_aarfile(temp, "org.pantsbuild.android.test",
filenames=["a/b/c/Baz.class"])
// Call task a 2nd time but the sentinel file is not found because we didn"t bump version.
files = self.unpack_libraries(target_name, new_aar)
self.assertNotIn("Baz.class", files)
// Now bump version and this time the aar is unpacked and the sentinel file is found.
self.reset_build_graph()
self._make_android_dependency("test-jar", new_aar, "2.0")
files = self.unpack_libraries(target_name, new_aar)
self.assertIn("Baz.class", files)