Search in sources :

Example 1 with WorkerMacroArg

use of com.facebook.buck.rules.args.WorkerMacroArg in project buck by facebook.

the class Genrule method isWorkerGenrule.

@VisibleForTesting
public boolean isWorkerGenrule() {
    Arg cmdArg = cmd.orElse(null);
    Arg bashArg = bash.orElse(null);
    Arg cmdExeArg = cmdExe.orElse(null);
    if ((cmdArg instanceof WorkerMacroArg) || (bashArg instanceof WorkerMacroArg) || (cmdExeArg instanceof WorkerMacroArg)) {
        if ((cmdArg != null && !(cmdArg instanceof WorkerMacroArg)) || (bashArg != null && !(bashArg instanceof WorkerMacroArg)) || (cmdExeArg != null && !(cmdExeArg instanceof WorkerMacroArg))) {
            throw new HumanReadableException("You cannot use a worker macro in one of the cmd, bash, " + "or cmd_exe properties and not in the others for genrule %s.", getBuildTarget().getFullyQualifiedName());
        }
        return true;
    }
    return false;
}
Also used : HumanReadableException(com.facebook.buck.util.HumanReadableException) WorkerMacroArg(com.facebook.buck.rules.args.WorkerMacroArg) Arg(com.facebook.buck.rules.args.Arg) WorkerMacroArg(com.facebook.buck.rules.args.WorkerMacroArg) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

Arg (com.facebook.buck.rules.args.Arg)1 WorkerMacroArg (com.facebook.buck.rules.args.WorkerMacroArg)1 HumanReadableException (com.facebook.buck.util.HumanReadableException)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1