Skip to content

Commit 0f061fd

Browse files
authored
Merge pull request #10 from patrickfav/feat-4-proguard
Support proguard configuration creating optimized version
2 parents 377476b + b9c6cca commit 0f061fd

7 files changed

Lines changed: 139 additions & 47 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ deploy:
3737
- "modules/bcrypt/target/bcrypt-*.jar"
3838
- "modules/bcrypt/target/*.sha256"
3939
- "modules/bcrypt/target/checksum-sha256.txt"
40-
- "modules/bcrypt-cli/target/bcrypt-*.jar"
40+
- "modules/bcrypt-cli/target/bcrypt-*-full.jar"
4141
- "modules/bcrypt-cli/target/*.sha256"
4242
skip_cleanup: true
4343
on:

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
## v0.4.0
99

1010
* add cli tool #5
11+
* add (_experimental_) ProGuard optimized version (use maven classifier 'optimized') #4
1112

1213
## v0.3.0
1314

modules/bcrypt-cli/pom.xml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,21 @@
2424
<build>
2525
<plugins>
2626
<plugin>
27-
<groupId>org.apache.maven.plugins</groupId>
28-
<artifactId>maven-shade-plugin</artifactId>
29-
<version>3.1.1</version>
27+
<groupId>com.github.chrisdchristo</groupId>
28+
<artifactId>capsule-maven-plugin</artifactId>
29+
<version>1.5.1</version>
30+
<configuration>
31+
<appClass>at.favre.lib.crypto.bcrypt.cli.BcryptTool</appClass>
32+
<fileDesc>-full</fileDesc>
33+
<type>fat</type>
34+
</configuration>
3035
<executions>
3136
<execution>
37+
<id>build-fat-jar</id>
3238
<phase>package</phase>
3339
<goals>
34-
<goal>shade</goal>
40+
<goal>build</goal>
3541
</goals>
36-
<configuration>
37-
<filters>
38-
<filter>
39-
<artifact>*:*</artifact>
40-
<excludes>
41-
<exclude>META-INF/*.SF</exclude>
42-
<exclude>META-INF/*.DSA</exclude>
43-
<exclude>META-INF/*.RSA</exclude>
44-
</excludes>
45-
</filter>
46-
</filters>
47-
<minimizeJar>true</minimizeJar>
48-
<createDependencyReducedPom>true</createDependencyReducedPom>
49-
<dependencyReducedPomLocation>
50-
${java.io.tmpdir}/dependency-reduced-pom.xml
51-
</dependencyReducedPomLocation>
52-
<transformers>
53-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
54-
<mainClass>at.favre.lib.crypto.bcrypt.cli.BcryptTool</mainClass>
55-
</transformer>
56-
</transformers>
57-
</configuration>
5842
</execution>
5943
</executions>
6044
</plugin>
@@ -87,6 +71,7 @@
8771
<groupId>at.favre.lib</groupId>
8872
<artifactId>bcrypt</artifactId>
8973
<version>0.5.0</version>
74+
<classifier>optimized</classifier>
9075
</dependency>
9176
<dependency>
9277
<groupId>commons-cli</groupId>

modules/bcrypt/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,60 @@
7373
<quiet>false</quiet>
7474
</configuration>
7575
</plugin>
76+
<plugin>
77+
<groupId>com.github.wvengen</groupId>
78+
<artifactId>proguard-maven-plugin</artifactId>
79+
<version>2.0.14</version>
80+
<executions>
81+
<execution>
82+
<phase>package</phase>
83+
<goals>
84+
<goal>proguard</goal>
85+
</goals>
86+
<configuration>
87+
<includeDependency>true</includeDependency>
88+
<attachArtifactClassifier>optimized</attachArtifactClassifier>
89+
<attach>true</attach>
90+
<proguardVersion>6.0.3</proguardVersion>
91+
<obfuscate>false</obfuscate>
92+
<options>
93+
<option>-include ${project.basedir}/proguard-rules.pro</option>
94+
</options>
95+
<libs>
96+
<lib>${java.home}/lib/rt.jar</lib>
97+
</libs>
98+
</configuration>
99+
</execution>
100+
</executions>
101+
<dependencies>
102+
<dependency>
103+
<groupId>net.sf.proguard</groupId>
104+
<artifactId>proguard-base</artifactId>
105+
<version>6.0.3</version>
106+
<scope>runtime</scope>
107+
</dependency>
108+
</dependencies>
109+
</plugin>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-jarsigner-plugin</artifactId>
113+
<version>1.4</version>
114+
<executions>
115+
<execution>
116+
<id>sign</id>
117+
<goals>
118+
<goal>sign</goal>
119+
</goals>
120+
</execution>
121+
</executions>
122+
<configuration>
123+
<skip>${project.skipJarSign}</skip>
124+
<keystore>${session.executionRootDirectory}/keystore.jks</keystore>
125+
<alias>pfopensource</alias>
126+
<storepass>${env.OPENSOURCE_PROJECTS_KS_PW}</storepass>
127+
<keypass>${env.OPENSOURCE_PROJECTS_KEY_PW}</keypass>
128+
</configuration>
129+
</plugin>
76130
</plugins>
77131
</build>
78132

modules/bcrypt/proguard-rules.pro

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
2+
-dontusemixedcaseclassnames
3+
-dontobfuscate
4+
-verbose
5+
6+
-keepattributes *Annotation*,EnclosingMethod, InnerClasses, Exceptions, Signature, SourceFile, LineNumberTable, MethodParameters
7+
-renamesourcefileattribute SourceFile
8+
-optimizationpasses 3
9+
-overloadaggressively
10+
11+
-keepclasseswithmembernames class * {
12+
native <methods>;
13+
}
14+
15+
-keepclassmembers enum * {
16+
public static **[] values();
17+
public static ** valueOf(java.lang.String);
18+
}
19+
20+
################################################
21+
22+
-dontnote com.sun.**
23+
-dontwarn com.sun.**
24+
25+
-dontnote sun.**
26+
-dontwarn sun.**
27+
28+
-dontnote java.**
29+
-dontwarn java.**
30+
31+
-dontnote javax.**
32+
-dontwarn javax.**
33+
34+
# keep all public classes in main package
35+
-keep public class at.favre.lib.crypto.bcrypt.** { public *; }
36+
-keep interface at.favre.lib.crypto.bcrypt.** { <methods>; }

pom.xml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,6 @@
116116
<artifactId>coveralls-maven-plugin</artifactId>
117117
<version>4.3.0</version>
118118
</plugin>
119-
<plugin>
120-
<groupId>org.apache.maven.plugins</groupId>
121-
<artifactId>maven-jarsigner-plugin</artifactId>
122-
<version>1.4</version>
123-
<executions>
124-
<execution>
125-
<id>sign</id>
126-
<goals>
127-
<goal>sign</goal>
128-
</goals>
129-
</execution>
130-
</executions>
131-
<configuration>
132-
<skip>${project.skipJarSign}</skip>
133-
<keystore>${session.executionRootDirectory}/keystore.jks</keystore>
134-
<alias>pfopensource</alias>
135-
<storepass>${env.OPENSOURCE_PROJECTS_KS_PW}</storepass>
136-
<keypass>${env.OPENSOURCE_PROJECTS_KEY_PW}</keypass>
137-
</configuration>
138-
</plugin>
139119
</plugins>
140120
</build>
141121

proguard-rules.pro

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
2+
-dontusemixedcaseclassnames
3+
-dontobfuscate
4+
-verbose
5+
6+
-keepattributes *Annotation*,EnclosingMethod, InnerClasses, Exceptions, Signature, SourceFile, LineNumberTable, MethodParameters
7+
-renamesourcefileattribute SourceFile
8+
-optimizationpasses 3
9+
-overloadaggressively
10+
11+
-keepclasseswithmembernames class * {
12+
native <methods>;
13+
}
14+
15+
-keepclassmembers enum * {
16+
public static **[] values();
17+
public static ** valueOf(java.lang.String);
18+
}
19+
20+
################################################
21+
22+
-dontnote com.sun.**
23+
-dontwarn com.sun.**
24+
25+
-dontnote sun.**
26+
-dontwarn sun.**
27+
28+
-dontnote java.**
29+
-dontwarn java.**
30+
31+
-dontnote javax.**
32+
-dontwarn javax.**
33+
34+
# keep all public classes in main package
35+
-keep public class at.favre.lib.crypto.bcrypt.** { public *; }
36+
-keep interface at.favre.lib.crypto.bcrypt.** { <methods>; }

0 commit comments

Comments
 (0)