forked from shwenzhang/AndResGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
59 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,5 +37,4 @@ local_repo | |
tool_output/outapk | ||
|
||
node_modules/ | ||
**/gradle.properties | ||
classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Project-wide Gradle settings. | ||
# | ||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
# | ||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
# Default value: -Xmx1024m -XX:MaxPermSize=256m | ||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
# | ||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
#Tue Sep 06 04:33:31 CST 2016 | ||
org.gradle.jvmargs=-Xmx2584M -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=18030 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ package com.tencent.gradle | |
* @author sim sun ([email protected]) | ||
*/ | ||
|
||
public class AndResGuardExtension { | ||
class AndResGuardExtension { | ||
|
||
File mappingFile | ||
boolean use7zip | ||
|
@@ -16,7 +16,7 @@ public class AndResGuardExtension { | |
Iterable<String> whiteList | ||
Iterable<String> compressFilePattern | ||
|
||
public AndResGuardExtension() { | ||
AndResGuardExtension() { | ||
use7zip = false | ||
useSign = false | ||
metaName = "META-INF" | ||
|
@@ -55,7 +55,7 @@ public class AndResGuardExtension { | |
} | ||
|
||
@Override | ||
public String toString() { | ||
String toString() { | ||
"""| use7zip = ${use7zip} | ||
| useSign = ${useSign} | ||
| metaName = ${metaName} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ import org.gradle.api.tasks.TaskAction | |
* | ||
* @author Sim Sun ([email protected]) | ||
*/ | ||
public class AndResGuardTask extends DefaultTask { | ||
def AndResGuardExtension configuration | ||
class AndResGuardTask extends DefaultTask { | ||
AndResGuardExtension configuration | ||
def android | ||
def buildConfigs = [] | ||
|
||
|
@@ -43,15 +43,15 @@ public class AndResGuardTask extends DefaultTask { | |
} | ||
} | ||
|
||
static def isTargetFlavor(variantName, flavors, buildType) { | ||
static isTargetFlavor(variantName, flavors, buildType) { | ||
if (flavors.size() > 0) { | ||
String flavor = flavors.get(0).name | ||
return variantName.equalsIgnoreCase(flavor) || variantName.equalsIgnoreCase([flavor, buildType].join("")) | ||
} | ||
return false | ||
} | ||
|
||
static def useFolder(file) { | ||
static useFolder(file) { | ||
//remove .apk from filename | ||
def fileName = file.name[0..-5] | ||
return "${file.parent}/AndResGuard_${fileName}/" | ||
|
@@ -62,17 +62,17 @@ public class AndResGuardTask extends DefaultTask { | |
} | ||
|
||
@TaskAction | ||
def run() { | ||
run() { | ||
project.logger.info("[AndResGuard] configuartion:$configuration") | ||
project.logger.info("[AndResGuard] BuildConfigs:$buildConfigs") | ||
|
||
def ExecutorExtension sevenzip = project.extensions.findByName("sevenzip") as ExecutorExtension | ||
ExecutorExtension sevenzip = project.extensions.findByName("sevenzip") as ExecutorExtension | ||
|
||
buildConfigs.each { config -> | ||
def String absPath = config.file.getAbsolutePath() | ||
String absPath = config.file.getAbsolutePath() | ||
def signConfig = config.signConfig | ||
def String packageName = config.packageName | ||
ArrayList<String> whiteListFullName = new ArrayList<>(); | ||
String packageName = config.packageName | ||
ArrayList<String> whiteListFullName = new ArrayList<>() | ||
configuration.whiteList.each { res -> | ||
if (res.startsWith("R")) { | ||
whiteListFullName.add(packageName + "." + res) | ||
|
@@ -91,7 +91,7 @@ public class AndResGuardTask extends DefaultTask { | |
.setSevenZipPath(sevenzip.path) | ||
.setOutBuilder(useFolder(config.file)) | ||
.setApkPath(absPath) | ||
.setUseSign(configuration.useSign); | ||
.setUseSign(configuration.useSign) | ||
|
||
if (configuration.useSign) { | ||
if (signConfig == null) { | ||
|
@@ -102,7 +102,7 @@ public class AndResGuardTask extends DefaultTask { | |
.setStorealias(signConfig.keyAlias) | ||
.setStorepass(signConfig.storePassword) | ||
} | ||
InputParam inputParam = builder.create(); | ||
InputParam inputParam = builder.create() | ||
Main.gradleRun(inputParam) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Project-wide Gradle settings. | ||
|
||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
|
||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
|
||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
# Default value: -Xmx10248m -XX:MaxPermSize=256m | ||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
|
||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true |