mirror of
https://gitlab.com/annimon/imagetagger.git
synced 2024-09-20 05:44:20 +03:00
Add proguard
This commit is contained in:
parent
11157f31a9
commit
8e8bcf23bf
35
build.gradle
35
build.gradle
@ -1,3 +1,12 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.sf.proguard:proguard-gradle:6.2.2'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
@ -7,6 +16,32 @@ plugins {
|
||||
group 'com.annimon'
|
||||
version '1.0-SNAPSHOT'
|
||||
mainClassName = 'com.annimon.imagetagger.Main'
|
||||
def archiveName = "${rootProject.name}"
|
||||
def shadowFileName = "$archiveName-all.jar"
|
||||
def proguardFileName = "$archiveName-proguard.jar"
|
||||
|
||||
shadowJar {
|
||||
mergeServiceFiles()
|
||||
archiveFileName = shadowFileName
|
||||
}
|
||||
|
||||
task proguard(dependsOn: shadowJar, type: proguard.gradle.ProGuardTask) {
|
||||
configuration "$rootProject.projectDir/proguard.pro"
|
||||
injars "${file(jar.destinationDirectory)}/$shadowFileName"
|
||||
outjars "${file(jar.destinationDirectory)}/$proguardFileName"
|
||||
|
||||
// Automatically handle the Java version of this build.
|
||||
if (System.getProperty('java.version').startsWith('1.')) {
|
||||
// Before Java 9, the runtime classes were packaged in a single jar file.
|
||||
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
|
||||
} else {
|
||||
// As of Java 9, the runtime classes are packaged in modular jmod files.
|
||||
def jmods = files { file("${System.getProperty('java.home')}/jmods").listFiles() }
|
||||
jmods.each {
|
||||
libraryjars it, jarfilter: '!**.jar', filter: '!module-info.class'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
29
proguard.pro
vendored
Normal file
29
proguard.pro
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
-keepattributes Signature,InnerClasses
|
||||
-keepattributes *Annotation*
|
||||
|
||||
-keep class com.annimon.imagetagger.beans.** { *; }
|
||||
-keep class com.github.benmanes.caffeine.cache.** { *; }
|
||||
|
||||
# Jackson 2
|
||||
-keep class com.fasterxml.jackson.databind.ObjectMapper {
|
||||
public protected <methods>;
|
||||
}
|
||||
-dontwarn com.fasterxml.jackson.databind.**
|
||||
-keepclassmembers class * {
|
||||
@com.fasterxml.jackson.annotation.* *;
|
||||
}
|
||||
|
||||
# Java
|
||||
-keepclasseswithmembers public class * {
|
||||
public static void main(java.lang.String[]);
|
||||
}
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
-keep class * extends javax.swing.plaf.ComponentUI {
|
||||
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent);
|
||||
}
|
||||
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
|
||||
native <methods>;
|
||||
}
|
Loading…
Reference in New Issue
Block a user