Skip to content

Commit 000bbd3

Browse files
committed
1.修复重命名功能的BUG。
1 parent 74eeb5d commit 000bbd3

File tree

5 files changed

+16
-33
lines changed

5 files changed

+16
-33
lines changed

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
buildscript {
22
repositories {
33
mavenCentral()
4-
maven("https://maven.aliyun.com/repository/google")
5-
maven("https://maven.aliyun.com/repository/jcenter")
64
}
75
dependencies {
86
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
9-
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
107
}
118
}
129

1310
subprojects {
1411
repositories {
1512
mavenCentral()
1613
maven("https://maven.aliyun.com/repository/google")
17-
maven("https://maven.aliyun.com/repository/jcenter")
18-
maven("https://mirrors.tencent.com/nexus/repository/maven-public/")
1914
}
2015
}

gradle.properties

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +0,0 @@
1-
POM_NAME=reinforecer
2-
POM_DESCRIPTION=A gradle plugin for Android projects, based on 360????, automatically perform hardening operations after packaging.
3-
POM_INCEPTION_YEAR=2021
4-
POM_URL=https://github.com/xiazunyang/reinforcer
5-
6-
POM_LICENSE_NAME=The Apache Software License, Version 2.0
7-
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
8-
POM_LICENSE_DIST=repo
9-
10-
POM_SCM_URL=https://github.com/xiazunyang/reinforcer
11-
POM_SCM_CONNECTION=scm:git:git://github.com/xiazunyang/reinforcer.git
12-
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]:xiazunyang/reinforcer.git
13-
14-
POM_DEVELOPER_ID=TearSun
15-
POM_DEVELOPER_NAME=XiazunYang
16-
POM_DEVELOPER_URL=https://github.com/xiazunyang

plugin/build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
plugins {
22
`kotlin-dsl`
3-
id("com.github.dcendents.android-maven")
3+
id("maven-publish")
44
}
55

66
group = "com.github.xiazunyang"
7-
version = "1.0.0"
7+
version = "1.2.1"
88

99
dependencies {
1010
implementation(gradleApi())
1111
implementation("com.android.tools.build:gradle:4.2.2")
12+
}
13+
14+
publishing {
15+
publications {
16+
create<MavenPublication>("maven") {
17+
groupId = "cn.numeron"
18+
artifactId = "reinforcer"
19+
version = "1.2.1"
20+
from(components["java"])
21+
}
22+
}
1223
}

plugin/gradle.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ open class ReinforceTask : DefaultTask() {
3434
return logger.quiet("reinforce task terminated, not found input apk.")
3535
}
3636

37-
val inputApk = project.file(inputApkPath)
37+
val inputApk = project.rootProject.file(inputApkPath)
3838

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

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

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

116112
//重命名加固后的文件

0 commit comments

Comments
 (0)