Revert "Revert "Merge branch 'detect_partitions'""

This reverts commit 272077c72c93ea6296aa462e1018b11e7d67f63c.
WIP:manually merging in anthony's gradle changes.
Fixed: typo in test package name. Kept Anthony's testlogging in gradle.