Proguard 保留处理 OSGi 声明性服务的选项
Proguard keep option to handle OSGi declarative service
OSGi 声明式服务使用什么 keep 选项来混淆 Proguard
参考下面的例子,我需要保留DS相关的函数而不用Proguard移除它,因为它找不到引用
@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 *;
}
OSGi 声明式服务使用什么 keep 选项来混淆 Proguard
参考下面的例子,我需要保留DS相关的函数而不用Proguard移除它,因为它找不到引用
@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 *;
}