From 7ade60ab57ee51c202730051116d0911841c801f Mon Sep 17 00:00:00 2001 From: ztaober Date: Thu, 10 Mar 2022 08:39:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9AGP7.0+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit b6dad828d1c22b059f44b88464760fd7c7b39e76) --- build.gradle | 4 ++-- cli/build.gradle | 4 ++-- common/build.gradle | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 3 +-- plugin/build.gradle | 12 ++++++------ .../com/mcxiaoke/packer/ng/GradlePlugin.groovy | 2 +- .../groovy/com/mcxiaoke/packer/ng/GradleTask.groovy | 6 ++++++ 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index a5e29cb..e2d116d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ ext { compileSdkVersion = 27 - buildToolsVersion = "27.0.3" + buildToolsVersion = "28.0.3" minSdkVersion = 14 targetSdkVersion = 26 } @@ -12,7 +12,7 @@ buildscript { google() } dependencies { - classpath "com.android.tools.build:gradle:3.0.1" + classpath "com.android.tools.build:gradle:3.2.1" } } diff --git a/cli/build.gradle b/cli/build.gradle index 78ac999..47b38fa 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -12,8 +12,8 @@ sourceCompatibility = 1.7 targetCompatibility = 1.7 dependencies { - compile project(":common") - compile 'com.android.tools.build:apksig:2.3.3' + implementation project(":common") + implementation 'com.android.tools.build:apksig:2.3.3' } //mainClassName = 'com.mcxiaoke.packer.cli.Main' diff --git a/common/build.gradle b/common/build.gradle index bc58f6c..38a85e4 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -12,11 +12,11 @@ targetCompatibility = 1.7 dependencies { // JUnit and Mockito - testCompile "junit:junit:4.12" - testCompile "org.mockito:mockito-core:1.10.19" - testCompile "commons-io:commons-io:2.5" - testCompile 'com.android.tools.build:apksig:2.3.3' - testCompile "com.mcxiaoke.next:core:1.5.0" + testImplementation "junit:junit:4.12" + testImplementation "org.mockito:mockito-core:1.10.19" + testImplementation "commons-io:commons-io:2.5" + testImplementation 'com.android.tools.build:apksig:2.3.3' + testImplementation "com.mcxiaoke.next:core:1.5.0" } test { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0ed5b3b..d2c45a4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Dec 16 11:37:35 CST 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip diff --git a/plugin/build.gradle b/plugin/build.gradle index 3480de1..939cf3b 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -16,12 +16,12 @@ repositories { } dependencies { - compile localGroovy() - compile gradleApi() - compile project(':common') - compile project(':cli') - compile 'com.android.tools.build:gradle:2.3.3' - compile 'com.android.tools.build:apksig:2.3.3' + implementation localGroovy() + implementation gradleApi() + implementation project(':common') + implementation project(':cli') + implementation 'com.android.tools.build:gradle:2.3.3' + implementation 'com.android.tools.build:apksig:2.3.3' } apply from: '../gradle-mvn-push.gradle' diff --git a/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradlePlugin.groovy b/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradlePlugin.groovy index a67a51e..4d0d5a1 100644 --- a/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradlePlugin.groovy +++ b/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradlePlugin.groovy @@ -18,7 +18,7 @@ class GradlePlugin implements Plugin { throw new PluginException( "'com.android.application' plugin must be applied", null) } - project.configurations.create(PLUGIN_NAME).extendsFrom(project.configurations.compile) + project.configurations.create(PLUGIN_NAME).extendsFrom(project.configurations.implementation) project.extensions.create(PLUGIN_NAME, GradleExtension) project.afterEvaluate { project.android.applicationVariants.all { BaseVariant variant -> diff --git a/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradleTask.groovy b/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradleTask.groovy index 1cbb545..e8c2299 100644 --- a/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradleTask.groovy +++ b/plugin/src/main/groovy/com/mcxiaoke/packer/ng/GradleTask.groovy @@ -7,6 +7,7 @@ import groovy.text.SimpleTemplateEngine import groovy.text.Template import org.gradle.api.DefaultTask import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import java.text.SimpleDateFormat @@ -28,6 +29,7 @@ class GradleTask extends DefaultTask { description = 'generate APK with channel info' } + @Internal Template getNameTemplate() { String format String propValue = project.findProperty(Const.PROP_FORMAT) @@ -43,6 +45,7 @@ class GradleTask extends DefaultTask { return engine.createTemplate(format) } + @Internal File getOriginalApk() { variant.outputs.each { ot -> logger.info("Output APK: ${ot.name},${ot.outputFile}") @@ -54,6 +57,7 @@ class GradleTask extends DefaultTask { return file } + @Internal File getOutputRoot() { File outputDir String propValue = project.findProperty(Const.PROP_OUTPUT) @@ -72,6 +76,7 @@ class GradleTask extends DefaultTask { return outputDir } + @Internal File getVariantOutput() { File outputDir = getOutputRoot() String flavorName = variant.flavorName @@ -87,6 +92,7 @@ class GradleTask extends DefaultTask { return outputDir } + @Internal Set getChannels() { // -P channels=ch1,ch2,ch3 // -P channels=@channels.txt