use of com.facebook.buck.rules.ExopackageInfo in project buck by facebook.
the class AdbHelper method installApk.
/**
* Install apk on all matching devices. This functions performs device
* filtering based on three possible arguments:
*
* -e (emulator-only) - only emulators are passing the filter
* -d (device-only) - only real devices are passing the filter
* -s (serial) - only device/emulator with specific serial number are passing the filter
*
* If more than one device matches the filter this function will fail unless multi-install
* mode is enabled (-x). This flag is used as a marker that user understands that multiple
* devices will be used to install the apk if needed.
*/
@SuppressForbidden
public boolean installApk(SourcePathResolver pathResolver, HasInstallableApk hasInstallableApk, boolean installViaSd, boolean quiet) throws InterruptedException {
Optional<ExopackageInfo> exopackageInfo = hasInstallableApk.getApkInfo().getExopackageInfo();
if (exopackageInfo.isPresent()) {
return new ExopackageInstaller(pathResolver, context, this, hasInstallableApk).install(quiet);
}
InstallEvent.Started started = InstallEvent.started(hasInstallableApk.getBuildTarget());
if (!quiet) {
getBuckEventBus().post(started);
}
File apk = pathResolver.getAbsolutePath(hasInstallableApk.getApkInfo().getApkPath()).toFile();
boolean success = adbCall(new AdbHelper.AdbCallable() {
@Override
public boolean call(IDevice device) throws Exception {
return installApkOnDevice(device, apk, installViaSd, quiet);
}
@Override
@SuppressForbidden
public String toString() {
return String.format("install apk %s", hasInstallableApk.getBuildTarget().toString());
}
}, quiet);
if (!quiet) {
AdbHelper.tryToExtractPackageNameFromManifest(pathResolver, hasInstallableApk.getApkInfo());
getBuckEventBus().post(InstallEvent.finished(started, success, Optional.empty(), Optional.of(AdbHelper.tryToExtractPackageNameFromManifest(pathResolver, hasInstallableApk.getApkInfo()))));
}
return success;
}
use of com.facebook.buck.rules.ExopackageInfo in project buck by facebook.
the class AndroidBinary method getExopackageInfo.
private Optional<ExopackageInfo> getExopackageInfo() {
boolean shouldInstall = false;
ExopackageInfo.Builder builder = ExopackageInfo.builder();
if (ExopackageMode.enabledForSecondaryDexes(exopackageModes)) {
PreDexMerge preDexMerge = enhancementResult.getPreDexMerge().get();
builder.setDexInfo(ExopackageInfo.DexInfo.of(preDexMerge.getMetadataTxtPath(), preDexMerge.getDexDirectory()));
shouldInstall = true;
}
if (ExopackageMode.enabledForNativeLibraries(exopackageModes) && enhancementResult.getCopyNativeLibraries().isPresent()) {
CopyNativeLibraries copyNativeLibraries = Preconditions.checkNotNull(enhancementResult.getCopyNativeLibraries().get().get(enhancementResult.getAPKModuleGraph().getRootAPKModule()));
builder.setNativeLibsInfo(ExopackageInfo.NativeLibsInfo.of(copyNativeLibraries.getPathToMetadataTxt(), copyNativeLibraries.getPathToAllLibsDir()));
shouldInstall = true;
}
if (!shouldInstall) {
return Optional.empty();
}
ExopackageInfo exopackageInfo = builder.build();
return Optional.of(exopackageInfo);
}
Aggregations