mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-10 20:15:52 +01:00
adding support for release / snapshot builds via gradle. kudos to #smali
This commit is contained in:
parent
20cb1fba90
commit
9d19ad1355
@ -509,7 +509,7 @@ public class Androlib {
|
||||
return version.endsWith("-SNAPSHOT") ?
|
||||
version.substring(0, version.length() - 9) + '.' +
|
||||
ApktoolProperties.get("git.commit.id.abbrev")
|
||||
: version;
|
||||
: version.substring(0,version.length() - 1);
|
||||
}
|
||||
|
||||
private File[] parseUsesFramework(Map<String, Object> usesFramework)
|
||||
|
20
build.gradle
20
build.gradle
@ -2,6 +2,8 @@ apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'license'
|
||||
ext.apktoolversion = '1.5.1-SNAPSHOT'
|
||||
ext.fullrev = '';
|
||||
ext.gitrev_version = '';
|
||||
import org.apache.tools.ant.filters.*
|
||||
|
||||
repositories {
|
||||
@ -26,6 +28,10 @@ task wrapper(type: Wrapper) {
|
||||
gradleVersion = '1.3'
|
||||
}
|
||||
|
||||
// If anyone uses this outside of GoogleCode (Apktool) developers. I will hunt you down and hurt you.
|
||||
task release {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -84,14 +90,22 @@ subprojects {
|
||||
}
|
||||
}
|
||||
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)
|
||||
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'
|
||||
ext.fullrev = ''
|
||||
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: ext.fullrev)
|
||||
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: ant.properties[ext.fullrev].substring(0,10)])
|
||||
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: gitrev_version] )
|
||||
}
|
||||
from('src/main/resources/') {
|
||||
include '**/*.jar'
|
||||
|
Loading…
Reference in New Issue
Block a user