-
Notifications
You must be signed in to change notification settings - Fork 256
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
huangx
committed
Jun 11, 2020
1 parent
12f88b2
commit 934755c
Showing
5 changed files
with
114 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Android垃圾代码生成插件 | ||
|
||
此插件用于做马甲包时,减小马甲包与主包的代码相似度,避免被OPPO、VIVO等应用市场识别为马甲包。 | ||
|
||
### 使用方法 | ||
|
||
根目录的build.gradle中: | ||
``` | ||
buildscript { | ||
dependencies { | ||
classpath "cn.hx.plugin:android-junk-code:1.0.0" | ||
} | ||
} | ||
``` | ||
app目录的build.gradle模块中: | ||
``` | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'android-junk-code' | ||
android { | ||
//xxx | ||
} | ||
androidJunkCode { | ||
variants = ["debug"] //要生成垃圾代码的variant列表 eg:["vivoRelease","oppoRelease"] | ||
packages = ["cn.hx.test"] //要在哪些包名下生成Java类 eg:["cn.hx.test","cn.hx.demo"] | ||
activityCountPerPackage = 2 //每个包下生成Activity数量 | ||
otherCountPerPackage = 10 //每个包下生成普通类数量 | ||
methodCountPerClass = 10 每个类生生成方法数量 | ||
resPrefix = "hx_junk_" 生成的layout、drawable、string等资源名前缀 | ||
drawableCount = 30 生成drawable资源数量 | ||
stringCount = 30 生成string数量 | ||
} | ||
``` |
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,40 @@ | ||
apply plugin: 'com.novoda.bintray-release' | ||
apply plugin: 'maven' | ||
// This generates sources.jar | ||
task sourcesJar(type: Jar) { | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.groovy.srcDirs | ||
archiveClassifier.convention('sources') | ||
} | ||
|
||
// This generates javadoc.jar | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
from javadoc.destinationDir | ||
archiveClassifier.convention('javadoc') | ||
} | ||
|
||
artifacts { | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
|
||
// javadoc configuration | ||
javadoc { | ||
options { | ||
encoding "UTF-8" | ||
charSet 'UTF-8' | ||
author true | ||
} | ||
} | ||
|
||
afterEvaluate { | ||
Task bintrayUploadTask = tasks.findByName('bintrayUpload') | ||
Task uploadArchivesTask = tasks.findByName('uploadArchives') | ||
if (bintrayUploadTask != null && uploadArchivesTask != null) { | ||
bintrayUploadTask.dependsOn uploadArchivesTask | ||
} | ||
tasks.withType(Javadoc) { | ||
options.addStringOption('Xdoclint:none', '-quiet') | ||
options.addStringOption('encoding', 'UTF-8') | ||
} | ||
} |
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,8 @@ | ||
#project | ||
project.name=AndroidJunkCode | ||
project.groupId=cn.hx.plugin | ||
project.artifactId=android-junk-code | ||
project.artifactVersion=1.0.0 | ||
project.siteUrl=https://github.com/qq549631030/AndroidJunkCode | ||
project.gitUrl=https://github.com/qq549631030/AndroidJunkCode.git | ||
project.desc=generate junk code for android |