mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 17:14:25 +02:00
Change how release vs. non-release is detected
This allows the smali/baksmali builds to be simplified a bit
This commit is contained in:
parent
06bff592f8
commit
3a96d5d432
@ -42,35 +42,27 @@ dependencies {
|
||||
proguard 'net.sf.proguard:proguard-base:4.8'
|
||||
}
|
||||
|
||||
// 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) } }
|
||||
processResources.inputs.property('version', version)
|
||||
processResources.expand('version': version)
|
||||
|
||||
manifest {
|
||||
attributes("Main-Class": "org.jf.baksmali.main")
|
||||
}
|
||||
// build a jar containing all dependencies
|
||||
jar {
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
|
||||
manifest {
|
||||
attributes("Main-Class": "org.jf.baksmali.main")
|
||||
}
|
||||
|
||||
proguard {
|
||||
def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
||||
|
||||
inputs.file jar.archivePath
|
||||
outputs.file outFile
|
||||
|
||||
args '-injars ' + jar.archivePath
|
||||
args '-outjars ' + outFile
|
||||
}
|
||||
|
||||
processResources.inputs.properties('version': { -> version})
|
||||
processResources.expand('version': { -> version})
|
||||
}
|
||||
|
||||
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 '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
|
||||
args '-dontobfuscate'
|
||||
args '-dontoptimize'
|
||||
@ -80,4 +72,4 @@ task proguard(type: JavaExec, dependsOn: jar) {
|
||||
args '-dontnote com.google.common.base.**'
|
||||
}
|
||||
|
||||
release.dependsOn(proguard)
|
||||
tasks.getByPath(':release').dependsOn(proguard)
|
73
build.gradle
73
build.gradle
@ -31,56 +31,55 @@
|
||||
|
||||
apply plugin: 'idea'
|
||||
|
||||
version = '1.4.1'
|
||||
|
||||
def jarVersion = version
|
||||
|
||||
if (!('release' in gradle.startParameter.taskNames)) {
|
||||
def versionSuffix
|
||||
try {
|
||||
def git = org.eclipse.jgit.api.Git.open(file('.'))
|
||||
def head = git.getRepository().getRef("HEAD")
|
||||
versionSuffix = head.getObjectId().abbreviate(8).name()
|
||||
|
||||
if (!git.status().call().clean) {
|
||||
versionSuffix += '-dirty'
|
||||
}
|
||||
} catch (Exception) {
|
||||
// In case we can't get the commit for some reason,
|
||||
// just use -dev
|
||||
versionSuffix = 'dev'
|
||||
}
|
||||
|
||||
def baseVersion = version
|
||||
version = baseVersion + '-' + versionSuffix
|
||||
|
||||
// use something like module-1.2.3-dev.jar for the jar name, rather than the full
|
||||
// module-1.2.3-001afe02-dirty.jar
|
||||
jarVersion = baseVersion + '-dev'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
|
||||
ext.baseVersion = '1.4.1'
|
||||
ext.jarVersion = baseVersion
|
||||
version = parent.version
|
||||
|
||||
// For non-release builds, we want to append the commit and
|
||||
// dirty status to the version
|
||||
gradle.taskGraph.whenReady {
|
||||
if (!it.hasTask(release)) {
|
||||
def versionSuffix
|
||||
try {
|
||||
def git = org.eclipse.jgit.api.Git.open(file('.'))
|
||||
def head = git.getRepository().getRef("HEAD")
|
||||
versionSuffix = head.getObjectId().abbreviate(8).name()
|
||||
|
||||
if (!git.status().call().clean) {
|
||||
versionSuffix += '-dirty'
|
||||
}
|
||||
} catch (Exception) {
|
||||
// In case we can't get the commit for some reason,
|
||||
// just use -dev
|
||||
versionSuffix = 'dev'
|
||||
}
|
||||
|
||||
version = baseVersion + '-' + versionSuffix
|
||||
|
||||
// use <version>-dev for the jar name, rather than the
|
||||
// full commit+dirty string
|
||||
jarVersion = baseVersion + '-dev'
|
||||
} else {
|
||||
version = baseVersion
|
||||
}
|
||||
|
||||
jar {
|
||||
version = jarVersion
|
||||
}
|
||||
jar {
|
||||
version = jarVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
// Note: please don't use this. This is strictly for the official releases
|
||||
// that are posted on the googlecode download page.
|
||||
task release {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Note: please don't use this. This is strictly for the official releases
|
||||
// that are posted on the googlecode download page.
|
||||
task release {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
|
@ -117,39 +117,30 @@ task generateJflexSource(type: JavaExec) {
|
||||
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}-smali.${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")
|
||||
}
|
||||
}
|
||||
|
||||
processResources.inputs.property('version', version)
|
||||
processResources.expand('version': version)
|
||||
|
||||
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}(!**/TestStringTemplate*.class)"
|
||||
args "-outjars ${outFile}"
|
||||
args "-libraryjars ${System.properties['java.home']}/lib/rt.jar"
|
||||
args '-dontobfuscate'
|
||||
args '-dontoptimize'
|
||||
@ -159,4 +150,4 @@ task proguard(type: JavaExec, dependsOn: jar) {
|
||||
args '-dontnote com.google.common.base.**'
|
||||
}
|
||||
|
||||
release.dependsOn(proguard)
|
||||
tasks.getByPath(':release').dependsOn(proguard)
|
Loading…
x
Reference in New Issue
Block a user