aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2015-10-23 14:53:04 +0300
committerIlya Ryzhenkov <orangy@jetbrains.com>2015-10-23 14:53:04 +0300
commit6085cfe628f423d1bf0801b0e7b8e4acfff5fb27 (patch)
treeb619cccccd5ac6569d50ad050266d76f19796c59
parenta76e5a6f50302382fa53608ff79de3dd1926d84c (diff)
downloaddokka-6085cfe628f423d1bf0801b0e7b8e4acfff5fb27.tar.gz
dokka-6085cfe628f423d1bf0801b0e7b8e4acfff5fb27.tar.bz2
dokka-6085cfe628f423d1bf0801b0e7b8e4acfff5fb27.zip
Add proguard task to reduce size of the jar
-rw-r--r--dokka-fatjar/build.gradle34
-rw-r--r--dokka-fatjar/dokka.pro100
2 files changed, 128 insertions, 6 deletions
diff --git a/dokka-fatjar/build.gradle b/dokka-fatjar/build.gradle
index 0d1951e8..467385e1 100644
--- a/dokka-fatjar/build.gradle
+++ b/dokka-fatjar/build.gradle
@@ -1,13 +1,19 @@
group 'org.jetbrains.dokka'
version '1.0.0-beta-1038'
+import proguard.gradle.ProGuardTask
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'net.sf.proguard:proguard-gradle:5.2.1'
+ }
+}
apply plugin: 'java'
apply plugin: 'maven-publish'
-dependencies {
- compile 'org.fusesource.jansi:jansi:[1.11,2.0)'
-}
-
task wrapper(type: Wrapper) {
gradleVersion = '2.5'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
@@ -17,20 +23,34 @@ task sourceJar(type: Jar) {
from fileTree('../src')
}
+task proguard(type: ProGuardTask) {
+ configuration 'dokka.pro'
+
+ injars 'build/libs/dokka-fatjar-1.0.0-beta-1038.jar'
+ outjars 'build/libs/dokka-fatjar-1.0.0-beta-1038.out.jar'
+}
+
jar {
manifest {
attributes "Implementation-Title": "Dokka Kotlin Documentation tool"
attributes "Implementation-Version": version
- attributes "Main-Class" : "org.jetbrains.dokka.DokkaPackage"
+ attributes "Main-Class" : "org.jetbrains.dokka.MainKt"
}
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- fileTree(project.file('../lib')).filter { it.name.endsWith('.jar') && !it.name.contains("-sources") }.each {
+ fileTree(project.file('../lib')).filter {
+ it.name.endsWith('.jar') &&
+ !it.name.contains("-sources") &&
+ !it.name.contains("-javadoc")
+ }.each {
from (zipTree(it)) {
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude '**/*.kt'
+ exclude '**/*.java'
+ exclude '**/*.md'
}
}
from (zipTree(project.file('../out/dokka.jar'))) {
@@ -39,6 +59,8 @@ jar {
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude '**/*.kt'
+ exclude '**/*.java'
+ exclude '**/*.md'
}
}
diff --git a/dokka-fatjar/dokka.pro b/dokka-fatjar/dokka.pro
new file mode 100644
index 00000000..97eae693
--- /dev/null
+++ b/dokka-fatjar/dokka.pro
@@ -0,0 +1,100 @@
+# Include java runtime classes
+-libraryjars <java.home>/lib/rt.jar
+
+# Keep filenames and line numbers
+-keepattributes SourceFile, LineNumberTable
+
+-target 1.6
+-dontoptimize
+-dontobfuscate
+
+-ignorewarnings
+# -keepdirectories
+
+-dontwarn org.jetbrains.annotations.**
+-dontwarn org.apache.commons.httpclient.**
+-dontwarn org.apache.tools.ant.**
+-dontwarn org.codehaus.plexus.**
+-dontwarn hidden.org.codehaus.plexus.**
+-dontwarn org.fusesource.**
+-dontwarn org.jaxen.jdom.**
+
+-keep class org.jetbrains.dokka.** { *; }
+-keep class org.fusesource.** { *; }
+-keep class org.jdom.input.JAXPParserFactory { *; }
+
+-keep class org.jetbrains.annotations.** {
+ public protected *;
+}
+
+-keep class javax.inject.** {
+ public protected *;
+}
+
+-keep class org.jetbrains.kotlin.** {
+ public protected *;
+}
+
+-keep class org.jetbrains.kotlin.compiler.plugin.** {
+ public protected *;
+}
+
+-keep class org.jetbrains.kotlin.extensions.** {
+ public protected *;
+}
+
+-keep class org.jetbrains.org.objectweb.asm.Opcodes { *; }
+
+-keep class org.jetbrains.kotlin.codegen.extensions.** {
+ public protected *;
+}
+
+-keepclassmembers class com.intellij.openapi.vfs.VirtualFile {
+ public InputStream getInputStream();
+}
+
+-keep class jet.** {
+ public protected *;
+}
+
+-keep class com.intellij.psi.** {
+ public protected *;
+}
+
+# for kdoc & dokka
+-keep class com.intellij.openapi.util.TextRange { *; }
+-keep class com.intellij.lang.impl.PsiBuilderImpl* {
+ public protected *;
+}
+-keep class com.intellij.openapi.util.text.StringHash { *; }
+
+# for gradle plugin and other server tools
+-keep class com.intellij.openapi.util.io.ZipFileCache { public *; }
+
+# for j2k
+-keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; }
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keepclassmembers class * {
+ ** toString();
+ ** hashCode();
+ void start();
+ void stop();
+ void dispose();
+}
+
+-keepclassmembers class org.jetbrains.org.objectweb.asm.Opcodes {
+ *** ASM5;
+}
+
+-keepclassmembers class org.jetbrains.org.objectweb.asm.ClassReader {
+ *** SKIP_CODE;
+ *** SKIP_DEBUG;
+ *** SKIP_FRAMES;
+}
+
+