mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-11 04:25: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") ?
|
return version.endsWith("-SNAPSHOT") ?
|
||||||
version.substring(0, version.length() - 9) + '.' +
|
version.substring(0, version.length() - 9) + '.' +
|
||||||
ApktoolProperties.get("git.commit.id.abbrev")
|
ApktoolProperties.get("git.commit.id.abbrev")
|
||||||
: version;
|
: version.substring(0,version.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File[] parseUsesFramework(Map<String, Object> usesFramework)
|
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: 'maven'
|
||||||
apply plugin: 'license'
|
apply plugin: 'license'
|
||||||
ext.apktoolversion = '1.5.1-SNAPSHOT'
|
ext.apktoolversion = '1.5.1-SNAPSHOT'
|
||||||
|
ext.fullrev = '';
|
||||||
|
ext.gitrev_version = '';
|
||||||
import org.apache.tools.ant.filters.*
|
import org.apache.tools.ant.filters.*
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -26,6 +28,10 @@ task wrapper(type: Wrapper) {
|
|||||||
gradleVersion = '1.3'
|
gradleVersion = '1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If anyone uses this outside of GoogleCode (Apktool) developers. I will hunt you down and hurt you.
|
||||||
|
task release {
|
||||||
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -85,13 +91,21 @@ subprojects {
|
|||||||
}
|
}
|
||||||
project(':brut.apktool:apktool-lib') {
|
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 {
|
processResources {
|
||||||
from('src/main/resources/properties') {
|
from('src/main/resources/properties') {
|
||||||
include '**/*.properties'
|
include '**/*.properties'
|
||||||
into 'properties'
|
into 'properties'
|
||||||
ext.fullrev = ''
|
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: gitrev_version] )
|
||||||
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: ext.fullrev)
|
|
||||||
filter(ReplaceTokens, tokens: [version: apktoolversion, gitrev: ant.properties[ext.fullrev].substring(0,10)])
|
|
||||||
}
|
}
|
||||||
from('src/main/resources/') {
|
from('src/main/resources/') {
|
||||||
include '**/*.jar'
|
include '**/*.jar'
|
||||||
|
Loading…
Reference in New Issue
Block a user