Skip to content

Commit

Permalink
1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
huangx committed Jun 11, 2020
1 parent 12f88b2 commit 934755c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 3 deletions.
34 changes: 34 additions & 0 deletions README.md
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数量
}
```
40 changes: 40 additions & 0 deletions bintray-release.gradle
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')
}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.novoda:bintray-release:0.9.2'
classpath "cn.hx.plugin:android-junk-code:1.0.0"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
34 changes: 31 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,47 @@ dependencies {
implementation 'com.android.tools.build:gradle:4.0.0'
}

sourceCompatibility = "8"
targetCompatibility = "8"

apply from: rootProject.projectDir.absolutePath + "/bintray-release.gradle"

// load properties
Properties properties = new Properties()
File localPropertiesFile = project.file("$rootProject.projectDir.absolutePath/local.properties");
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.newDataInputStream())
}
File projectPropertiesFile = project.file("project.properties");
if (projectPropertiesFile.exists()) {
properties.load(projectPropertiesFile.newDataInputStream())
}

def projectName = properties.getProperty("project.name")
def projectGroupId = properties.getProperty("project.groupId")
def projectArtifactId = properties.getProperty("project.artifactId")
def projectArtifactName = properties.getProperty("project.artifactVersion")
def projectSiteUrl = properties.getProperty("project.siteUrl")
def projectGitUrl = properties.getProperty("project.gitUrl")
def projectDesc = properties.getProperty("project.desc")

def bintray_Org = properties.getProperty("bintray.org")
def bintray_User = properties.getProperty("bintray.user")
def bintrayApikey = properties.getProperty("bintray.apikey")
def mavenUserName = properties.getProperty("mavenUserName")
def mavenUserPassword = properties.getProperty("mavenUserPassword")

publish {
groupId = projectGroupId
artifactId = projectArtifactId
uploadName = projectName
website = projectSiteUrl
repository = projectGitUrl
desc = projectDesc
publishVersion = projectArtifactName
userOrg = bintray_Org
bintrayUser = bintray_User
bintrayKey = bintrayApikey
dryRun = false
}

uploadArchives {
repositories {
mavenDeployer {
Expand Down
8 changes: 8 additions & 0 deletions library/project.properties
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

0 comments on commit 934755c

Please sign in to comment.