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
|
if (libraries == null) return jarToLibraryArtifactMap
|
||||||
|
|
||||||
for (lib in libraries) {
|
for (lib in libraries) {
|
||||||
if (lib.class.name == "com.android.builder.dependency.level2.AndroidDependency") {
|
Object bundle = getLibraryArtifactFile(lib)
|
||||||
// android tools >= 2.3
|
jarToLibraryArtifactMap[lib.jarFile] = bundle
|
||||||
jarToLibraryArtifactMap[lib.jarFile] = lib.artifactFile
|
|
||||||
} else {
|
|
||||||
// android tools <= 2.2
|
|
||||||
jarToLibraryArtifactMap[lib.jarFile] = lib.bundle
|
|
||||||
}
|
|
||||||
|
|
||||||
// local dependencies are detected as changed by gradle, because they are seem to be
|
// local dependencies are detected as changed by gradle, because they are seem to be
|
||||||
// rewritten every time when bundle changes
|
// rewritten every time when bundle changes
|
||||||
@@ -211,11 +206,11 @@ class AndroidGradleWrapper {
|
|||||||
for (localDep in lib.localJars) {
|
for (localDep in lib.localJars) {
|
||||||
if (localDep instanceof File) {
|
if (localDep instanceof File) {
|
||||||
// android tools 2.2
|
// android tools 2.2
|
||||||
jarToLibraryArtifactMap[localDep] = lib.bundle
|
jarToLibraryArtifactMap[localDep] = bundle
|
||||||
}
|
}
|
||||||
else if (localDep.metaClass.getMetaMethod("jarFile") != null) {
|
else if (localDep.metaClass.getMetaMethod("jarFile") != null) {
|
||||||
// android tools < 2.2
|
// android tools < 2.2
|
||||||
jarToLibraryArtifactMap[localDep.jarFile] = lib.bundle
|
jarToLibraryArtifactMap[localDep.jarFile] = bundle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +218,16 @@ class AndroidGradleWrapper {
|
|||||||
return jarToLibraryArtifactMap
|
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
|
@Nullable
|
||||||
private static Iterable<Object> getVariantLibraryDependencies(BaseVariantData variantData) {
|
private static Iterable<Object> getVariantLibraryDependencies(BaseVariantData variantData) {
|
||||||
def variantDependency = variantData.variantDependency
|
def variantDependency = variantData.variantDependency
|
||||||
|
|||||||
Reference in New Issue
Block a user