add export to c# button
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# This ProGuard configuration file illustrates how to use annotations for
|
||||
# specifying which classes and class members should be kept.
|
||||
# Usage:
|
||||
# java -jar proguard.jar @examples.pro
|
||||
#
|
||||
|
||||
# Specify the input, output, and library jars.
|
||||
# This is assuming the code has been compiled in the examples directory.
|
||||
|
||||
-injars examples(*.class)
|
||||
-outjars out
|
||||
|
||||
# Before Java 9, the runtime classes were packaged in a single jar file.
|
||||
#-libraryjars <java.home>/lib/rt.jar
|
||||
|
||||
# As of Java 9, the runtime classes are packaged in modular jmod files.
|
||||
-libraryjars <java.home>/jmods/java.base.jmod(!**.jar;!module-info.class)
|
||||
#-libraryjars <java.home>/jmods/.....
|
||||
|
||||
# Some important configuration is based on the annotations in the code.
|
||||
# We have to specify what the annotations mean to ProGuard.
|
||||
|
||||
-include lib/annotations.pro
|
||||
|
||||
#
|
||||
# We can then still add any other options that might be useful.
|
||||
#
|
||||
|
||||
# Print out a list of what we're preserving.
|
||||
|
||||
-printseeds
|
||||
|
||||
# Preserve all annotations themselves.
|
||||
|
||||
-keepattributes *Annotation*
|
||||
|
||||
# Preserve all native method names and the names of their classes.
|
||||
|
||||
-keepclasseswithmembernames,includedescriptorclasses class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
# Preserve the special static methods that are required in all enumeration
|
||||
# classes.
|
||||
|
||||
-keepclassmembers,allowoptimization enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
# Explicitly preserve all serialization members. The Serializable interface
|
||||
# is only a marker interface, so it wouldn't save them.
|
||||
# You can comment this out if your application doesn't use serialization.
|
||||
# If your code contains serializable classes that have to be backward
|
||||
# compatible, please refer to the manual.
|
||||
|
||||
-keepclassmembers class * implements java.io.Serializable {
|
||||
static final long serialVersionUID;
|
||||
static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||
private void writeObject(java.io.ObjectOutputStream);
|
||||
private void readObject(java.io.ObjectInputStream);
|
||||
java.lang.Object writeReplace();
|
||||
java.lang.Object readResolve();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import proguard.annotation.*;
|
||||
|
||||
/**
|
||||
* This applet illustrates the use of annotations for configuring ProGuard.
|
||||
*
|
||||
* You can compile it with:
|
||||
* javac -classpath ../lib/annotations.jar Applet.java
|
||||
* You can then process it with:
|
||||
* java -jar ../../../lib/proguard.jar @ ../examples.pro
|
||||
*
|
||||
* The annotation will preserve the class and its essential methods,
|
||||
* as a result of the specifications in lib/annotations.pro.
|
||||
*/
|
||||
@Keep
|
||||
public class Applet extends java.applet.Applet
|
||||
{
|
||||
// Implementations for Applet.
|
||||
|
||||
public void init()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import proguard.annotation.KeepApplication;
|
||||
|
||||
/**
|
||||
* This application illustrates the use of annotations for configuring ProGuard.
|
||||
*
|
||||
* You can compile it with:
|
||||
* javac -classpath ../lib/annotations.jar Application.java
|
||||
* You can then process it with:
|
||||
* java -jar ../../../lib/proguard.jar @ ../examples.pro
|
||||
*
|
||||
* The annotation will preserve the class and its main method,
|
||||
* as a result of the specifications in lib/annotations.pro.
|
||||
*/
|
||||
@KeepApplication
|
||||
public class Application
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("The answer is 42");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import proguard.annotation.*;
|
||||
|
||||
/**
|
||||
* This bean illustrates the use of annotations for configuring ProGuard.
|
||||
*
|
||||
* You can compile it with:
|
||||
* javac -classpath ../lib/annotations.jar Bean.java
|
||||
* You can then process it with:
|
||||
* java -jar ../../../lib/proguard.jar @ ../examples.pro
|
||||
*
|
||||
* The annotations will preserve the class and its public getters and setters,
|
||||
* as a result of the specifications in lib/annotations.pro.
|
||||
*/
|
||||
@Keep
|
||||
@KeepPublicGettersSetters
|
||||
public class Bean
|
||||
{
|
||||
public boolean booleanProperty;
|
||||
public int intProperty;
|
||||
public String stringProperty;
|
||||
|
||||
|
||||
public boolean isBooleanProperty()
|
||||
{
|
||||
return booleanProperty;
|
||||
}
|
||||
|
||||
|
||||
public void setBooleanProperty(boolean booleanProperty)
|
||||
{
|
||||
this.booleanProperty = booleanProperty;
|
||||
}
|
||||
|
||||
|
||||
public int getIntProperty()
|
||||
{
|
||||
return intProperty;
|
||||
}
|
||||
|
||||
|
||||
public void setIntProperty(int intProperty)
|
||||
{
|
||||
this.intProperty = intProperty;
|
||||
}
|
||||
|
||||
|
||||
public String getStringProperty()
|
||||
{
|
||||
return stringProperty;
|
||||
}
|
||||
|
||||
|
||||
public void setStringProperty(String stringProperty)
|
||||
{
|
||||
this.stringProperty = stringProperty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import proguard.annotation.*;
|
||||
|
||||
/**
|
||||
* This application illustrates the use of annotations for configuring ProGuard.
|
||||
*
|
||||
* You can compile it with:
|
||||
* javac -classpath ../lib/annotations.jar NativeCallBack.java
|
||||
* You can then process it with:
|
||||
* java -jar ../../../lib/proguard.jar @ ../examples.pro
|
||||
*
|
||||
* The annotation will preserve the class and its main method,
|
||||
* as a result of the specifications in lib/annotations.pro.
|
||||
*/
|
||||
@KeepApplication
|
||||
public class NativeCallBack
|
||||
{
|
||||
/**
|
||||
* Suppose this is a native method that computes an answer.
|
||||
*
|
||||
* The -keep option for native methods in the regular ProGuard
|
||||
* configuration will make sure it is not removed or renamed when
|
||||
* processing this code.
|
||||
*/
|
||||
public native int computeAnswer();
|
||||
|
||||
|
||||
/**
|
||||
* Suppose this method is called back from the above native method.
|
||||
*
|
||||
* ProGuard would remove it, because it is not referenced from java.
|
||||
* The annotation will make sure it is preserved anyhow.
|
||||
*/
|
||||
@Keep
|
||||
public int getAnswer()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main entry point of the application.
|
||||
*
|
||||
* The @KeepApplication annotation of this class will make sure it is not
|
||||
* removed or renamed when processing this code.
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int answer = new NativeCallBack().computeAnswer();
|
||||
|
||||
System.out.println("The answer is " + answer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user