这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions baksmali/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,20 @@ task fatJar(type: Jar) {
from sourceSets.main.output
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }

classifier = 'fat'
archiveClassifier = 'fat'

manifest {
attributes('Main-Class': 'org.jf.baksmali.Main')
}

doLast {
if (!System.getProperty('os.name').toLowerCase().contains('windows')) {
ant.symlink(link: file("${destinationDirectory.get()}/baksmali.jar"), resource: archivePath, overwrite: true)
ant.symlink(link: file("${destinationDirectory.get()}/baksmali.jar"), resource: archiveFile.get().asFile, overwrite: true)
}
}

dependsOn ':util:jar'
dependsOn ':dexlib2:jar'
}
tasks.getByPath('build').dependsOn(fatJar)

Expand Down Expand Up @@ -125,4 +128,4 @@ tasks.getByPath('javadoc').onlyIf({

tasks.getByPath('test').onlyIf({
!gradle.taskGraph.hasTask(fastbuild)
})
})
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

apply plugin: 'idea'



version = '2.5.2'
def jcommanderVersion = ''

Expand Down Expand Up @@ -71,10 +73,17 @@ task(install).doLast {
// The projects that get pushed to maven
def maven_release_projects = ['smali', 'baksmali', 'dexlib2', 'util']


subprojects {
apply plugin: 'java-library'
apply plugin: 'idea'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
Expand All @@ -86,8 +95,8 @@ subprojects {
version = parent.version

java {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

ext {
Expand All @@ -100,7 +109,7 @@ subprojects {
antlr: 'org.antlr:antlr:3.5.2',
stringtemplate: 'org.antlr:stringtemplate:3.2.1',
jflex_plugin: 'org.xbib.gradle.plugin:gradle-plugin-jflex:1.1.0',
proguard_gradle: 'net.sf.proguard:proguard-gradle:6.2.2',
proguard_gradle: 'com.guardsquare:proguard-gradle:7.5.0',
dx: 'com.google.android.tools:dx:1.7',
gson: 'com.google.code.gson:gson:2.3.1',
jcommander: jcommanderVersion
Expand Down Expand Up @@ -170,7 +179,7 @@ subprojects {
}

signing {
required { gradle.taskGraph.hasTask('publish') }
required = gradle.taskGraph.hasTask('publish')
sign(publishing.publications["mavenJava"])
}

Expand Down
11 changes: 9 additions & 2 deletions dexlib2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ sourceSets {
}
}

test {
jvmArgs += [
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED'
]
}

configurations {
accessorTestGenerator
dx
Expand Down Expand Up @@ -71,7 +78,7 @@ task generateAccessorTestSource(type: JavaExec) {
outputs.dir file(testAccessorOutputDir)

classpath = configurations.accessorTestGenerator
main = 'org.jf.dexlib2.AccessorTestGenerator'
mainClass = 'org.jf.dexlib2.AccessorTestGenerator'
args testAccessorOutputFile
}
compileAccessorTestJava.dependsOn(generateAccessorTestSource)
Expand All @@ -84,7 +91,7 @@ task generateAccessorTestDex(type: JavaExec, dependsOn: compileAccessorTestJava)
inputs.dir(project.sourceSets.accessorTest.output.classesDirs)
outputs.file outputDex

main 'com.android.dx.command.Main'
mainClass = 'com.android.dx.command.Main'
classpath = configurations.dx

args '--dex'
Expand Down
19 changes: 15 additions & 4 deletions smali/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ configurations {
implementation.exclude group: 'org.antlr', module: 'antlr'
}

compileJava.dependsOn(generateGrammarSource, jflex)

sourceSets {
main {
resources {
// This adds the generated .tokens files to the jar
srcDir 'build/generated-src/antlr/main'
}
java {
srcDir 'build/generated-src/antlr/main'
srcDir 'build/generated-src/jflex'
}
}
}
Expand All @@ -63,7 +69,8 @@ idea {
if (buildDir.exists()) {
excludeDirs.addAll(buildDir.listFiles())
}
for (sourceDir in (sourceDirs + testSourceDirs)) {
def allSourceDirs = project.sourceSets.main.allSource.srcDirs + project.sourceSets.test.allSource.srcDirs
for (sourceDir in allSourceDirs) {
excludeDirs.remove(sourceDir);
while ((sourceDir = sourceDir.getParentFile()) != null) {
excludeDirs.remove(sourceDir);
Expand All @@ -87,21 +94,24 @@ dependencies {

processResources.inputs.property('version', version)
processResources.expand('version': version)
processResources.dependsOn(generateGrammarSource)

// Build a separate jar that contains all dependencies
task fatJar(type: Jar, dependsOn: jar) {
task fatJar(type: Jar, dependsOn: [jar, ':util:jar', ':dexlib2:jar']) {
from sourceSets.main.output
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }

classifier = 'fat'
archiveClassifier = 'fat'

manifest {
attributes('Main-Class': 'org.jf.smali.Main')
}

doLast {
def rootLibsDirProvider = rootProject.layout.buildDirectory.dir('libs')
if (!System.getProperty('os.name').toLowerCase().contains('windows')) {
ant.symlink(link: file("${destinationDirectory.get()}/smali.jar"), resource: archivePath, overwrite: true)
mkdir rootLibsDirProvider.get()
ant.symlink(link: file("${rootLibsDirProvider.get()}/smali.jar"), resource: archiveFile.get().asFile, overwrite: true)
}
}
}
Expand Down Expand Up @@ -160,6 +170,7 @@ task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {

sourcesJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
dependsOn jflex, generateGrammarSource
}

tasks.getByPath(':release').dependsOn(proguard)