Skip to content

Commit

Permalink
fix rt.jar not found error in mac and more detail setting with proguard.
Browse files Browse the repository at this point in the history
  • Loading branch information
htynkn authored and dreamhead committed Dec 26, 2013
1 parent 1e58d8f commit 5e2c3d4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,19 @@ project(':moco-runner') {
injar= jar.archivePath
jar.classifier="proguard"
outJar= jar.archivePath
javaBase=System.properties["java.home"];
javaRt="/lib/rt.jar"
if(System.properties["os.name"].toLowerCase().contains("mac"))
{
if(!new File(javaBase+javaRt).exists())
{
javaRt="/../Classes/classes.jar"
}
}
}
injars injar
libraryjars javaBase+javaRt
println(javaBase+javaRt)
outjars outJar
configuration '../proguard.pro'
}
Expand All @@ -221,7 +232,7 @@ project(':moco-runner') {
outJar= jar.archivePath
}
testLogging { exceptionFormat "full" }
classpath = classpath-files(sourceSets.main.output.classesDir)-files(configurations.compile)+files(outJar)
classpath = classpath-files(sourceSets.main.output.classesDir)-files(configurations.runtime)+files(outJar)
}

artifacts {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Default config properties, can be overridden by ~/.gradle/gradle.properties
sonatypeUsername=
sonatypePassword=
org.gradle.daemon=true
org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8
31 changes: 22 additions & 9 deletions proguard.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-libraryjars <java.home>/lib/rt.jar
-libraryjars <java.home>/lib/jce.jar
-printusage shrinking.output

-dontobfuscate
Expand All @@ -11,7 +9,19 @@
public static void main(java.lang.String[]);
}

-keep public class com.github.dreamhead.moco.** {*;}

-keep public class com.github.dreamhead.moco.parser.model.*{*;}
-keep public class com.github.dreamhead.moco.Moco{*;}
-keep public class com.github.dreamhead.moco.handler.*{*;}
-keep public class com.github.dreamhead.moco.runner.ShutdownRunner{
public int shutdownPort();
}
-keepclassmembers enum com.jayway.jsonpath.Option {
public static **[] values();
public static ** valueOf(java.lang.String);
}


-keep public class org.apache.http.**{*;}
-keep public class com.google.common.io.Files{*;}
-keep public class org.apache.commons.io.FilenameUtils{*;}
Expand All @@ -20,14 +30,17 @@
-keep public class ch.** {*;}
-keep public class org.apache.commons.logging.impl.**{*;}
-keep public class com.fasterxml.jackson.databind.**{*;}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

#jce.jar
-dontwarn org.apache.http.impl.auth.**
#jsse.jar
-dontwarn org.apache.http.conn.**
-dontwarn org.apache.http.impl.**

-dontwarn io.netty.**
-dontwarn com.jayway.jsonpath.**
-dontwarn ch.qos.logback.**
-dontwarn com.jayway.jsonpath.spi.impl.JacksonProvider
-dontwarn ch.qos.logback.core.**
-dontwarn ch.qos.logback.classic.**
-dontwarn freemarker.**
-dontwarn org.slf4j.**
-dontwarn org.apache.log4j.**
Expand Down

0 comments on commit 5e2c3d4

Please sign in to comment.