Include inspector.jar when unpack aar locally
@@ -19,6 +19,7 @@ package com.google.idea.blaze.android.libraries;
import static com.android.SdkConstants.FN_LINT_JAR;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.idea.blaze.base.command.buildresult.BlazeArtifact;
@@ -61,6 +62,9 @@ import java.util.concurrent.ExecutionException;
*/
public final class Unpacker {
private static final Logger logger = Logger.getInstance(Unpacker.class);
+ // Jars that are expected to be extracted from .aar to local
+ private static final ImmutableSet<String> EXPECTED_JARS =
+ ImmutableSet.of(FN_LINT_JAR, "inspector.jar");
/** Updated prefetched aars to aar directory. */
public static void unpack(
@@ -97,10 +101,12 @@ public final class Unpacker {
ZipUtil.extract(
toCopy,
aarDir,
- // Skip jars except lint.jar. We will copy jar in AarLibraryContents instead.
+ // Skip jars except EXPECTED_JARS. We will copy jar in AarLibraryContents instead.
// That could give us freedom in the future to use an ijar or header jar instead,
- // which is more lightweight. But it's not applied to lint.jar
- (dir, name) -> name.equals(FN_LINT_JAR) || !name.endsWith(".jar"));
+ // which is more lightweight. For EXPECTED_JARS, they are not collected JarLibrary,
+ // so that we are not able to copy them from AarLibraryContents. But we need them for
+ // some functions e.g. lint check, lay out inspection etc. So copy them directly.
+ (dir, name) -> EXPECTED_JARS.contains(name) || !name.endsWith(".jar"));
BlazeArtifact aar = aarLibraryContents.aar();
