Skip to content

Commit 6744b24

Browse files
committed
gradle redo (moved each to their own project for organization)
1 parent 9281cba commit 6744b24

File tree

11 files changed

+361
-150
lines changed

11 files changed

+361
-150
lines changed

.gitignore

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
.gradle/
2-
brut.apktool.smali/baksmali/build*
3-
brut.apktool.smali/build*
4-
brut.apktool.smali/dexlib/build*
5-
brut.apktool.smali/smali/build*
6-
brut.apktool.smali/util/build*
7-
brut.apktool/apktool-cli/build*
8-
brut.apktool/apktool-lib/build*
9-
brut.apktool/build*
10-
build*
11-
12-
2+
brut.apktool.smali/baksmali/build/
3+
brut.apktool.smali/build/
4+
brut.apktool.smali/dexlib/build/
5+
brut.apktool.smali/smali/build/
6+
brut.apktool.smali/util/build/
7+
brut.apktool/apktool-cli/build/
8+
brut.apktool/apktool-lib/build/
9+
brut.apktool/build/
10+
build/
1311
/brut.apktool/nbproject/private/
1412
/brut.apktool.smali/baksmali/nbproject/private/
1513
/brut.apktool.smali/dexlib/nbproject/private/
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2012, Google Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following disclaimer
13+
* in the documentation and/or other materials provided with the
14+
* distribution.
15+
* * Neither the name of Google Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from
17+
* this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
dependencies {
33+
compile project(':brut.apktool.smali:util')
34+
compile project(':brut.apktool.smali:dexlib')
35+
compile 'commons-cli:commons-cli:1.2'
36+
compile 'com.google.code.findbugs:jsr305:1.3.9'
37+
}
38+
39+
processResources.inputs.property('version', version)
40+
processResources.expand('version': version)
41+
42+
// build a jar containing all dependencies
43+
jar {
44+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
45+
46+
manifest {
47+
attributes("Main-Class": "org.jf.baksmali.main")
48+
}
49+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2012, Google Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following disclaimer
13+
* in the documentation and/or other materials provided with the
14+
* distribution.
15+
* * Neither the name of Google Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from
17+
* this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
dependencies {
33+
compile 'com.google.code.findbugs:jsr305:1.3.9'
34+
compile 'com.google.collections:google-collections:1.0'
35+
}

brut.apktool.smali/smali/build.gradle

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,45 @@ configurations {
3636
}
3737

3838
ext.antlrSource = 'src/main/antlr3'
39-
ext.antlrOutput = file(new File(buildDir, '/generated-sources/antlr3'))
39+
ext.antlrOutput = file("${buildDir}/generated-sources/antlr3")
4040

4141
ext.jflexSource = "src/main/jflex"
42-
ext.jflexOutput = file(new File(buildDir, '/generated-sources/jflex'))
42+
ext.jflexOutput = file("${buildDir}/generated-sources/jflex")
4343

4444
ext.testAntlrSource = 'src/test/antlr3'
45-
ext.testAntlrOutput = file(new File(buildDir, '/generated-test-sources/antlr3'))
45+
ext.testAntlrOutput = file("${buildDir}/generated-test-sources/antlr3")
4646

4747
sourceSets.main.java.srcDir antlrOutput
4848
sourceSets.main.java.srcDir jflexOutput
4949

5050
sourceSets.test.java.srcDir testAntlrOutput
5151

52+
idea {
53+
module {
54+
excludeDirs -= buildDir
55+
if (buildDir.exists()) {
56+
excludeDirs.addAll(buildDir.listFiles())
57+
}
58+
for (sourceDir in (sourceDirs + testSourceDirs)) {
59+
excludeDirs.remove(sourceDir);
60+
while ((sourceDir = sourceDir.getParentFile()) != null) {
61+
excludeDirs.remove(sourceDir);
62+
}
63+
}
64+
}
65+
}
66+
5267
dependencies {
5368
compile project(':brut.apktool.smali:util')
5469
compile project(':brut.apktool.smali:dexlib')
5570
compile 'org.antlr:antlr-runtime:3.2'
5671
compile 'commons-cli:commons-cli:1.2'
72+
compile 'com.google.guava:guava:13.0.1'
5773

5874
testCompile 'junit:junit:4.6'
5975

6076
antlr3 'org.antlr:antlr:3.2'
6177
jflex 'de.jflex:jflex:1.4.3'
62-
proguard 'net.sf.proguard:proguard-base:4.8'
6378
}
6479

6580
task generateAntlrSource(type: JavaExec) {
@@ -69,9 +84,9 @@ task generateAntlrSource(type: JavaExec) {
6984
mkdir(antlrOutput)
7085
def grammars = fileTree(antlrSource).include('**/*.g')
7186

72-
classpath = files(configurations.antlr3.asPath)
87+
classpath = configurations.antlr3
7388
main = 'org.antlr.Tool'
74-
args '-fo', relativePath(new File(antlrOutput, 'org/jf/smali'))
89+
args '-fo', relativePath("${antlrOutput}/org/jf/smali")
7590
args grammars.files
7691
}
7792

@@ -82,9 +97,9 @@ task generateTestAntlrSource(type: JavaExec) {
8297
mkdir(testAntlrOutput)
8398
def grammars = fileTree(testAntlrSource).include('**/*.g')
8499

85-
classpath = files(configurations.antlr3.asPath)
100+
classpath = configurations.antlr3
86101
main = 'org.antlr.Tool'
87-
args '-fo', relativePath(new File(testAntlrOutput, 'org/jf/smali'))
102+
args '-fo', relativePath("${testAntlrOutput}/org/jf/smali")
88103
args grammars.files.join(' ')
89104
}
90105

@@ -95,51 +110,24 @@ task generateJflexSource(type: JavaExec) {
95110
mkdir(jflexOutput)
96111
def grammars = fileTree(jflexSource).include('**/*.flex')
97112

98-
classpath = files(configurations.jflex.asPath)
113+
classpath = configurations.jflex
99114
main = 'JFlex.Main'
100115
args '-q'
101-
args '-d', relativePath(new File(jflexOutput, 'org/jf/smali'))
116+
args '-d', relativePath("${jflexOutput}/org/jf/smali")
102117
args grammars.files.join(' ')
103118
}
104119

105-
106120
compileJava.dependsOn generateAntlrSource, generateJflexSource
107121
compileTestJava.dependsOn generateTestAntlrSource
108122

109-
// We have to do this in taskGraph.whenReady, so that we use the correct
110-
// version to resolve the project dependencies
111-
gradle.taskGraph.whenReady {
112-
// build a jar containing all dependencies
113-
jar {
114-
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
115-
116-
manifest {
117-
attributes("Main-Class": "org.jf.smali.main")
118-
}
119-
}
120-
121-
processResources.inputs.properties('version': version)
122-
processResources.expand('version': version)
123-
124-
proguard {
125-
def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
126-
127-
inputs.file jar.archivePath
128-
outputs.file outFile
123+
// build a jar containing all dependencies
124+
jar {
125+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
129126

130-
args '-injars ' + jar.archivePath + '(!**/TestStringTemplate*.class)'
131-
args '-outjars ' + outFile
127+
manifest {
128+
attributes("Main-Class": "org.jf.smali.main")
132129
}
133130
}
134131

135-
task proguard(type: JavaExec, dependsOn: jar) {
136-
classpath = files(configurations.proguard.asPath)
137-
main = 'proguard.ProGuard'
138-
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
139-
args '-dontobfuscate'
140-
args '-dontoptimize'
141-
args '-keep public class org.jf.smali.main { public static void main(java.lang.String[]); }'
142-
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
143-
args '-dontwarn com.google.common.base.**'
144-
args '-dontnote com.google.common.base.**'
145-
}
132+
processResources.inputs.property('version', version)
133+
processResources.expand('version': version)

brut.apktool.smali/util/build.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2012, Google Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following disclaimer
13+
* in the documentation and/or other materials provided with the
14+
* distribution.
15+
* * Neither the name of Google Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from
17+
* this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
dependencies {
33+
compile 'commons-cli:commons-cli:1.2'
34+
testCompile 'junit:junit:4.6'
35+
}

brut.apktool/apktool-cli/build.gradle

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
version = apktoolversion
18+
19+
configurations {
20+
proguard
21+
}
22+
23+
dependencies {
24+
proguard 'net.sf.proguard:proguard-base:4.8'
25+
compile project(':brut.apktool:apktool-lib')
26+
}
27+
28+
gradle.taskGraph.whenReady {
29+
jar {
30+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
31+
32+
manifest {
33+
attributes("Main-Class": "brut.apktool.Main")
34+
}
35+
}
36+
}
37+
38+
task proguard(type: JavaExec, dependsOn: jar) {
39+
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
40+
inputs.file jar.archivePath
41+
outputs.file outFile
42+
43+
classpath = configurations.proguard
44+
main = 'proguard.ProGuard'
45+
args '-injars ' + jar.archivePath
46+
args '-outjars ' + outFile
47+
args '-dontobfuscate'
48+
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
49+
args '-dontoptimize'
50+
args '-dontskipnonpubliclibraryclassmembers'
51+
args '-keep public class brut.apktool.Main { public static void main(java.lang.String[]); }'
52+
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
53+
args '-dontwarn com.google.common.base.**'
54+
args '-dontnote com.google.common.base.**'
55+
args '-dontwarn sun.**'
56+
args '-dontnote sun.**'
57+
}
58+
59+
tasks.getByPath(':release').dependsOn(proguard)
60+

0 commit comments

Comments
 (0)