Skip to content

Commit

Permalink
1.修复重命名功能的BUG。
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazunyang committed Jan 28, 2022
1 parent 74eeb5d commit 000bbd3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
5 changes: 0 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
buildscript {
repositories {
mavenCentral()
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/jcenter")
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
}
}

subprojects {
repositories {
mavenCentral()
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/jcenter")
maven("https://mirrors.tencent.com/nexus/repository/maven-public/")
}
}
16 changes: 0 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
POM_NAME=reinforecer
POM_DESCRIPTION=A gradle plugin for Android projects, based on 360????, automatically perform hardening operations after packaging.
POM_INCEPTION_YEAR=2021
POM_URL=https://github.com/xiazunyang/reinforcer

POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_DIST=repo

POM_SCM_URL=https://github.com/xiazunyang/reinforcer
POM_SCM_CONNECTION=scm:git:git://github.com/xiazunyang/reinforcer.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:xiazunyang/reinforcer.git

POM_DEVELOPER_ID=TearSun
POM_DEVELOPER_NAME=XiazunYang
POM_DEVELOPER_URL=https://github.com/xiazunyang
15 changes: 13 additions & 2 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
plugins {
`kotlin-dsl`
id("com.github.dcendents.android-maven")
id("maven-publish")
}

group = "com.github.xiazunyang"
version = "1.0.0"
version = "1.2.1"

dependencies {
implementation(gradleApi())
implementation("com.android.tools.build:gradle:4.2.2")
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "cn.numeron"
artifactId = "reinforcer"
version = "1.2.1"
from(components["java"])
}
}
}
3 changes: 0 additions & 3 deletions plugin/gradle.properties

This file was deleted.

10 changes: 3 additions & 7 deletions plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ open class ReinforceTask : DefaultTask() {
return logger.quiet("reinforce task terminated, not found input apk.")
}

val inputApk = project.file(inputApkPath)
val inputApk = project.rootProject.file(inputApkPath)

//取出加固的配置信息
val reinforcer = project.extensions.getByType<Reinforcer>()
Expand Down Expand Up @@ -95,10 +95,6 @@ open class ReinforceTask : DefaultTask() {
if (!outputDirectory.exists()) {
outputDirectory.mkdirs()
}
//获取已存在的apk文件列表
val existFiles = outputDirectory.list { _, name ->
name.endsWith(".apk")
} ?: emptyArray()

//执行打包脚本
project.exec {
Expand All @@ -109,8 +105,8 @@ open class ReinforceTask : DefaultTask() {

//获取新加固的文件
val reinforcedApkFile = outputDirectory.listFiles { _, name ->
name.endsWith(".apk") && name !in existFiles
}?.firstOrNull()
name.endsWith(".apk")
}?.maxBy(File::lastModified)
project.logger.quiet("reinforced apk file: $reinforcedApkFile")

//重命名加固后的文件
Expand Down

0 comments on commit 000bbd3

Please sign in to comment.