What is the keep option to use for OSGi declarative service to obfuscate with Proguard
Referring to the example below, I need to keep the DS relevant functions without Proguard removes it, because it cant find the reference
@Component
public class RandomApp {
private RandomGenApi randomGenApi;
@Reference
public void setRandomGenService(RandomGenApi randomGenApi) {
this.randomGenApi = randomGenApi;
}
@Activate
void startRandomApp() {
System.out.println("Startig RandomApp...");
}
I could achieve this by defining the OSGi services as the entry points. Here is the keep options to be defined
#Keep annotations.
-keepattributes *Annotation*
#Keep all Component classes
-keep @org.osgi.service.component.annotations.Component class *
#Kepp all Component classes member functions with OSGi specific annotations
-keepclassmembers @org.osgi.service.component.annotations.Component class * {
#Keep all methods with annotatios Reference.
@org.osgi.service.component.annotations.Reference *;
#Keep all methods with annotatios Activate.
@org.osgi.service.component.annotations.Activate *;
}