Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public Options(ProcessingEnvironment processingEnvironment) {
addSupportedOption(AndroidManifestFinder.OPTION_MANIFEST);
addSupportedOption(AndroidManifestFinder.OPTION_LIBRARY);
addSupportedOption(ProjectRClassFinder.OPTION_RESOURCE_PACKAGE_NAME);
addSupportedOption(ProjectRClassFinder.OPTION_USE_R2);
addSupportedOption(ModelConstants.OPTION_CLASS_SUFFIX);
addSupportedOption(FileAppender.OPTION_LOG_FILE);
addSupportedOption(LoggerContext.OPTION_LOG_LEVEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
public class ProjectRClassFinder {

public static final Option OPTION_RESOURCE_PACKAGE_NAME = new Option("resourcePackageName", null);
public static final Option OPTION_USE_R2 = new Option("useR2", "false");

private static final Logger LOGGER = LoggerFactory.getLogger(ProjectRClassFinder.class);

Expand All @@ -40,7 +41,7 @@ public ProjectRClassFinder(AndroidAnnotationsEnvironment environment) {

public IRClass find(AndroidManifest manifest) throws RClassNotFoundException {
Elements elementUtils = environment.getProcessingEnvironment().getElementUtils();
String rClass = getRClassPackageName(manifest) + ".R";
String rClass = getRClassPackageName(manifest) + "." + getRClassSimpleName();
TypeElement rType = elementUtils.getTypeElement(rClass);

if (rType == null) {
Expand All @@ -60,4 +61,10 @@ public String getRClassPackageName(AndroidManifest manifest) {
return manifest.getApplicationPackage();
}
}

private String getRClassSimpleName() {
boolean useR2 = environment.getOptionBooleanValue(OPTION_USE_R2);

return useR2 ? "R2" : "R";
}
}