diff --git a/build.gradle.kts b/build.gradle.kts index 85b9882..1ebaccd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,9 @@ 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") } } @@ -14,7 +11,5 @@ 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/") } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 6c1e2bf..e69de29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 106e6d3..e0f6386 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -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("maven") { + groupId = "cn.numeron" + artifactId = "reinforcer" + version = "1.2.1" + from(components["java"]) + } + } } \ No newline at end of file diff --git a/plugin/gradle.properties b/plugin/gradle.properties deleted file mode 100644 index 43ecd9b..0000000 --- a/plugin/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=cn.numeron -POM_ARTIFACT_ID=reinforecer -VERSION_NAME=1.2.0 \ No newline at end of file diff --git a/plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt b/plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt index 5b5896c..3ca697a 100644 --- a/plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt +++ b/plugin/src/main/java/cn/numeron/reinforcer/ReinforceTask.kt @@ -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() @@ -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 { @@ -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") //重命名加固后的文件