use of com.facebook.buck.rules.BinaryBuildRuleToolProvider in project buck by facebook.
the class BuckConfig method getToolProvider.
/**
* @return a {@link Tool} identified by a @{link BuildTarget} or {@link Path} reference
* by the given section:field, if set.
*/
public Optional<ToolProvider> getToolProvider(String section, String field) {
Optional<String> value = getValue(section, field);
if (!value.isPresent()) {
return Optional.empty();
}
Optional<BuildTarget> target = getMaybeBuildTarget(section, field);
if (target.isPresent()) {
return Optional.of(new BinaryBuildRuleToolProvider(target.get(), String.format("[%s] %s", section, field)));
} else {
checkPathExists(value.get(), String.format("Overridden %s:%s path not found: ", section, field));
return Optional.of(new ConstantToolProvider(new HashedFileTool(getPathFromVfs(value.get()))));
}
}
use of com.facebook.buck.rules.BinaryBuildRuleToolProvider in project buck by facebook.
the class AppleConfig method getCodesignProvider.
public ToolProvider getCodesignProvider() {
final String codesignField = "codesign";
Optional<BuildTarget> target = delegate.getMaybeBuildTarget(APPLE_SECTION, codesignField);
String source = String.format("[%s] %s", APPLE_SECTION, codesignField);
if (target.isPresent()) {
return new BinaryBuildRuleToolProvider(target.get(), source);
} else {
Optional<Path> codesignPath = delegate.getPath(APPLE_SECTION, codesignField);
Path defaultCodesignPath = Paths.get("/usr/bin/codesign");
HashedFileTool codesign = new HashedFileTool(codesignPath.orElse(defaultCodesignPath));
return new ConstantToolProvider(codesign);
}
}
Aggregations