Android Gradle plugin: Fix compatibility with Android Studio 2.3 (KT-15376)
This commit is contained in:
committed by
Yan Zhulanow
parent
142496c00f
commit
a4b21f3b08
+14
-9
@@ -197,13 +197,8 @@ class AndroidGradleWrapper {
|
||||
if (libraries == null) return jarToLibraryArtifactMap
|
||||
|
||||
for (lib in libraries) {
|
||||
if (lib.class.name == "com.android.builder.dependency.level2.AndroidDependency") {
|
||||
// android tools >= 2.3
|
||||
jarToLibraryArtifactMap[lib.jarFile] = lib.artifactFile
|
||||
} else {
|
||||
// android tools <= 2.2
|
||||
jarToLibraryArtifactMap[lib.jarFile] = lib.bundle
|
||||
}
|
||||
Object bundle = getLibraryArtifactFile(lib)
|
||||
jarToLibraryArtifactMap[lib.jarFile] = bundle
|
||||
|
||||
// local dependencies are detected as changed by gradle, because they are seem to be
|
||||
// rewritten every time when bundle changes
|
||||
@@ -211,11 +206,11 @@ class AndroidGradleWrapper {
|
||||
for (localDep in lib.localJars) {
|
||||
if (localDep instanceof File) {
|
||||
// android tools 2.2
|
||||
jarToLibraryArtifactMap[localDep] = lib.bundle
|
||||
jarToLibraryArtifactMap[localDep] = bundle
|
||||
}
|
||||
else if (localDep.metaClass.getMetaMethod("jarFile") != null) {
|
||||
// android tools < 2.2
|
||||
jarToLibraryArtifactMap[localDep.jarFile] = lib.bundle
|
||||
jarToLibraryArtifactMap[localDep.jarFile] = bundle
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,6 +218,16 @@ class AndroidGradleWrapper {
|
||||
return jarToLibraryArtifactMap
|
||||
}
|
||||
|
||||
private static def getLibraryArtifactFile(Object lib) {
|
||||
if (lib.class.name == "com.android.builder.dependency.level2.AndroidDependency") {
|
||||
// android tools >= 2.3
|
||||
return lib.artifactFile
|
||||
} else {
|
||||
// android tools <= 2.2
|
||||
return lib.bundle
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Iterable<Object> getVariantLibraryDependencies(BaseVariantData variantData) {
|
||||
def variantDependency = variantData.variantDependency
|
||||
|
||||
Reference in New Issue
Block a user