use of com.facebook.buck.apple.AppleBundle in project buck by facebook.
the class InstallCommand method install.
private int install(CommandRunnerParams params) throws IOException, InterruptedException, NoSuchBuildTargetException {
Build build = super.getBuild();
int exitCode = 0;
for (BuildTarget buildTarget : getBuildTargets()) {
BuildRule buildRule = build.getRuleResolver().requireRule(buildTarget);
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(build.getRuleResolver()));
if (buildRule instanceof HasInstallableApk) {
ExecutionContext executionContext = ExecutionContext.builder().from(build.getExecutionContext()).setAdbOptions(Optional.of(adbOptions(params.getBuckConfig()))).setTargetDeviceOptions(Optional.of(targetDeviceOptions())).setExecutors(params.getExecutors()).setCellPathResolver(params.getCell().getCellPathResolver()).build();
exitCode = installApk(params, (HasInstallableApk) buildRule, executionContext, pathResolver);
if (exitCode != 0) {
return exitCode;
}
} else if (buildRule instanceof AppleBundle) {
AppleBundle appleBundle = (AppleBundle) buildRule;
InstallEvent.Started started = InstallEvent.started(appleBundle.getBuildTarget());
params.getBuckEventBus().post(started);
InstallResult installResult = installAppleBundle(params, appleBundle, appleBundle.getProjectFilesystem(), build.getExecutionContext().getProcessExecutor(), pathResolver);
params.getBuckEventBus().post(InstallEvent.finished(started, installResult.getExitCode() == 0, installResult.getLaunchedPid(), Optional.empty()));
exitCode = installResult.getExitCode();
if (exitCode != 0) {
return exitCode;
}
} else {
params.getBuckEventBus().post(ConsoleEvent.severe(String.format("Specified rule %s must be of type android_binary() or apk_genrule() or " + "apple_bundle() but was %s().\n", buildRule.getFullyQualifiedName(), buildRule.getType())));
return 1;
}
}
return exitCode;
}
Aggregations