Skip to content

Commit

Permalink
发布到中央仓库
Browse files Browse the repository at this point in the history
  • Loading branch information
huangx committed Feb 5, 2021
1 parent cb2300a commit 5e11f37
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 68 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# Android垃圾代码生成插件

[![Download](https://api.bintray.com/packages/qq549631030/maven/AndroidJunkCode/images/download.svg) ](https://bintray.com/qq549631030/maven/AndroidJunkCode/_latestVersion)

此插件用于做马甲包时,减小马甲包与主包的代码相似度,避免被OPPO、VIVO等应用市场识别为马甲包。

### 使用方法

根目录的build.gradle中:
```
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "cn.hx.plugin:android-junk-code:1.0.5"
classpath "com.github.qq549631030:android-junk-code:1.0.6"
}
}
```
**由于jcenter即将关闭后续版本将不再发布到jcenter,转为发布到mavenCentral,groupId从原来的"cn.hx.plugin"改为"com.github.qq549631030"**



app目录的build.gradle模块中:
```
apply plugin: 'com.android.application'
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

android.applicationVariants.all { variant ->
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ buildscript {
repositories {
google()
jcenter()
maven {
url './repo'
}
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
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.6"
classpath "com.github.qq549631030:android-junk-code:1.0.6"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0'
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:2.0.0"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
63 changes: 11 additions & 52 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: "com.vanniktech.maven.publish"

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand All @@ -9,62 +9,21 @@ dependencies {
implementation 'com.android.tools.build:gradle:3.0.0'
}

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 projectArtifactVersion = 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")
def pgpKeyId = properties.getProperty("pgpKeyId")
def pgpKeyPassword = properties.getProperty("pgpKeyPassword")
def pgpSecretKeyRingFile = properties.getProperty("pgpSecretKeyRingFile")
def sonatypeNexusUsername = properties.getProperty("sonatypeNexusUsername")
def sonatypeNexusPassword = properties.getProperty("sonatypeNexusPassword")

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

uploadArchives {
repositories {
mavenDeployer {
// repository(url: 'your repositories') {
// authentication(userName: mavenUserName, password: mavenUserPassword)
// }
repository(url: uri("../repo"))
pom.version = projectArtifactVersion
pom.artifactId = 'android-junk-code'
pom.groupId = 'cn.hx.plugin'
pom.project {
name = project.name
packaging = 'jar'
description = 'description'
}
}
}
}
ext."signing.keyId" = pgpKeyId
ext."signing.password" = pgpKeyPassword
ext."signing.secretKeyRingFile" = pgpSecretKeyRingFile
ext."SONATYPE_NEXUS_USERNAME" = sonatypeNexusUsername
ext."SONATYPE_NEXUS_PASSWORD" = sonatypeNexusPassword
23 changes: 23 additions & 0 deletions library/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#project
GROUP=com.github.qq549631030
VERSION_NAME=1.0.7

POM_ARTIFACT_ID=android-junk-code
POM_NAME=AndroidJunkCode
POM_PACKAGING=jar

POM_DESCRIPTION=generate junk code for android
POM_INCEPTION_YEAR=2020

POM_URL=https://github.com/qq549631030/AndroidJunkCode/
POM_SCM_URL=https://github.com/qq549631030/AndroidJunkCode/
POM_SCM_CONNECTION=scm:git:git://github.com/qq549631030/AndroidJunkCode.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/qq549631030/AndroidJunkCode.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=qq549631030
POM_DEVELOPER_NAME=huangx
POM_DEVELOPER_URL=https://github.com/qq549631030/
8 changes: 0 additions & 8 deletions library/project.properties

This file was deleted.

0 comments on commit 5e11f37

Please sign in to comment.