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

Sort generated index file to make it stable if there are no changes #679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Messager;
Expand All @@ -48,7 +50,6 @@

import de.greenrobot.common.ListMap;


import static net.ltgt.gradle.incap.IncrementalAnnotationProcessorType.AGGREGATING;

/**
Expand Down Expand Up @@ -369,12 +370,17 @@ private void createInfoIndexFile(String index) {
}

private void writeIndexLines(BufferedWriter writer, String myPackage) throws IOException {
Map<String, TypeElement> classMethods = new TreeMap<>();
for (TypeElement subscriberTypeElement : methodsByClass.keySet()) {
if (classesToSkip.contains(subscriberTypeElement)) {
continue;
}

String subscriberClass = getClassString(subscriberTypeElement, myPackage);
classMethods.put(subscriberClass, subscriberTypeElement);
}
for(Map.Entry<String, TypeElement> entry: classMethods.entrySet()) {
String subscriberClass = entry.getKey();
TypeElement subscriberTypeElement = entry.getValue();
if (isVisible(myPackage, subscriberTypeElement)) {
writeLine(writer, 2,
"putIndex(new SimpleSubscriberInfo(" + subscriberClass + ".class,",
Expand Down
Loading