@@ -0,0 +1,1947 @@
+/*%0A * Copyright (c) Facebook, Inc. and its affiliates.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.facebook.buck.rules.args;%0A%0Aimport com.facebook.buck.core.rulekey.AddToRuleKey;%0Aimport com.facebook.buck.core.sourcepath.resolver.SourcePathResolverAdapter;%0Aimport com.facebook.buck.core.util.immutables.BuckStyleValue;%0Aimport java.util.function.Consumer;%0A%0A/**%0A * Arg that stringifies another %7B@link Arg%7D, and passes that string representation into %7B@link%0A * java.lang.String#format(java.lang.String, java.lang.Object...)%7D%0A */%0A@BuckStyleValue%0Apublic abstract class FormatArg implements Arg %7B%0A%0A  @AddToRuleKey%0A  public abstract Arg getArg();%0A%0A  /**%0A   * @return the format string%0A   *     %3Cp%3EThe format string should be either a string with one or more %25s. Each %25s will be%0A   *     replaced with the string value of %7B@link #getArg()%7D%0A   */%0A  @AddToRuleKey%0A  public abstract String getFormatString();%0A%0A  @Override%0A  public void appendToCommandLine(%0A      Consumer%3CString%3E consumer, SourcePathResolverAdapter pathResolver) %7B%0A    StringBuilder builder = new StringBuilder();%0A    getArg().appendToCommandLine(builder::append, pathResolver);%0A    String stringified = builder.toString();%0A    String formatString = getFormatString();%0A    if (formatString.isEmpty() %7C%7C formatString.equals(%22%25s%22)) %7B%0A      consumer.accept(stringified);%0A    %7D else %7B%0A      consumer.accept(getFormatString().replace(%22%25s%22, stringified));%0A    %7D%0A  %7D%0A%7D%0A

Add FormatArg to allow format strings