Skip to content
Permalink
Browse files

fixAPI 'variant.getAssemble()' is obsolete and has been replaced with…

… 'variant.getAssembleProvider()''
  • Loading branch information
liqianjiang
liqianjiang committed Mar 29, 2019
1 parent be6421b commit c3869bbce43254c2fd44d67edf81fc9ea925b037
Showing with 8 additions and 3 deletions.
  1. +8 −3 plugin/src/main/groovy/com/meituan/android/walle/GradlePlugin.groovy
@@ -23,7 +23,7 @@ class GradlePlugin implements org.gradle.api.Plugin<Project> {
String version = null
try {
def clazz = Class.forName("com.android.builder.Version")
def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION")
def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION")
field.setAccessible(true)
version = field.get(null)
} catch (ClassNotFoundException ignore) {
@@ -32,7 +32,7 @@ class GradlePlugin implements org.gradle.api.Plugin<Project> {
if (version == null) {
try {
def clazz = Class.forName("com.android.builder.model.Version")
def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION")
def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION")
field.setAccessible(true)
version = field.get(null)
} catch (ClassNotFoundException ignore) {
@@ -72,7 +72,11 @@ class GradlePlugin implements org.gradle.api.Plugin<Project> {
channelMaker.variant = variant;
channelMaker.setup();

channelMaker.dependsOn variant.assemble;
if (variant.hasProperty('assembleProvider')) {
channelMaker.dependsOn variant.assembleProvider.get()
} else {
channelMaker.dependsOn variant.assemble
}
}
}
}
@@ -131,6 +135,7 @@ class GradlePlugin implements org.gradle.api.Plugin<Project> {
return Integer.signum(vals1.length - vals2.length);
}
}

private static String getVersion() {
try {
final Enumeration resEnum = Thread.currentThread().getContextClassLoader().getResources(JarFile.MANIFEST_NAME);

0 comments on commit c3869bb

Please sign in to comment.
You can’t perform that action at this time.