Skip to content

Commit

Permalink
Add proguard 5.3.3 to third_party.
Browse files Browse the repository at this point in the history
See bazelbuild#3777

The Android SDK provides a very old proguard and will be removing it
soon, so we need to bundle our own.

Change-Id: I054c54130bef1befc8591598768184fe23f76161
RELNOTES: None
  • Loading branch information
aj-michael authored and damienmg committed Oct 4, 2017
1 parent 74776b4 commit b4ebfd7
Show file tree
Hide file tree
Showing 853 changed files with 144,779 additions and 0 deletions.
1 change: 1 addition & 0 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ filegroup(
"//third_party/java/jopt-simple:srcs",
"//third_party/java/jdk/langtools:srcs",
"//third_party/java/jdk/javabuilder:srcs",
"//third_party/java/proguard:srcs",
"//third_party/javascript/bootstrap:srcs",
"//third_party/checker_framework_dataflow:srcs",
"//third_party/checker_framework_javacutil:srcs",
Expand Down
17 changes: 17 additions & 0 deletions third_party/java/proguard/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
licenses(["restricted"]) # GNU GPL v2

filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//third_party:__pkg__"],
)

filegroup(
name = "embedded_tools",
srcs = [
"BUILD.tools",
"proguard5.3.3/docs/GPL.html",
"proguard5.3.3/lib/proguard.jar",
],
visibility = ["//src:__pkg__"],
)
11 changes: 11 additions & 0 deletions third_party/java/proguard/BUILD.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
java_import(
name = "proguard_import",
jars = ["proguard5.3.3/lib/proguard.jar"],
)

java_binary(
name = "proguard",
main_class = "proguard.ProGuard",
runtime_deps = [":proguard_import"],
visibility = ["//visibility:public"],
)
33 changes: 33 additions & 0 deletions third_party/java/proguard/proguard5.3.3/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier
==========================================================================

This distribution contains the following directories:

- bin : simple wrapper scripts to run ProGuard, its GUI, and ReTrace
- lib : the main jars, compiled and ready to use with "java -jar ...."
- docs : the complete documentation, licenses, etc. in html format
- examples : some example configuration files
- src : the source code
- buildscripts : various alternative build scripts


The best place to start is docs/index.html


Example
-------

If you want to give ProGuard a spin right away, try processing the ProGuard
jar itself:

cd examples
java -jar ../lib/proguard.jar @proguard.pro

The resulting proguard_out.jar contains the same application, but it's a lot
smaller.

Enjoy!

http://proguard.sourceforge.net/

Copyright (c) 2002-2017 Eric Lafortune @ GuardSquare
14 changes: 14 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/proguard.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@ECHO OFF

REM Start-up script for ProGuard -- free class file shrinker, optimizer,
REM obfuscator, and preverifier for Java bytecode.
REM
REM Note: when passing file names containing spaces to this script,
REM you'll have to add escaped quotes around them, e.g.
REM "\"C:/My Directory/My File.txt\""

IF EXIST "%PROGUARD_HOME%" GOTO home
SET PROGUARD_HOME=%~dp0\..
:home

java -jar "%PROGUARD_HOME%\lib\proguard.jar" %*
24 changes: 24 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/proguard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
#
# Start-up script for ProGuard -- free class file shrinker, optimizer,
# obfuscator, and preverifier for Java bytecode.
#
# Note: when passing file names containing spaces to this script,
# you'll have to add escaped quotes around them, e.g.
# "\"/My Directory/My File.txt\""

# Account for possibly missing/basic readlink.
# POSIX conformant (dash/ksh/zsh/bash).
PROGUARD=`readlink -f "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD=`readlink "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD="$0"
fi
fi

PROGUARD_HOME=`dirname "$PROGUARD"`/..

java -jar "$PROGUARD_HOME/lib/proguard.jar" "$@"
14 changes: 14 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/proguardgui.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@ECHO OFF

REM Start-up script for the GUI of ProGuard -- free class file shrinker,
REM optimizer, obfuscator, and preverifier for Java bytecode.
REM
REM Note: when passing file names containing spaces to this script,
REM you'll have to add escaped quotes around them, e.g.
REM "\"C:/My Directory/My File.txt\""

IF EXIST "%PROGUARD_HOME%" GOTO home
SET PROGUARD_HOME=%~dp0\..
:home

java -jar "%PROGUARD_HOME%\lib\proguardgui.jar" %*
27 changes: 27 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/proguardgui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
#
# Start-up script for the GUI of ProGuard -- free class file shrinker,
# optimizer, obfuscator, and preverifier for Java bytecode.
#
# Note: when passing file names containing spaces to this script,
# you'll have to add escaped quotes around them, e.g.
# "\"/My Directory/My File.txt\""

# Account for possibly missing/basic readlink.
# POSIX conformant (dash/ksh/zsh/bash).
PROGUARD=`readlink -f "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD=`readlink "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD="$0"
fi
fi

PROGUARD_HOME=`dirname "$PROGUARD"`/..

# On Linux, Java 1.6.0_24 and higher hang when starting the GUI:
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7027598
# We're using the -D option as a workaround.
java -DsuppressSwingDropSupport=true -jar "$PROGUARD_HOME/lib/proguardgui.jar" "$@"
14 changes: 14 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/retrace.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@ECHO OFF

REM Start-up script for Retrace -- companion tool for ProGuard, free class file
REM shrinker, optimizer, obfuscator, and preverifier for Java bytecode.
REM
REM Note: when passing file names containing spaces to this script,
REM you'll have to add escaped quotes around them, e.g.
REM "\"C:/My Directory/My File.txt\""

IF EXIST "%PROGUARD_HOME%" GOTO home
SET PROGUARD_HOME=%~dp0\..
:home

java -jar "%PROGUARD_HOME%\lib\retrace.jar" %*
24 changes: 24 additions & 0 deletions third_party/java/proguard/proguard5.3.3/bin/retrace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
#
# Start-up script for Retrace -- companion tool for ProGuard, free class file
# shrinker, optimizer, obfuscator, and preverifier for Java bytecode.
#
# Note: when passing file names containing spaces to this script,
# you'll have to add escaped quotes around them, e.g.
# "\"/My Directory/My File.txt\""

# Account for possibly missing/basic readlink.
# POSIX conformant (dash/ksh/zsh/bash).
PROGUARD=`readlink -f "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD=`readlink "$0" 2>/dev/null`
if test "$PROGUARD" = ''
then
PROGUARD="$0"
fi
fi

PROGUARD_HOME=`dirname "$PROGUARD"`/..

java -jar "$PROGUARD_HOME/lib/retrace.jar" "$@"
42 changes: 42 additions & 0 deletions third_party/java/proguard/proguard5.3.3/buildscripts/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier
==========================================================================

This directory contains a number of alternative ways to build ProGuard:

- build.sh : a shell script for GNU/Linux
- makefile : a makefile for GNU/Linux
- build.gradle : a Gradle build file for all platforms
- build.xml : an Ant build file for all platforms
- maven/pom.xml : a Maven POM for building the Maven artifacts

- As a final alternative, you can also easily compile the code from the
command line:

mkdir classes
javac -sourcepath src -d classes src/proguard/ProGuard.java
javac -sourcepath src -d classes src/proguard/gui/ProGuardGUI.java
javac -sourcepath src -d classes src/proguard/retrace/ReTrace.java

For the ProGuard Gradle task:

javac -sourcepath src -d classes -classpath ..... \
src/proguard/gradle/ProGuardTask.java

For the ProGuard Ant task:

javac -sourcepath src -d classes -classpath lib/ant.jar \
src/proguard/ant/ProGuardTask.java

For the Java Micro Edition Wireless Tool Kit (JME WTK) obfuscator plug-in:

javac -sourcepath src -d classes -classpath wtklib/kenv.zip \
src/proguard/wtk/ProGuardObfuscator.java

Depending on the scripts, you may still need to install Gradle, Ant, Maven,
and the JME WTK yourself.

Enjoy!

http://proguard.sourceforge.net/

Copyright (c) 2002-2017 Eric Lafortune @ GuardSquare
111 changes: 111 additions & 0 deletions third_party/java/proguard/proguard5.3.3/buildscripts/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
apply plugin: 'java'

defaultTasks 'proguardJar', 'retraceJar', 'proguardguiJar'

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

sourceSets {
proguard {
java {
srcDirs = ['../src']
exclude 'proguard/gui/**'
exclude 'proguard/retrace/**'
exclude 'proguard/ant/**'
exclude 'proguard/gradle/**'
exclude 'proguard/wtk/**'
}
}

retrace {
java {
srcDirs = ['../src']
include 'proguard/retrace/**'
}
}

anttask {
java {
srcDirs = ['../src']
include 'proguard/ant/**'
}
resources {
srcDirs = ['../src']
include 'proguard/ant/**.properties'
}
}

gradletask {
java {
srcDirs = ['../src']
include 'proguard/gradle/**'
}
}

proguardgui {
java {
srcDirs = ['../src']
include 'proguard/gui/**'
}
resources {
srcDirs = ['../src']
include 'proguard/gui/**.properties'
include 'proguard/gui/**.pro'
include 'proguard/gui/**.png'
include 'proguard/gui/**.gif'
}
}
}

repositories {
mavenCentral()
}

dependencies {
retraceCompile sourceSets.proguard.output
anttaskCompile sourceSets.proguard.output
anttaskCompile 'org.apache.ant:ant:1.7.0'
gradletaskCompile sourceSets.proguard.output
gradletaskCompile gradleApi()
gradletaskCompile localGroovy()
proguardguiCompile sourceSets.proguard.output
proguardguiCompile sourceSets.retrace.output
}

task proguardJar(type: Jar) {
from sourceSets.proguard.output
from sourceSets.anttask.output
from sourceSets.gradletask.output
destinationDir = file('../lib')
baseName = 'proguard'

manifest.from '../src/proguard/MANIFEST.MF'

// Delete the original jar first, otherwise the
// jar task will not overwrite the file.
file('../lib/proguard.jar').delete()
}

task retraceJar(type: Jar) {
from sourceSets.retrace.output
destinationDir = file('../lib')
baseName = 'retrace'

manifest.from '../src/proguard/retrace/MANIFEST.MF'

// Delete the original jar first, otherwise the
// jar task will not overwrite the file.
file('../lib/retrace.jar').delete()
}

task proguardguiJar(type: Jar) {
from sourceSets.proguardgui.output
destinationDir = file('../lib')
baseName = 'proguardgui'

manifest.from '../src/proguard/gui/MANIFEST.MF'

// Delete the original jar first, otherwise the
// jar task will not overwrite the file.
file('../lib/proguardgui.jar').delete()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ant build properties for ProGuard.

gradle.home = /usr/local/java/gradle
wtk.home = /usr/local/java/wtk
Loading

0 comments on commit b4ebfd7

Please sign in to comment.