mirror of
https://github.com/revanced/smali.git
synced 2025-05-07 09:54:34 +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,9 +42,9 @@ dependencies {
|
|||||||
proguard 'net.sf.proguard:proguard-base:4.8'
|
proguard 'net.sf.proguard:proguard-base:4.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to do this in taskGraph.whenReady, so that we use the correct
|
processResources.inputs.property('version', version)
|
||||||
// version to resolve the project dependencies
|
processResources.expand('version': version)
|
||||||
gradle.taskGraph.whenReady {
|
|
||||||
// build a jar containing all dependencies
|
// build a jar containing all dependencies
|
||||||
jar {
|
jar {
|
||||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
@ -54,23 +54,15 @@ gradle.taskGraph.whenReady {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proguard {
|
task proguard(type: JavaExec, dependsOn: jar) {
|
||||||
def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
||||||
|
|
||||||
inputs.file jar.archivePath
|
inputs.file jar.archivePath
|
||||||
outputs.file outFile
|
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) {
|
|
||||||
classpath = configurations.proguard
|
classpath = configurations.proguard
|
||||||
main = 'proguard.ProGuard'
|
main = 'proguard.ProGuard'
|
||||||
|
args '-injars ' + jar.archivePath
|
||||||
|
args '-outjars ' + outFile
|
||||||
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
|
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
|
||||||
args '-dontobfuscate'
|
args '-dontobfuscate'
|
||||||
args '-dontoptimize'
|
args '-dontoptimize'
|
||||||
@ -80,4 +72,4 @@ task proguard(type: JavaExec, dependsOn: jar) {
|
|||||||
args '-dontnote com.google.common.base.**'
|
args '-dontnote com.google.common.base.**'
|
||||||
}
|
}
|
||||||
|
|
||||||
release.dependsOn(proguard)
|
tasks.getByPath(':release').dependsOn(proguard)
|
31
build.gradle
31
build.gradle
@ -31,17 +31,11 @@
|
|||||||
|
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
|
||||||
subprojects {
|
version = '1.4.1'
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
ext.baseVersion = '1.4.1'
|
def jarVersion = version
|
||||||
ext.jarVersion = baseVersion
|
|
||||||
|
|
||||||
// For non-release builds, we want to append the commit and
|
if (!('release' in gradle.startParameter.taskNames)) {
|
||||||
// dirty status to the version
|
|
||||||
gradle.taskGraph.whenReady {
|
|
||||||
if (!it.hasTask(release)) {
|
|
||||||
def versionSuffix
|
def versionSuffix
|
||||||
try {
|
try {
|
||||||
def git = org.eclipse.jgit.api.Git.open(file('.'))
|
def git = org.eclipse.jgit.api.Git.open(file('.'))
|
||||||
@ -57,30 +51,35 @@ subprojects {
|
|||||||
versionSuffix = 'dev'
|
versionSuffix = 'dev'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def baseVersion = version
|
||||||
version = baseVersion + '-' + versionSuffix
|
version = baseVersion + '-' + versionSuffix
|
||||||
|
|
||||||
// use <version>-dev for the jar name, rather than the
|
// use something like module-1.2.3-dev.jar for the jar name, rather than the full
|
||||||
// full commit+dirty string
|
// module-1.2.3-001afe02-dirty.jar
|
||||||
jarVersion = baseVersion + '-dev'
|
jarVersion = baseVersion + '-dev'
|
||||||
} else {
|
|
||||||
version = baseVersion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
version = parent.version
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
version = jarVersion
|
version = jarVersion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Note: please don't use this. This is strictly for the official releases
|
// Note: please don't use this. This is strictly for the official releases
|
||||||
// that are posted on the googlecode download page.
|
// that are posted on the googlecode download page.
|
||||||
task release {
|
task release {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -117,13 +117,9 @@ task generateJflexSource(type: JavaExec) {
|
|||||||
args grammars.files.join(' ')
|
args grammars.files.join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
compileJava.dependsOn generateAntlrSource, generateJflexSource
|
compileJava.dependsOn generateAntlrSource, generateJflexSource
|
||||||
compileTestJava.dependsOn generateTestAntlrSource
|
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
|
// build a jar containing all dependencies
|
||||||
jar {
|
jar {
|
||||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
@ -133,23 +129,18 @@ gradle.taskGraph.whenReady {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources.inputs.properties('version': version)
|
processResources.inputs.property('version', version)
|
||||||
processResources.expand('version': version)
|
processResources.expand('version': version)
|
||||||
|
|
||||||
proguard {
|
task proguard(type: JavaExec, dependsOn: jar) {
|
||||||
def outFile = relativePath("${buildDir}/libs/${jar.baseName}-${jar.version}-smali.${jar.extension}")
|
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
||||||
|
|
||||||
inputs.file jar.archivePath
|
inputs.file jar.archivePath
|
||||||
outputs.file outFile
|
outputs.file outFile
|
||||||
|
|
||||||
args "-injars ${jar.archivePath}(!**/TestStringTemplate*.class)"
|
|
||||||
args "-outjars ${outFile}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task proguard(type: JavaExec, dependsOn: jar) {
|
|
||||||
classpath = configurations.proguard
|
classpath = configurations.proguard
|
||||||
main = 'proguard.ProGuard'
|
main = 'proguard.ProGuard'
|
||||||
|
args "-injars ${jar.archivePath}(!**/TestStringTemplate*.class)"
|
||||||
|
args "-outjars ${outFile}"
|
||||||
args "-libraryjars ${System.properties['java.home']}/lib/rt.jar"
|
args "-libraryjars ${System.properties['java.home']}/lib/rt.jar"
|
||||||
args '-dontobfuscate'
|
args '-dontobfuscate'
|
||||||
args '-dontoptimize'
|
args '-dontoptimize'
|
||||||
@ -159,4 +150,4 @@ task proguard(type: JavaExec, dependsOn: jar) {
|
|||||||
args '-dontnote com.google.common.base.**'
|
args '-dontnote com.google.common.base.**'
|
||||||
}
|
}
|
||||||
|
|
||||||
release.dependsOn(proguard)
|
tasks.getByPath(':release').dependsOn(proguard)
|
Loading…
x
Reference in New Issue
Block a user