diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1c761363 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +gradlew -text +gradlew.bat -text diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml new file mode 100644 index 00000000..91c05c74 --- /dev/null +++ b/.github/workflows/continuous_integration.yml @@ -0,0 +1,24 @@ +name: Continuous Integration +on: [pull_request, push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PROGUARD_CORE_PERSONAL_ACCESS_TOKEN }} + path: proguard-main + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PROGUARD_CORE_PERSONAL_ACCESS_TOKEN }} + repository: Guardsquare/proguard-core + ref: github-workflow + path: proguard-core + - uses: actions/setup-java@v1 + with: + java-version: 8 + - uses: eskatos/gradle-command-action@v1 + with: + build-root-directory: proguard-main/ + wrapper-directory: proguard-main/ + arguments: --include-build ../proguard-core/ jar diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 2ebcc6dd..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "core"] - path = core - url = ../proguard-core.git diff --git a/README.md b/README.md index 2aa3b394..f3041d38 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Continuous Deployment](https://github.com/Guardsquare/proguard-clone/workflows/Continuous%20Deployment/badge.svg?branch=github-workflow) + ProGuard, Java bytecode optimizer and obfuscator ================================================ diff --git a/annotations/build.gradle b/annotations/build.gradle index b7cfc49e..79c01790 100644 --- a/annotations/build.gradle +++ b/annotations/build.gradle @@ -1,6 +1,7 @@ -// Gradle build script for the ProGuard annotations. - -apply plugin: 'java' +plugins { + id 'java' + id 'maven-publish' +} sourceCompatibility = "${target}" targetCompatibility = "${target}" diff --git a/annotations/build.sh b/annotations/build.sh deleted file mode 100755 index 004251b9..00000000 --- a/annotations/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for ProGuard. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.annotation.* - -compile $MAIN_CLASS && \ -createjar "$ANNOTATIONS_JAR" || exit 1 diff --git a/annotations/gradle.properties b/annotations/gradle.properties deleted file mode 100644 index 5c1d171a..00000000 --- a/annotations/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Gradle build properties for the ProGuard annotations. - -target = 1.8 diff --git a/annotations/pom.xml b/annotations/pom.xml deleted file mode 100644 index c1516eb1..00000000 --- a/annotations/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-annotations - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - maven-javadoc-plugin - - - - diff --git a/ant/build.gradle b/ant/build.gradle index 701503a7..237736c7 100644 --- a/ant/build.gradle +++ b/ant/build.gradle @@ -1,6 +1,7 @@ -// Gradle build script for the ProGuard Ant task. - -apply plugin: 'java' +plugins { + id 'java' + id 'maven-publish' +} repositories { jcenter() @@ -24,6 +25,6 @@ sourceSets.main { dependencies { compile project(':base') - compile project(':core') + compile 'net.sf.proguard:proguard-core' compile 'org.apache.ant:ant:1.9.7' } diff --git a/ant/build.sh b/ant/build.sh deleted file mode 100755 index b2cbb120..00000000 --- a/ant/build.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for the ProGuard Ant task. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.ant.ProGuardTask - -ANT_HOME=${ANT_HOME:-/usr/local/java/ant} - -ANT_JAR=$ANT_HOME/lib/ant.jar - -# Make sure the Ant jar is present. -if [ ! -f "$ANT_JAR" ]; then - echo "Please make sure the environment variable ANT_HOME is set correctly," - echo "if you want to compile the optional ProGuard Ant task." - exit 1 -fi - -# Make sure ProGuard has been compiled. -if [[ ! -d ../base/$OUT || ! -f "$PROGUARD_JAR" ]]; then - ../base/build.sh || exit 1 -fi - -compile $MAIN_CLASS "../base/$OUT:../core/$OUT:$ANT_JAR" && \ -updatejar "$PROGUARD_JAR" || exit 1 diff --git a/ant/gradle.properties b/ant/gradle.properties deleted file mode 100644 index 0f2d7732..00000000 --- a/ant/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Gradle build properties for the ProGuard Ant task. - -target = 1.8 diff --git a/ant/pom.xml b/ant/pom.xml deleted file mode 100644 index 5d3e902c..00000000 --- a/ant/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-anttask - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - - true - - - - - - maven-javadoc-plugin - - - - - src - - **/*.java - - - - - - - - ${project.groupId} - proguard-base - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - diff --git a/ant/settings.gradle b/ant/settings.gradle deleted file mode 100644 index d003d95c..00000000 --- a/ant/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -includeFlat 'core' -includeFlat 'base' diff --git a/base/build.gradle b/base/build.gradle index a6296cd4..cde41903 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -1,6 +1,7 @@ -// Gradle build script for ProGuard. - -apply plugin: 'java' +plugins { + id 'java' + id 'maven-publish' +} repositories { jcenter() @@ -28,6 +29,6 @@ jar { dependencies { - compile project(':core') + compile 'net.sf.proguard:proguard-core' compile "com.google.code.gson:gson:${gsonVersion}" } diff --git a/base/build.sh b/base/build.sh deleted file mode 100755 index cd986259..00000000 --- a/base/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for ProGuard. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.ProGuard - -GSON_VERSION=2.8.5 -GSON_URL=https://jcenter.bintray.com/com/google/code/gson/gson/${GSON_VERSION}/gson-${GSON_VERSION}.jar -GSON_JAR=$LIB/gson-${GSON_VERSION}.jar - -# Make sure the ProGuard core has been compiled. -if [[ ! -d ../core/$OUT || ! -f "$PROGUARD_JAR" ]]; then - ../core/build.sh || exit 1 -fi - -# Compile and package. -download "$GSON_URL" "$GSON_JAR" && \ -compile $MAIN_CLASS "../core/$OUT:$GSON_JAR" && \ -updatejar "$PROGUARD_JAR" || exit 1 diff --git a/base/gradle.properties b/base/gradle.properties deleted file mode 100644 index e8cc261c..00000000 --- a/base/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Gradle build properties for ProGuard. - -target = 1.8 - -gsonVersion = 2.8.5 diff --git a/base/pom.xml b/base/pom.xml deleted file mode 100644 index b9bb211b..00000000 --- a/base/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-base - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - - proguard.ProGuard - - - - - - maven-javadoc-plugin - - - - - - - ${project.groupId} - proguard-core - ${project.version} - - - com.google.code.gson - gson - 2.8.5 - provided - - - - - jcenter - https://jcenter.bintray.com - - - diff --git a/base/settings.gradle b/base/settings.gradle deleted file mode 100644 index 55d8d75b..00000000 --- a/base/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -includeFlat 'core' diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..41be1934 --- /dev/null +++ b/build.gradle @@ -0,0 +1,144 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + id 'com.github.johnrengelman.shadow' + id 'maven-publish' + id 'signing' +} + +allprojects { + group = 'net.sf.proguard' + version = '7.0.0' +} + +wrapper { + gradleVersion = '6.4' + distributionType = Wrapper.DistributionType.ALL +} + +configurations { + proguard { + transitive = false + } +} + +dependencies { + proguard 'net.sf.proguard:proguard-core' + proguard project(':base') + proguard project(':gradle-plugin') + proguard project(':ant') +} + +// todo: inline manifest + +task jar(type: ShadowJar) { + manifest.from "$rootDir/base/src/META-INF/MANIFEST.MF" + configurations = [project.configurations.proguard] +} + +allprojects { Project project -> + pluginManager.withPlugin('maven-publish') { + def publicationName = project.name + configure(project) { + publishing { + publications { + create(publicationName, MavenPublication) { + pom { + name = "[$group] $artifactId" + developers { + developer { + id = 'lafortune' + name = 'Eric Lafortune' + url = 'https://www.guardsquare.com/proguard' + organization = 'Guardsquare' + organizationUrl = 'https://www.guardsquare.com/' + roles = ['Project Administrator', 'Developer'] + } + } + } + } + } + repositories { + maven { + name = 'Github' + url = uri('https://maven.pkg.github.com/guardsquare/proguard-core') + credentials { + username = project.findProperty('PROGUARD_GITHUB_USERNAME') + password = project.findProperty('PROGUARD_GITHUB_TOKEN') + } + } + maven { + url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + credentials(PasswordCredentials) { + username = findProperty('PROGUARD_STAGING_USERNAME') + password = findProperty('PROGUARD_STAGING_PASSWORD') + } + } + } + } + // We use in-memory ascii-armored keys + // See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys + signing { + String key = findProperty('PROGUARD_SIGNING_KEY') + String password = findProperty('PROGUARD_SIGNING_PASSWORD') + useInMemoryPgpKeys(key, password) + sign publishing.publications.getByName(publicationName) + } + } + } +} + +allprojects { Project project -> + afterEvaluate { + if (pluginManager.hasPlugin('java') && pluginManager.hasPlugin('maven-publish')) { + configure(project) { + javadoc { + options.addStringOption('Xdoclint:none', '-quiet') + } + java { + withJavadocJar() + withSourcesJar() + } + publishing { + publications { + getByName(project.name) { + from components.java + // Do not change artifact ID if already overriden at project level. + if (artifactId == project.name) { + artifactId = "proguard-$project.name" + } + } + } + } + } + } + } +} + +publishing { + publications { + parent { + artifactId = "proguard-parent" + artifact(jar) + pom { + description = 'ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier.' + url = 'https://www.guardsquare.com/proguard' + licenses { + license { + name = 'GNU General Public License, Version 2' + url = 'https://www.gnu.org/licenses/gpl-2.0.txt' + distribution = 'repo' + } + } + issueManagement { + system = 'Github Tracker' + url = 'https://github.com/Guardsquare/proguard/issues' + } + scm { + url = 'https://github.com/Guardsquare/proguard.git' + connection = 'scm:git:https://github.com/Guardsquare/proguard.git' + } + } + } + } +} diff --git a/buildscripts/README b/buildscripts/README deleted file mode 100644 index 2a1c9f8d..00000000 --- a/buildscripts/README +++ /dev/null @@ -1,22 +0,0 @@ -ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier -========================================================================== - -This directory contains a number of alternative ways to build ProGuard: - -- build.gradle : a Gradle build file for all platforms - - gradle clean assemble - -- pom.xml: a Maven POM for building the Maven artifacts - - mvn clean package - -- build.sh: a simple and fast shell script for GNU/Linux. - - ./build.sh - -Pick your favorite build tool and enjoy! - -https://www.guardsquare.com/proguard - -Copyright (c) 2002-2020 Guardsquare NV diff --git a/buildscripts/build.gradle b/buildscripts/build.gradle deleted file mode 100644 index 8b395c8b..00000000 --- a/buildscripts/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -// Gradle build script for all ProGuard jars. - -task clean { - delete fileTree('../lib') -} - -// Collect the main ProGuard jar. - -task assembleProguardJar(type: Jar) { - destinationDir = file('../lib') - baseName = 'proguard' - - manifest.from '../base/src/META-INF/MANIFEST.MF' -} - -def proguardSubprojects = - [':core', ':base', ':gradle', ':ant', ':wtk'].collect{ project(it) } - -proguardSubprojects.each { subproject -> - subproject.afterEvaluate { - assembleProguardJar.dependsOn subproject.tasks['jar'] - assembleProguardJar.from subproject.configurations.archives.artifacts.files.collect { zipTree(it) } - } -} - -// Copy the ReTrace jar. - -task copyRetraceJar(type: Copy) { - into '../lib' -} - -project(':retrace').afterEvaluate { - copyRetraceJar.from it.tasks['jar'] -} - -// Copy the GUI jar. - -task copyGuiJar(type: Copy) { - into '../lib' - rename 'gui.jar', 'proguardgui.jar' -} - -project(':gui').afterEvaluate { - copyGuiJar.from it.tasks['jar'] -} - -// Copy the annotations jar. - -task copyAnnotationsJar(type: Copy) { - into '../lib' -} - -project(':annotations').afterEvaluate { - copyAnnotationsJar.from it.tasks['jar'] -} - -// Assemble or copy all jars. - -task assemble { - dependsOn assembleProguardJar - dependsOn copyRetraceJar - dependsOn copyGuiJar - dependsOn copyAnnotationsJar -} diff --git a/buildscripts/build.sh b/buildscripts/build.sh deleted file mode 100755 index 01f4a70f..00000000 --- a/buildscripts/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for ProGuard. - -cd $(dirname "$0") - -# Standard modules. -../core/build.sh && \ -../base/build.sh && \ -../retrace/build.sh && \ -../gui/build.sh && \ -../annotations/build.sh || exit 1 - -# Optional modules. -../gradle/build.sh -../ant/build.sh -../wtk/build.sh diff --git a/buildscripts/functions.sh b/buildscripts/functions.sh deleted file mode 100755 index fe91de01..00000000 --- a/buildscripts/functions.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# Support functions for building ProGuard. - -SRC=src -OUT=out -LIB=../lib - -TARGET=1.8 - -PROGUARD_JAR=$LIB/proguard.jar -RETRACE_JAR=$LIB/retrace.jar -PROGUARD_GUI_JAR=$LIB/proguardgui.jar -ANNOTATIONS_JAR=$LIB/annotations.jar - -set -o pipefail - -function download { - if [ ! -f "$2" ]; then - echo "Downloading $2..." - mkdir -p $(dirname "$2") && \ - if type wget > /dev/null 2>&1; then - wget -O "$2" "$1" - else - curl -L -o "$2" "$1" - fi - fi -} - -function compile { - echo "Compiling $(basename $PWD) ($1)..." - mkdir -p "$OUT" && \ - - # Compile Java source files. - find $SRC -name '_*.java' -o -path "$SRC/${1//.//}.java" \ - | xargs --no-run-if-empty \ - javac -nowarn -Xlint:none \ - -source $TARGET -target $TARGET \ - -sourcepath "$SRC" -d "$OUT" \ - ${2:+-classpath "$2"} 2>&1 \ - | sed -e 's|^| |' || return 1 - - # Compile Kotlin source files. - #find $SRC -path "$SRC/${1//.//}.kotlin" \ - #| xargs --no-run-if-empty \ - # kotlinc -nowarn -jvm-target $TARGET \ - # -d "$OUT" \ - # ${2:+-classpath "$2"} 2>&1 \ - #| sed -e 's|^| |' || return 1 - - # Compile Groovy source files. - find $SRC -path "$SRC/${1//.//}.groovy" \ - | xargs --no-run-if-empty \ - groovyc \ - -sourcepath "$SRC" -d "$OUT" \ - ${2:+-classpath "$2"} 2>&1 \ - | sed -e 's|^| |' || return 1 - - # Copy resource files. - (cd "$SRC" && \ - find proguard \ - \( -name \*.properties -o -name \*.png -o -name \*.gif -o -name \*.pro \) \ - -exec cp --parents {} "../$OUT" \; ) -} - -function createjar { - echo "Creating $1..." - mkdir -p $(dirname "$1") && \ - if [ -f "$SRC/META-INF/MANIFEST.MF" ]; then - jar -cfm "$1" "$SRC/META-INF/MANIFEST.MF" -C "$OUT" proguard - else - jar -cf "$1" -C "$OUT" proguard - fi -} - -function updatejar { - echo "Updating $1..." - if [ -f "$SRC/META-INF/MANIFEST.MF" ]; then - jar -ufm "$1" "$SRC/META-INF/MANIFEST.MF" -C "$OUT" proguard - else - jar -uf "$1" -C "$OUT" proguard - fi -} diff --git a/buildscripts/gradle.properties b/buildscripts/gradle.properties deleted file mode 100644 index c330c663..00000000 --- a/buildscripts/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Gradle build properties for all ProGuard jars. - -target = 1.8 - -wtkDir = /usr/local/java/wtk2.1 diff --git a/buildscripts/pom.xml b/buildscripts/pom.xml deleted file mode 100644 index 8dc467bb..00000000 --- a/buildscripts/pom.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - pom - [${project.groupId}] ${project.artifactId} - ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. - https://www.guardsquare.com/proguard - - - 3 - - - - - lafortune - Eric Lafortune - https://www.guardsquare.com/proguard - Guardsquare - https://www.guardsquare.com/ - - Project Administrator - Developer - - - - - - - GNU General Public License, Version 2 - https://www.gnu.org/licenses/gpl-2.0.txt - repo - - - - - Github Tracker - https://github.com/Guardsquare/proguard/issues - - - - https://github.com/Guardsquare/proguard.git - scm:git:https://github.com/Guardsquare/proguard.git - - - - UTF-8 - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - package - - jar - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - https://download.oracle.com/javase/1.5.0/docs/api/ - - true - - - - attach-javadoc - package - - jar - - - -Xdoclint:none - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - - - ../core - ../base - ../retrace - ../gui - ../gradle - ../ant - ../annotations - - - - - __wtk_plugin_build__ - - - ${wtk.home}/wtklib/kenv.zip - - - - ../wtk - - - - - - - sonatype-nexus-staging - Nexus Release Repository - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - diff --git a/buildscripts/settings.gradle b/buildscripts/settings.gradle deleted file mode 100644 index 48791f0e..00000000 --- a/buildscripts/settings.gradle +++ /dev/null @@ -1,13 +0,0 @@ -includeFlat 'core' -includeFlat 'base' -includeFlat 'retrace' -includeFlat 'gui' -includeFlat 'gradle' -includeFlat 'ant' -includeFlat 'annotations' - -if (file(wtkDir).isDirectory()) { - includeFlat 'wtk' -} else { - System.err.println "Can't find the WTK directory [${wtkDir}]. Not building the WTK plugin." -} diff --git a/core b/core deleted file mode 160000 index 8c2dedef..00000000 --- a/core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8c2dedef0b19517fa8e7caeab8d6ed64a496f8bb diff --git a/docs/md/building.md b/docs/md/building.md index 936dabe7..40c589b5 100644 --- a/docs/md/building.md +++ b/docs/md/building.md @@ -1,19 +1,21 @@ -If you've downloaded the source code of **ProGuard**, you can build it in a -number of ways: +If you've downloaded the source code of **ProGuard**, you can build it +yourself with Gradle: -- build.gradle : a Gradle build file for all platforms. +- Build the artifacts: + ``` + gradle assemble + ``` - cd buildscripts - gradle clean assemble +- Build the artifacts when you also have a personal copy of the ProGuard Core + library: + ``` + gradle --include-build assemble + ``` -- pom.xml: a Maven POM for all platforms. - - cd buildscripts - mvn clean package - -- build.sh: a simple and fast shell script for GNU/Linux. - - buildscripts/build.sh +- Publish the artifacts to your local Maven cache (something like `~/.m2/`): + ``` + gradle publishToMavenLocal + ``` Once built, you can [run ProGuard](manual/index.md) with the scripts in the `bin` directory. diff --git a/gradle/build.gradle b/gradle-plugin/build.gradle similarity index 72% rename from gradle/build.gradle rename to gradle-plugin/build.gradle index 89bcbff7..3f797ba0 100644 --- a/gradle/build.gradle +++ b/gradle-plugin/build.gradle @@ -1,7 +1,8 @@ -// Gradle build script for the ProGuard Gradle task and plugin. - -apply plugin: 'java' -apply plugin: 'groovy' +plugins { + id 'java' + id 'groovy' + id 'maven-publish' +} repositories { google() @@ -40,8 +41,16 @@ repositories { dependencies { compile project(':base') - compile project(':core') + compile 'net.sf.proguard:proguard-core' compile('com.android.tools.build:gradle:3.0.0') compile gradleApi() compile localGroovy() } + +publishing { + publications { + getByName('gradle-plugin') { + artifactId = 'proguard-gradle' + } + } +} diff --git a/gradle/src/META-INF/gradle-plugins/proguard.properties b/gradle-plugin/src/META-INF/gradle-plugins/proguard.properties similarity index 100% rename from gradle/src/META-INF/gradle-plugins/proguard.properties rename to gradle-plugin/src/META-INF/gradle-plugins/proguard.properties diff --git a/gradle/src/proguard/gradle/GradleUtil.groovy b/gradle-plugin/src/proguard/gradle/GradleUtil.groovy similarity index 100% rename from gradle/src/proguard/gradle/GradleUtil.groovy rename to gradle-plugin/src/proguard/gradle/GradleUtil.groovy diff --git a/gradle/src/proguard/gradle/ProGuardConvention.groovy b/gradle-plugin/src/proguard/gradle/ProGuardConvention.groovy similarity index 100% rename from gradle/src/proguard/gradle/ProGuardConvention.groovy rename to gradle-plugin/src/proguard/gradle/ProGuardConvention.groovy diff --git a/gradle/src/proguard/gradle/ProGuardExtension.groovy b/gradle-plugin/src/proguard/gradle/ProGuardExtension.groovy similarity index 100% rename from gradle/src/proguard/gradle/ProGuardExtension.groovy rename to gradle-plugin/src/proguard/gradle/ProGuardExtension.groovy diff --git a/gradle/src/proguard/gradle/ProGuardPlugin.groovy b/gradle-plugin/src/proguard/gradle/ProGuardPlugin.groovy similarity index 100% rename from gradle/src/proguard/gradle/ProGuardPlugin.groovy rename to gradle-plugin/src/proguard/gradle/ProGuardPlugin.groovy diff --git a/gradle/src/proguard/gradle/ProGuardTask.java b/gradle-plugin/src/proguard/gradle/ProGuardTask.java similarity index 100% rename from gradle/src/proguard/gradle/ProGuardTask.java rename to gradle-plugin/src/proguard/gradle/ProGuardTask.java diff --git a/gradle/src/proguard/gradle/ProGuardTransform.groovy b/gradle-plugin/src/proguard/gradle/ProGuardTransform.groovy similarity index 100% rename from gradle/src/proguard/gradle/ProGuardTransform.groovy rename to gradle-plugin/src/proguard/gradle/ProGuardTransform.groovy diff --git a/gradle/src/proguard/gradle/proguard-android-common.pro b/gradle-plugin/src/proguard/gradle/proguard-android-common.pro similarity index 100% rename from gradle/src/proguard/gradle/proguard-android-common.pro rename to gradle-plugin/src/proguard/gradle/proguard-android-common.pro diff --git a/gradle/src/proguard/gradle/proguard-android-debug.pro b/gradle-plugin/src/proguard/gradle/proguard-android-debug.pro similarity index 100% rename from gradle/src/proguard/gradle/proguard-android-debug.pro rename to gradle-plugin/src/proguard/gradle/proguard-android-debug.pro diff --git a/gradle/src/proguard/gradle/proguard-android-release-optimize.pro b/gradle-plugin/src/proguard/gradle/proguard-android-release-optimize.pro similarity index 100% rename from gradle/src/proguard/gradle/proguard-android-release-optimize.pro rename to gradle-plugin/src/proguard/gradle/proguard-android-release-optimize.pro diff --git a/gradle/src/proguard/gradle/proguard-android-release.pro b/gradle-plugin/src/proguard/gradle/proguard-android-release.pro similarity index 100% rename from gradle/src/proguard/gradle/proguard-android-release.pro rename to gradle-plugin/src/proguard/gradle/proguard-android-release.pro diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..ce0582ef --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +gsonVersion = 2.8.5 +kotlinVersion = 1.3.31 +kotlinxMetadataVersion = 0.1.0 +target = 1.8 +wtkDir = /usr/local/java/wtk2.1 +wtkHome = /usr/local/java/wtk \ No newline at end of file diff --git a/gradle/build.sh b/gradle/build.sh deleted file mode 100755 index be366c5a..00000000 --- a/gradle/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for the ProGuard Gradle task. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.gradle.ProGuardTask - -GRADLE_HOME=${GRADLE_HOME:-/usr/local/java/gradle} - -GRADLE_PATH=\ -$(echo $GRADLE_HOME/lib/plugins/gradle-plugins-*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-logging-*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-base-services-?.*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-base-services-groovy-*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-model-core-*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-core-[0-9]*.jar):\ -$(echo $GRADLE_HOME/lib/gradle-core-api-*.jar):\ -$(echo $GRADLE_HOME/lib/groovy-all-*.jar):\ -$(echo $GRADLE_HOME/lib/slf4j-api-*.jar) - -# Make sure the Gradle jars are present. -if [ ! -f "${GRADLE_PATH%%:*}" ]; then - echo "Please make sure the environment variable GRADLE_HOME is set correctly," - echo "if you want to compile the optional ProGuard Gradle task." - exit 1 -fi - -# Make sure the ProGuard base has been compiled. -if [ ! -d ../base/$OUT ]; then - ../base/build.sh || exit 1 -fi - -# Compile and package. -export CLASSPATH=../base/$OUT:../core/$OUT:$GRADLE_PATH - -compile $MAIN_CLASS && \ -updatejar "$PROGUARD_JAR" || exit 1 diff --git a/gradle/gradle.properties b/gradle/gradle.properties deleted file mode 100644 index 49184bb6..00000000 --- a/gradle/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Gradle build properties for the ProGuard Gradle task. - -target = 1.8 diff --git a/gradle/pom.xml b/gradle/pom.xml deleted file mode 100644 index 112ba29a..00000000 --- a/gradle/pom.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-gradle - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - groovy-eclipse-compiler - - - - org.codehaus.groovy - groovy-eclipse-compiler - 2.9.2-01 - - - org.codehaus.groovy - groovy-eclipse-batch - 2.4.3-01 - - - - - maven-jar-plugin - - - - true - - - - - - maven-javadoc-plugin - - - - - src - - **/*.java - META-INF/MANIFEST.MF - - - - - - - - ${project.groupId} - proguard-base - ${project.version} - - - com.android.tools.build - gradle - 3.0.0 - provided - - - org.gradle - gradle-base-services - 6.0.1 - provided - - - org.gradle - gradle-base-services-groovy - 6.0.1 - provided - - - org.gradle - gradle-core - 6.0.1 - provided - - - org.gradle - gradle-core-api - 6.0.1 - provided - - - org.gradle - gradle-language-java - 6.0.1 - provided - - - org.gradle - gradle-logging - 6.0.1 - provided - - - org.gradle - gradle-model-core - 6.0.1 - provided - - - org.gradle - gradle-process-services - 6.0.1 - provided - - - org.gradle - gradle-workers - 6.0.1 - provided - - - org.codehaus.groovy - groovy-all - 2.4.7 - provided - - - org.slf4j - slf4j-api - 1.7.25 - provided - - - - - google - https://maven.google.com - - - jcenter - https://jcenter.bintray.com - - - repo.gradle.org - https://repo.gradle.org/gradle/libs-releases-local/ - - - diff --git a/gradle/settings.gradle b/gradle/settings.gradle deleted file mode 100644 index d003d95c..00000000 --- a/gradle/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -includeFlat 'core' -includeFlat 'base' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..f3d88b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..fd0c5a38 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..2fe81a7d --- /dev/null +++ b/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/gui/build.gradle b/gui/build.gradle index 27254ae7..2488079e 100644 --- a/gui/build.gradle +++ b/gui/build.gradle @@ -1,6 +1,7 @@ -// Gradle build script for the ProGuard GUI. - -apply plugin: 'java' +plugins { + id 'java' + id 'maven-publish' +} repositories { jcenter() @@ -24,7 +25,7 @@ sourceSets.main { dependencies { compile project(':base') - compile project(':core') + compile 'net.sf.proguard:proguard-core' compile project(':retrace') } diff --git a/gui/build.sh b/gui/build.sh deleted file mode 100755 index c9dc496c..00000000 --- a/gui/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for the ProGuard GUI. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.gui.ProGuardGUI - -# Make sure ProGuard has been compiled. -if [[ ! -d ../base/$OUT || ! -f "$PROGUARD_JAR" ]]; then - ../base/build.sh || exit 1 -fi - -# Make sure ReTrace has been compiled. -if [[ ! -d ../retrace/$OUT || ! -f "$RETRACE_JAR" ]]; then - ../retrace/build.sh || exit 1 -fi - -compile $MAIN_CLASS "../base/$OUT:../core/$OUT:../retrace/$OUT" && \ -createjar "$PROGUARD_GUI_JAR" || exit 1 diff --git a/gui/gradle.properties b/gui/gradle.properties deleted file mode 100644 index aaf2da2b..00000000 --- a/gui/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Gradle build properties for the ProGuard GUI. - -target = 1.8 diff --git a/gui/pom.xml b/gui/pom.xml deleted file mode 100644 index abd8d80a..00000000 --- a/gui/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-gui - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - - true - proguard.gui.ProGuardGUI - - - - - - maven-javadoc-plugin - - - - - src - - **/*.java - META-INF/MANIFEST.MF - - - - - - - ${project.groupId} - proguard-base - ${project.version} - - - ${project.groupId} - proguard-retrace - ${project.version} - - - diff --git a/gui/settings.gradle b/gui/settings.gradle deleted file mode 100644 index 2ae29b1f..00000000 --- a/gui/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -includeFlat 'core' -includeFlat 'base' -includeFlat 'retrace' diff --git a/retrace/build.gradle b/retrace/build.gradle index fea2f5a0..88945e78 100644 --- a/retrace/build.gradle +++ b/retrace/build.gradle @@ -1,6 +1,7 @@ -// Gradle build script for ReTrace. - -apply plugin: 'java' +plugins { + id 'java' + id 'maven-publish' +} repositories { jcenter() @@ -24,7 +25,7 @@ sourceSets.main { dependencies { compile project(':base') - compile project(':core') + compile 'net.sf.proguard:proguard-core' } jar { diff --git a/retrace/build.sh b/retrace/build.sh deleted file mode 100755 index 6c7725cb..00000000 --- a/retrace/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for ReTrace. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.retrace.ReTrace - -# Make sure ProGuard has been compiled. -if [[ ! -d ../base/$OUT || - ! -d ../core/$OUT || - ! -f "$PROGUARD_JAR" ]]; then - ../base/build.sh || exit 1 -fi - -compile $MAIN_CLASS "../base/$OUT:../core/$OUT" && \ -createjar "$RETRACE_JAR" || exit 1 diff --git a/retrace/gradle.properties b/retrace/gradle.properties deleted file mode 100644 index c4b30736..00000000 --- a/retrace/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Gradle build properties for ReTrace. - -target = 1.8 diff --git a/retrace/pom.xml b/retrace/pom.xml deleted file mode 100644 index 6d65a8c2..00000000 --- a/retrace/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-retrace - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - - true - proguard.retrace.ReTrace - - - - - - maven-javadoc-plugin - - - - - - ${project.groupId} - proguard-base - ${project.version} - - - diff --git a/retrace/settings.gradle b/retrace/settings.gradle deleted file mode 100644 index d003d95c..00000000 --- a/retrace/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -includeFlat 'core' -includeFlat 'base' diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..372ea8b9 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,18 @@ +pluginManagement { + resolutionStrategy { + eachPlugin { + if (requested.id.id == 'com.github.johnrengelman.shadow') { + useVersion '5.2.0' + } + } + } +} + +rootProject.name = 'parent' + +include 'base' +include 'retrace' +include 'gui' +include 'gradle-plugin' +include 'ant' +include 'annotations' diff --git a/wtk/build.gradle b/wtk/build.gradle deleted file mode 100644 index bb1d12a3..00000000 --- a/wtk/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -// Gradle build script for the ProGuard Wireless Toolkit plugin. - -apply plugin: 'java' - -repositories { - jcenter() -} - -sourceCompatibility = "${target}" -targetCompatibility = "${target}" - -sourceSets.main { - java { - srcDirs = ['src'] - } - resources { - srcDirs = ['src'] - include '**/*.properties' - include '**/*.gif' - include '**/*.png' - include '**/*.pro' - } -} - -dependencies { - compile project(':base') - compile project(':core') - compile files("${wtkHome}/wtklib/kenv.zip") -} diff --git a/wtk/build.sh b/wtk/build.sh deleted file mode 100755 index 8fbb9dc8..00000000 --- a/wtk/build.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# GNU/Linux build script for the ProGuard Wireless Toolkit plugin. - -cd $(dirname "$0") - -source ../buildscripts/functions.sh - -MAIN_CLASS=proguard.wtk.ProGuardObfuscator - -WTK_HOME=${WTK_HOME:-/usr/local/java/wtk} - -WTK_JAR=$WTK_HOME/wtklib/kenv.zip - -# Make sure the WTK jar is present. -if [ ! -f "$WTK_JAR" ]; then - echo "Please make sure the environment variable WTK_HOME is set correctly," - echo "if you want to compile the optional ProGuard WTK plugin." - exit 1 -fi - -# Make sure ProGuard has been compiled. -if [[ ! -d ../base/$OUT || - ! -d ../core/$OUT || - ! -f "$PROGUARD_JAR" ]]; then - ../base/build.sh || exit 1 -fi - -compile $MAIN_CLASS "../base/$OUT:../core/$OUT:$WTK_JAR" && \ -updatejar "$PROGUARD_JAR" || exit 1 diff --git a/wtk/gradle.properties b/wtk/gradle.properties deleted file mode 100644 index a1e7cdbd..00000000 --- a/wtk/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Gradle build properties for the ProGuard Wireless Toolkit plugin. - -target = 1.8 - -wtkHome = /usr/local/java/wtk diff --git a/wtk/pom.xml b/wtk/pom.xml deleted file mode 100644 index b4c80c04..00000000 --- a/wtk/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - - net.sf.proguard - proguard-parent - 7.0.0 - ../buildscripts/pom.xml - - proguard-wtk-plugin - [${project.groupId}] ${project.artifactId} - - - src - - - maven-source-plugin - - - maven-compiler-plugin - - - maven-jar-plugin - - - - true - - - - - - maven-javadoc-plugin - - - - - src - - **/*.java - - - - - - - - ${project.groupId} - proguard-base - ${project.version} - - - wtklib - kenv - 2.2 - system - ${wtk.home}/wtklib/kenv.zip - - - diff --git a/wtk/settings.gradle b/wtk/settings.gradle deleted file mode 100644 index d003d95c..00000000 --- a/wtk/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -includeFlat 'core' -includeFlat 'base' diff --git a/wtk/src/proguard/wtk/ProGuardObfuscator.java b/wtk/src/proguard/wtk/ProGuardObfuscator.java deleted file mode 100644 index 62273427..00000000 --- a/wtk/src/proguard/wtk/ProGuardObfuscator.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2020 Guardsquare NV - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package proguard.wtk; - -import com.sun.kvem.environment.Obfuscator; -import proguard.*; - -import java.io.*; - - -/** - * ProGuard plug-in for the J2ME Wireless Toolkit. - *

- * In order to integrate this plug-in in the toolkit, you'll have to put the - * following lines in the file - * {j2mewtk.dir}/wtklib/Linux/ktools.properties or - * {j2mewtk.dir}\wtklib\Windows\ktools.properties (whichever is - * applicable). - *

- *

- * obfuscator.runner.class.name: proguard.wtk.ProGuardObfuscator
- * obfuscator.runner.classpath: /usr/local/java/proguard1.6/lib/proguard.jar
- * 
- * Please make sure the class path is set correctly for your system. - * - * @author Eric Lafortune - */ -public class ProGuardObfuscator implements Obfuscator -{ - private static final String DEFAULT_CONFIGURATION = "default.pro"; - - - // Implementations for Obfuscator. - - public void createScriptFile(File jadFile, - File projectDir) - { - // We don't really need to create a script file; - // we'll just fill out all options in the run method. - } - - - public void run(File obfuscatedJarFile, - String wtkBinDir, - String wtkLibDir, - String jarFileName, - String projectDirName, - String classPath, - String emptyAPI) - throws IOException - { - // Create the ProGuard configuration. - Configuration configuration = new Configuration(); - - // Parse the default configuration file. - ConfigurationParser parser = new ConfigurationParser(this.getClass().getResource(DEFAULT_CONFIGURATION), - System.getProperties()); - - try - { - parser.parse(configuration); - - // Fill out the library class path. - configuration.libraryJars = classPath(classPath); - - // Fill out the program class path (input and output). - configuration.programJars = new ClassPath(); - configuration.programJars.add(new ClassPathEntry(new File(jarFileName), false)); - configuration.programJars.add(new ClassPathEntry(obfuscatedJarFile, true)); - - // The preverify tool seems to unpack the resulting classes, - // so we must not use mixed-case class names on Windows. - configuration.useMixedCaseClassNames = - !System.getProperty("os.name").regionMatches(true, 0, "windows", 0, 7); - - // Run ProGuard with these options. - ProGuard proGuard = new ProGuard(configuration); - proGuard.execute(); - - } - catch (ParseException ex) - { - throw new IOException(ex.getMessage()); - } - finally - { - parser.close(); - } - } - - - /** - * Converts the given class path String into a ClassPath object. - */ - private ClassPath classPath(String classPathString) - { - ClassPath classPath = new ClassPath(); - - String separator = System.getProperty("path.separator"); - - int index = 0; - while (index < classPathString.length()) - { - // Find the next separator, or the end of the String. - int next_index = classPathString.indexOf(separator, index); - if (next_index < 0) - { - next_index = classPathString.length(); - } - - // Create and add the found class path entry. - ClassPathEntry classPathEntry = - new ClassPathEntry(new File(classPathString.substring(index, next_index)), - false); - - classPath.add(classPathEntry); - - // Continue after the separator. - index = next_index + 1; - } - - return classPath; - } -} diff --git a/wtk/src/proguard/wtk/default.pro b/wtk/src/proguard/wtk/default.pro deleted file mode 100644 index d31714f0..00000000 --- a/wtk/src/proguard/wtk/default.pro +++ /dev/null @@ -1,114 +0,0 @@ --dontnote --microedition --mergeinterfacesaggressively --overloadaggressively --repackageclasses '' --allowaccessmodification - -# Keep all extensions of javax.microedition.midlet.MIDlet. --keep public class * extends javax.microedition.midlet.MIDlet - -# Keep all native class/method names. --keepclasseswithmembernames class * { - native ; -} - -# Remove all invocations of System methods without side effects -# whose return values are not used. --assumenosideeffects public class java.lang.System { - public static native long currentTimeMillis(); - static java.lang.Class getCallerClass(); - public static native int identityHashCode(java.lang.Object); - public static java.lang.SecurityManager getSecurityManager(); - public static java.util.Properties getProperties(); - public static java.lang.String getProperty(java.lang.String); - public static java.lang.String getenv(java.lang.String); - public static native java.lang.String mapLibraryName(java.lang.String); - public static java.lang.String getProperty(java.lang.String,java.lang.String); -} - -# Remove all invocations of String methods without side effects -# whose return values are not used. --assumenosideeffects public class java.lang.String { - public java.lang.String(); - public java.lang.String(byte[]); - public java.lang.String(byte[],int); - public java.lang.String(byte[],int,int); - public java.lang.String(byte[],int,int,int); - public java.lang.String(byte[],int,int,java.lang.String); - public java.lang.String(byte[],java.lang.String); - public java.lang.String(char[]); - public java.lang.String(char[],int,int); - public java.lang.String(java.lang.String); - public java.lang.String(java.lang.StringBuffer); - public static java.lang.String copyValueOf(char[]); - public static java.lang.String copyValueOf(char[],int,int); - public static java.lang.String valueOf(boolean); - public static java.lang.String valueOf(char); - public static java.lang.String valueOf(char[]); - public static java.lang.String valueOf(char[],int,int); - public static java.lang.String valueOf(double); - public static java.lang.String valueOf(float); - public static java.lang.String valueOf(int); - public static java.lang.String valueOf(java.lang.Object); - public static java.lang.String valueOf(long); - public boolean contentEquals(java.lang.StringBuffer); - public boolean endsWith(java.lang.String); - public boolean equalsIgnoreCase(java.lang.String); - public boolean equals(java.lang.Object); - public boolean matches(java.lang.String); - public boolean regionMatches(boolean,int,java.lang.String,int,int); - public boolean regionMatches(int,java.lang.String,int,int); - public boolean startsWith(java.lang.String); - public boolean startsWith(java.lang.String,int); - public byte[] getBytes(); - public byte[] getBytes(java.lang.String); - public char charAt(int); - public char[] toCharArray(); - public int compareToIgnoreCase(java.lang.String); - public int compareTo(java.lang.Object); - public int compareTo(java.lang.String); - public int hashCode(); - public int indexOf(int); - public int indexOf(int,int); - public int indexOf(java.lang.String); - public int indexOf(java.lang.String,int); - public int lastIndexOf(int); - public int lastIndexOf(int,int); - public int lastIndexOf(java.lang.String); - public int lastIndexOf(java.lang.String,int); - public int length(); - public java.lang.CharSequence subSequence(int,int); - public java.lang.String concat(java.lang.String); - public java.lang.String replaceAll(java.lang.String,java.lang.String); - public java.lang.String replace(char,char); - public java.lang.String replaceFirst(java.lang.String,java.lang.String); - public java.lang.String[] split(java.lang.String); - public java.lang.String[] split(java.lang.String,int); - public java.lang.String substring(int); - public java.lang.String substring(int,int); - public java.lang.String toLowerCase(); - public java.lang.String toLowerCase(java.util.Locale); - public java.lang.String toString(); - public java.lang.String toUpperCase(); - public java.lang.String toUpperCase(java.util.Locale); - public java.lang.String trim(); -} - - -# Remove all invocations of StringBuffer methods without side effects -# whose return values are not used. --assumenosideeffects public class java.lang.StringBuffer { - public java.lang.StringBuffer(); - public java.lang.StringBuffer(int); - public java.lang.StringBuffer(java.lang.String); - public java.lang.String toString(); - public char charAt(int); - public int capacity(); - public int indexOf(java.lang.String,int); - public int lastIndexOf(java.lang.String); - public int lastIndexOf(java.lang.String,int); - public int length(); - public java.lang.String substring(int); - public java.lang.String substring(int,int); -} diff --git a/wtk/src/proguard/wtk/package.html b/wtk/src/proguard/wtk/package.html deleted file mode 100644 index 6efc6441..00000000 --- a/wtk/src/proguard/wtk/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -This package contains the J2ME Wireless Toolkit plug-in for ProGuard. -