Proguard保留选项来处理OSGi声明性服务



OSGi声明性服务使用什么选项来模糊Proguard

参考下面的例子,我需要在没有Proguard的情况下保留DS相关函数,因为它找不到引用

@Component
public class RandomApp {
private RandomGenApi randomGenApi;
@Reference
public void setRandomGenService(RandomGenApi randomGenApi) {
this.randomGenApi = randomGenApi;
}


@Activate
void startRandomApp() {
System.out.println("Startig RandomApp...");          
}

我可以通过将OSGi服务定义为入口点来实现这一点。以下是要定义的保留选项

#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 *;   
}

最新更新