gradle redo (moved each to their own project for organization)

This commit is contained in:
Connor Tumbleson 2013-01-16 16:06:32 -06:00
parent 9281cba4a4
commit 6744b2469c
11 changed files with 361 additions and 150 deletions

20
.gitignore vendored
View File

@ -1,15 +1,13 @@
.gradle/
brut.apktool.smali/baksmali/build*
brut.apktool.smali/build*
brut.apktool.smali/dexlib/build*
brut.apktool.smali/smali/build*
brut.apktool.smali/util/build*
brut.apktool/apktool-cli/build*
brut.apktool/apktool-lib/build*
brut.apktool/build*
build*
brut.apktool.smali/baksmali/build/
brut.apktool.smali/build/
brut.apktool.smali/dexlib/build/
brut.apktool.smali/smali/build/
brut.apktool.smali/util/build/
brut.apktool/apktool-cli/build/
brut.apktool/apktool-lib/build/
brut.apktool/build/
build/
/brut.apktool/nbproject/private/
/brut.apktool.smali/baksmali/nbproject/private/
/brut.apktool.smali/dexlib/nbproject/private/

View File

@ -0,0 +1,49 @@
/*
* Copyright 2012, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
dependencies {
compile project(':brut.apktool.smali:util')
compile project(':brut.apktool.smali:dexlib')
compile 'commons-cli:commons-cli:1.2'
compile 'com.google.code.findbugs:jsr305:1.3.9'
}
processResources.inputs.property('version', version)
processResources.expand('version': version)
// build a jar containing all dependencies
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes("Main-Class": "org.jf.baksmali.main")
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2012, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
dependencies {
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.google.collections:google-collections:1.0'
}

View File

@ -36,30 +36,45 @@ configurations {
}
ext.antlrSource = 'src/main/antlr3'
ext.antlrOutput = file(new File(buildDir, '/generated-sources/antlr3'))
ext.antlrOutput = file("${buildDir}/generated-sources/antlr3")
ext.jflexSource = "src/main/jflex"
ext.jflexOutput = file(new File(buildDir, '/generated-sources/jflex'))
ext.jflexOutput = file("${buildDir}/generated-sources/jflex")
ext.testAntlrSource = 'src/test/antlr3'
ext.testAntlrOutput = file(new File(buildDir, '/generated-test-sources/antlr3'))
ext.testAntlrOutput = file("${buildDir}/generated-test-sources/antlr3")
sourceSets.main.java.srcDir antlrOutput
sourceSets.main.java.srcDir jflexOutput
sourceSets.test.java.srcDir testAntlrOutput
idea {
module {
excludeDirs -= buildDir
if (buildDir.exists()) {
excludeDirs.addAll(buildDir.listFiles())
}
for (sourceDir in (sourceDirs + testSourceDirs)) {
excludeDirs.remove(sourceDir);
while ((sourceDir = sourceDir.getParentFile()) != null) {
excludeDirs.remove(sourceDir);
}
}
}
}
dependencies {
compile project(':brut.apktool.smali:util')
compile project(':brut.apktool.smali:dexlib')
compile 'org.antlr:antlr-runtime:3.2'
compile 'commons-cli:commons-cli:1.2'
compile 'com.google.guava:guava:13.0.1'
testCompile 'junit:junit:4.6'
antlr3 'org.antlr:antlr:3.2'
jflex 'de.jflex:jflex:1.4.3'
proguard 'net.sf.proguard:proguard-base:4.8'
}
task generateAntlrSource(type: JavaExec) {
@ -69,9 +84,9 @@ task generateAntlrSource(type: JavaExec) {
mkdir(antlrOutput)
def grammars = fileTree(antlrSource).include('**/*.g')
classpath = files(configurations.antlr3.asPath)
classpath = configurations.antlr3
main = 'org.antlr.Tool'
args '-fo', relativePath(new File(antlrOutput, 'org/jf/smali'))
args '-fo', relativePath("${antlrOutput}/org/jf/smali")
args grammars.files
}
@ -82,9 +97,9 @@ task generateTestAntlrSource(type: JavaExec) {
mkdir(testAntlrOutput)
def grammars = fileTree(testAntlrSource).include('**/*.g')
classpath = files(configurations.antlr3.asPath)
classpath = configurations.antlr3
main = 'org.antlr.Tool'
args '-fo', relativePath(new File(testAntlrOutput, 'org/jf/smali'))
args '-fo', relativePath("${testAntlrOutput}/org/jf/smali")
args grammars.files.join(' ')
}
@ -95,51 +110,24 @@ task generateJflexSource(type: JavaExec) {
mkdir(jflexOutput)
def grammars = fileTree(jflexSource).include('**/*.flex')
classpath = files(configurations.jflex.asPath)
classpath = configurations.jflex
main = 'JFlex.Main'
args '-q'
args '-d', relativePath(new File(jflexOutput, 'org/jf/smali'))
args '-d', relativePath("${jflexOutput}/org/jf/smali")
args grammars.files.join(' ')
}
compileJava.dependsOn generateAntlrSource, generateJflexSource
compileTestJava.dependsOn generateTestAntlrSource
// We have to do this in taskGraph.whenReady, so that we use the correct
// version to resolve the project dependencies
gradle.taskGraph.whenReady {
// build a jar containing all dependencies
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
// build a jar containing all dependencies
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes("Main-Class": "org.jf.smali.main")
}
}
processResources.inputs.properties('version': version)
processResources.expand('version': version)
proguard {
def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
inputs.file jar.archivePath
outputs.file outFile
args '-injars ' + jar.archivePath + '(!**/TestStringTemplate*.class)'
args '-outjars ' + outFile
manifest {
attributes("Main-Class": "org.jf.smali.main")
}
}
task proguard(type: JavaExec, dependsOn: jar) {
classpath = files(configurations.proguard.asPath)
main = 'proguard.ProGuard'
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
args '-dontobfuscate'
args '-dontoptimize'
args '-keep public class org.jf.smali.main { public static void main(java.lang.String[]); }'
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
args '-dontwarn com.google.common.base.**'
args '-dontnote com.google.common.base.**'
}
processResources.inputs.property('version', version)
processResources.expand('version': version)

View File

@ -0,0 +1,35 @@
/*
* Copyright 2012, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
dependencies {
compile 'commons-cli:commons-cli:1.2'
testCompile 'junit:junit:4.6'
}

View File

@ -0,0 +1,60 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
version = apktoolversion
configurations {
proguard
}
dependencies {
proguard 'net.sf.proguard:proguard-base:4.8'
compile project(':brut.apktool:apktool-lib')
}
gradle.taskGraph.whenReady {
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes("Main-Class": "brut.apktool.Main")
}
}
}
task proguard(type: JavaExec, dependsOn: jar) {
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
inputs.file jar.archivePath
outputs.file outFile
classpath = configurations.proguard
main = 'proguard.ProGuard'
args '-injars ' + jar.archivePath
args '-outjars ' + outFile
args '-dontobfuscate'
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
args '-dontoptimize'
args '-dontskipnonpubliclibraryclassmembers'
args '-keep public class brut.apktool.Main { public static void main(java.lang.String[]); }'
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
args '-dontwarn com.google.common.base.**'
args '-dontnote com.google.common.base.**'
args '-dontwarn sun.**'
args '-dontnote sun.**'
}
tasks.getByPath(':release').dependsOn(proguard)

View File

@ -0,0 +1,63 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
import org.apache.tools.ant.filters.*
// kudos #smali - JesusFreke, for how to build release task
if (!('release' in gradle.startParameter.taskNames)) {
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: fullrev, failonerror: false);
if (ant.properties[fullrev] == null) {
gitrev_version = "SNAPSHOT_DEV";
println "Building SNAPSHOT (no .git folder found)";
} else {
gitrev_version = ant.properties[fullrev].substring(0,10);
println "Building SNAPSHOT: " + gitrev_version;
}
} else {
gitrev_version = '';
println "Building RELEASE: " + apktoolversion;
}
processResources {
from('src/main/resources/properties') {
include '**/*.properties'
into 'properties'
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: gitrev_version] )
}
from('src/main/resources/') {
include '**/*.jar'
}
includeEmptyDirs = false
}
dependencies {
compile ("junit:junit:4.10") {
exclude(module: 'hamcrest-core')
}
compile project(':brut.j.dir'),
project(':brut.j.util'),
project(':brut.j.common'),
project(':brut.apktool.smali:util'),
project(':brut.apktool.smali:dexlib'),
project(':brut.apktool.smali:baksmali'),
project(':brut.apktool.smali:smali'),
"org.yaml:snakeyaml:1.11",
"xpp3:xpp3:1.1.4c",
"xmlunit:xmlunit:1.3",
"com.google.guava:guava:12.0",
"org.apache.commons:commons-lang3:3.1"
}

View File

@ -0,0 +1,20 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
dependencies {
testCompile "junit:junit:3.8.1"
}

21
brut.j.dir/build.gradle Normal file
View File

@ -0,0 +1,21 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
dependencies {
compile project(':brut.j.common'),
project(':brut.j.util')
testCompile "junit:junit:3.8.1"
}

20
brut.j.util/build.gradle Normal file
View File

@ -0,0 +1,20 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
dependencies {
compile project(':brut.j.common'), "commons-io:commons-io:2.4"
testCompile "junit:junit:3.8.1"
}

View File

@ -1,3 +1,19 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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
*
* http://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.
*/
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'license'
@ -21,8 +37,6 @@ class Compatibility {
}
String toString() { version }
}
dependencies {
}
task wrapper(type: Wrapper) {
gradleVersion = '1.3'
@ -53,96 +67,4 @@ subprojects {
dependencies {
testCompile 'junit:junit:4.8.2'
}
}
project(':brut.j.common') {
dependencies {
testCompile "junit:junit:3.8.1"
}
}
project(':brut.j.util') {
dependencies {
compile project(':brut.j.common'), "commons-io:commons-io:2.4"
testCompile "junit:junit:3.8.1"
}
}
project(':brut.j.dir') {
dependencies {
compile project(':brut.j.common'), project(':brut.j.util')
testCompile "junit:junit:3.8.1"
}
}
project(':brut.apktool.smali:util') {
dependencies {
compile 'commons-cli:commons-cli:1.2'
testCompile 'junit:junit:4.6'
}
}
project(':brut.apktool.smali:dexlib') {
dependencies {
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.google.collections:google-collections:1.0'
}
}
project(':brut.apktool.smali:baksmali') {
dependencies {
compile project(':brut.apktool.smali:util'), project(':brut.apktool.smali:dexlib')
compile 'commons-cli:commons-cli:1.2'
compile 'com.google.code.findbugs:jsr305:1.3.9'
}
}
project(':brut.apktool:apktool-lib') {
// kudos #smali - JesusFreke, for how to build release task
if (!('release' in gradle.startParameter.taskNames)) {
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: fullrev, failonerror: false);
if (ant.properties[fullrev] == null) {
gitrev_version = "SNAPSHOT_DEV";
println "Building SNAPSHOT (no .git folder found)";
} else {
gitrev_version = ant.properties[fullrev].substring(0,10);
println "Building SNAPSHOT: " + gitrev_version;
}
} else {
gitrev_version = '';
println "Building RELEASE: " + apktoolversion;
}
processResources {
from('src/main/resources/properties') {
include '**/*.properties'
into 'properties'
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: gitrev_version] )
}
from('src/main/resources/') {
include '**/*.jar'
}
includeEmptyDirs = false
}
dependencies {
compile ("junit:junit:4.10") {
exclude(module: 'hamcrest-core')
}
compile project(':brut.j.dir'), project(':brut.j.util'), project(':brut.j.common'), project(':brut.apktool.smali:util'),
project(':brut.apktool.smali:dexlib'), project(':brut.apktool.smali:baksmali'),project(':brut.apktool.smali:smali'),
"org.yaml:snakeyaml:1.11", "xpp3:xpp3:1.1.4c","xmlunit:xmlunit:1.3", "com.google.guava:guava:12.0",
"org.apache.commons:commons-lang3:3.1"
}
}
project(':brut.apktool:apktool-cli') {
version = apktoolversion
gradle.taskGraph.whenReady {
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes("Main-Class": "brut.apktool.Main")
}
}
}
dependencies {
compile project(':brut.apktool:apktool-lib')
}
}
}