Make smali file iteration more deterministic

In some cases, even when running in single threaded mode (-j 1), smali
could produce slightly different results if files are not listed in
a consistent order.

This ensures that we assemble a given set of smali files in a consistent
order when running in single-threaded mode, regardless of the order
they are listed in.
This commit is contained in:
Ben Gruver 2018-02-28 16:21:55 -08:00
parent 681222d391
commit 37eb703409

View File

@ -50,6 +50,7 @@ import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.*;
public class Smali {
@ -73,7 +74,7 @@ public class Smali {
* @return true if assembly completed with no errors, or false if errors were encountered
*/
public static boolean assemble(final SmaliOptions options, List<String> input) throws IOException {
LinkedHashSet<File> filesToProcessSet = new LinkedHashSet<File>();
TreeSet<File> filesToProcessSet = new TreeSet<File>();
for (String fileToProcess: input) {
File argFile = new File(fileToProcess);