Skip to content

Commit 3fd802b

Browse files
author
ProGuard
committed
Created ProGuard version 6.2.1.
1 parent f509ce9 commit 3fd802b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+9355
-129
lines changed

annotations/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>net.sf.proguard</groupId>
1010
<artifactId>proguard-parent</artifactId>
11-
<version>6.2.0</version>
11+
<version>6.2.1</version>
1212
<relativePath>../buildscripts/pom.xml</relativePath>
1313
</parent>
1414
<artifactId>proguard-annotations</artifactId>

ant/build.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ if [ ! -f "$ANT_JAR" ]; then
1919
exit 1
2020
fi
2121

22-
# Make sure the ProGuard core has been compiled.
23-
if [ ! -d ../core/$OUT ]; then
22+
# Make sure ProGuard has been compiled.
23+
if [[ ! -d ../core/$OUT || ! -f "$PROGUARD_JAR" ]]; then
2424
../core/build.sh || exit 1
2525
fi
2626

27-
# Compile and package.
28-
export CLASSPATH=../core/$OUT:$ANT_JAR
29-
30-
compile $MAIN_CLASS && \
27+
compile $MAIN_CLASS "../core/$OUT:$ANT_JAR" && \
3128
updatejar "$PROGUARD_JAR" || exit 1

ant/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>net.sf.proguard</groupId>
1010
<artifactId>proguard-parent</artifactId>
11-
<version>6.2.0</version>
11+
<version>6.2.1</version>
1212
<relativePath>../buildscripts/pom.xml</relativePath>
1313
</parent>
1414
<artifactId>proguard-anttask</artifactId>

buildscripts/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Pick your favorite build tool and enjoy!
2727

2828
https://www.guardsquare.com/proguard
2929

30-
Copyright (c) 2002-2019 Eric Lafortune @ GuardSquare
30+
Copyright (c) 2002-2019 Guardsquare

buildscripts/functions.mk

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ TARGET_JAR = $(LIB)/$(TARGET).jar
1919
DOWNLOAD = wget -O
2020
#DOWNLOAD = curl -L -o
2121

22-
# Function to find the resource files of a given target.
22+
# Functions to find the class files and resource files of a given target.
23+
24+
define CLASS_FILES
25+
$(subst .java,.class,$(shell find $(SRC)/$(dir $(1)) -path "$(SRC)/$(MAIN_CLASS).java" -printf $(OUT)/$(dir $(1))%P\\n))
26+
endef
2327

2428
define RESOURCES
2529
$(shell find $(SRC)/$(dir $(1)) -maxdepth 1 \( -name \*.properties -o -name \*.png -o -name \*.gif -o -name \*.pro \) -printf $(OUT)/$(dir $(1))%P\\n)
@@ -29,22 +33,26 @@ endef
2933

3034
all: $(TARGET_JAR)
3135

32-
$(TARGET_JAR): $(OUT)/$(MAIN_CLASS).class $(LIB)
36+
$(TARGET_JAR): $(call CLASS_FILES,$(MAIN_CLASS)) $(LIB)
3337
ifeq ($(UPDATE_JAR),true)
34-
jar -uf $@ -C $(OUT) $(dir $(MAIN_CLASS))
38+
ifeq ($(INCLUDE_MANIFEST),true)
39+
jar -ufm $@ $(SRC)/META-INF/MANIFEST.MF -C $(OUT) $(dir $(MAIN_CLASS))
40+
else
41+
jar -uf $@ -C $(OUT) $(dir $(MAIN_CLASS))
42+
endif
3543
else
3644
ifeq ($(INCLUDE_MANIFEST),true)
3745
jar -cfm $@ $(SRC)/META-INF/MANIFEST.MF -C $(OUT) $(dir $(MAIN_CLASS))
3846
else
39-
jar -cf $@ -C $(OUT) $(dir $(MAIN_CLASS))
47+
jar -cf $@ -C $(OUT) $(dir $(MAIN_CLASS))
4048
endif
4149
endif
4250

4351
$(TARGET_JAR): $(call RESOURCES,$(MAIN_CLASS))
4452

4553
# Rule for compiling the class files.
4654

47-
$(OUT)/%.class: $(SRC)/%.java $(subst :, ,$(CLASSPATH)) $(OUT)
55+
$(OUT)/%.class: $(OUT) $(SRC)/%.java $(subst :, ,$(CLASSPATH))
4856
javac -nowarn -Xlint:none $(CLASSPATH_OPTION) -source $(JAVA_TARGET) -target $(JAVA_TARGET) -sourcepath $(SRC) -d $(OUT) $(filter %.java,$^) 2>&1 | sed -e 's|^| |'
4957

5058
# Rule for copying the resource files.

buildscripts/functions.sh

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ set -o pipefail
1818
function download {
1919
if [ ! -f "$2" ]; then
2020
echo "Downloading $2..."
21+
mkdir -p $(dirname "$2") && \
2122
if type wget > /dev/null 2>&1; then
2223
wget -O "$2" "$1"
2324
else
@@ -27,34 +28,58 @@ function download {
2728
}
2829

2930
function compile {
30-
# Compile java source files.
3131
echo "Compiling $(basename $PWD) ($1)..."
3232
mkdir -p "$OUT" && \
33-
javac -nowarn -Xlint:none -source $TARGET -target $TARGET \
33+
34+
# Compile Java source files.
35+
find $SRC -name '_*.java' -o -path "$SRC/${1//.//}.java" \
36+
| xargs --no-run-if-empty \
37+
javac -nowarn -Xlint:none \
38+
-source $TARGET -target $TARGET \
39+
-sourcepath "$SRC" -d "$OUT" \
40+
${2:+-classpath "$2"} 2>&1 \
41+
| sed -e 's|^| |' || return 1
42+
43+
# Compile Kotlin source files.
44+
#find $SRC -path "$SRC/${1//.//}.kotlin" \
45+
#| xargs --no-run-if-empty \
46+
# kotlinc -nowarn -jvm-target $TARGET \
47+
# -d "$OUT" \
48+
# ${2:+-classpath "$2"} 2>&1 \
49+
#| sed -e 's|^| |' || return 1
50+
51+
# Compile Groovy source files.
52+
find $SRC -path "$SRC/${1//.//}.groovy" \
53+
| xargs --no-run-if-empty \
54+
groovyc \
3455
-sourcepath "$SRC" -d "$OUT" \
35-
${2:+-classpath "$2"} \
36-
`find $SRC -name _*.java` \
37-
"$SRC"/${1//.//}.java 2>&1 \
38-
| sed -e 's|^| |' || return 1
56+
${2:+-classpath "$2"} 2>&1 \
57+
| sed -e 's|^| |' || return 1
3958

4059
# Copy resource files.
4160
(cd "$SRC" && \
42-
find proguard \
61+
find \
4362
\( -name \*.properties -o -name \*.png -o -name \*.gif -o -name \*.pro \) \
4463
-exec cp --parents {} "../$OUT" \; )
4564
}
4665

4766
function createjar {
4867
echo "Creating $1..."
68+
DIRS=$(ls "$OUT" | sed -e "s|^|-C $OUT |")
4969
mkdir -p $(dirname "$1") && \
5070
if [ -f "$SRC/META-INF/MANIFEST.MF" ]; then
51-
jar -cfm "$1" "$SRC/META-INF/MANIFEST.MF" -C "$OUT" proguard
71+
jar -cfm "$1" "$SRC/META-INF/MANIFEST.MF" $DIRS
5272
else
53-
jar -cf "$1" -C "$OUT" proguard
73+
jar -cf "$1" $DIRS
5474
fi
5575
}
5676

5777
function updatejar {
5878
echo "Updating $1..."
59-
jar -uf "$1" -C "$OUT" proguard
79+
DIRS=$(ls "$OUT" | sed -e "s|^|-C $OUT |")
80+
if [ -f "$SRC/META-INF/MANIFEST.MF" ]; then
81+
jar -ufm "$1" "$SRC/META-INF/MANIFEST.MF" $DIRS
82+
else
83+
jar -uf "$1" $DIRS
84+
fi
6085
}

buildscripts/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
target = 1.8
44

5-
wtkDir=/usr/local/java/wtk2.1
5+
wtkDir = /usr/local/java/wtk2.1

buildscripts/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>net.sf.proguard</groupId>
99
<artifactId>proguard-parent</artifactId>
10-
<version>6.2.0</version>
10+
<version>6.2.1</version>
1111
<packaging>pom</packaging>
1212
<name>[${project.groupId}] ${project.artifactId}</name>
1313
<description>ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier.</description>
@@ -21,7 +21,7 @@
2121
<developer>
2222
<id>lafortune</id>
2323
<name>Eric Lafortune</name>
24-
<url>https://www.lafortune.eu/</url>
24+
<url>https://www.guardsquare.com/proguard</url>
2525
<organization>Guardsquare</organization>
2626
<organizationUrl>https://www.guardsquare.com/</organizationUrl>
2727
<roles>

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>net.sf.proguard</groupId>
1010
<artifactId>proguard-parent</artifactId>
11-
<version>6.2.0</version>
11+
<version>6.2.1</version>
1212
<relativePath>../buildscripts/pom.xml</relativePath>
1313
</parent>
1414
<artifactId>proguard-base</artifactId>

core/src/proguard/DataEntryReaderFactory.java

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import proguard.io.*;
2525
import proguard.util.*;
2626

27-
import java.util.List;
27+
import java.util.*;
2828

2929

3030
/**
@@ -36,6 +36,10 @@
3636
*/
3737
public class DataEntryReaderFactory
3838
{
39+
private static final String VERSIONS_PATTERN = "META-INF/versions";
40+
private static final String VERSIONS_EXCLUDE = "!META-INF/versions/**";
41+
42+
3943
/**
4044
* Creates a DataEntryReader that can read the given class path entry.
4145
*
@@ -57,7 +61,7 @@ public static DataEntryReader createDataEntryReader(String messagePrefi
5761
boolean isJmod = classPathEntry.isJmod();
5862
boolean isZip = classPathEntry.isZip();
5963

60-
List filter = classPathEntry.getFilter();
64+
List filter = getFilterExcludingVersionedClasses(classPathEntry);
6165
List apkFilter = classPathEntry.getApkFilter();
6266
List jarFilter = classPathEntry.getJarFilter();
6367
List aarFilter = classPathEntry.getAarFilter();
@@ -191,4 +195,42 @@ private static DataEntryReader wrapInJarReader(DataEntryReader reader,
191195
reader);
192196
}
193197
}
198+
199+
200+
/**
201+
* Method to return an augmented filter for supported features.
202+
* <p>
203+
* Currently versioned class files (a feature introduced in Java 9) are not fully
204+
* supported by ProGuard. Only 1 version of a class can be read and processed.
205+
* If no custom filter targeting a specific version is used, exclude such classes
206+
* from being read.
207+
*/
208+
public static List getFilterExcludingVersionedClasses(ClassPathEntry classPathEntry)
209+
{
210+
List originalFilter = classPathEntry.getFilter();
211+
if (originalFilter == null)
212+
{
213+
return Arrays.asList(VERSIONS_EXCLUDE);
214+
}
215+
else
216+
{
217+
// If there is already a custom filter for versioned classes
218+
// assume that the filter is properly setup.
219+
ListIterator it = originalFilter.listIterator();
220+
while (it.hasNext())
221+
{
222+
String element = (String) it.next();
223+
if (element.contains(VERSIONS_PATTERN))
224+
{
225+
return originalFilter;
226+
}
227+
}
228+
229+
// Otherwise, exclude all versioned classes.
230+
List filter = new ArrayList();
231+
filter.add(VERSIONS_EXCLUDE);
232+
filter.addAll(originalFilter);
233+
return filter;
234+
}
235+
}
194236
}

0 commit comments

Comments
 (0)