Class SanitizedArg

  • All Implemented Interfaces:
    AddsToRuleKey, Arg

    public class SanitizedArg
    extends Object
    implements Arg
    An Arg which must be sanitized before contributing to a RuleKey.

     ImmutableMap<String, String> toolchainRoots =
         ImmutableMap.of("/opt/toolchain", "$TOOLCHAIN_ROOT");
     Path toolchainRoot = Paths.get("/opt/toolchain");
     Arg arg =
         new SanitizedArg(
    • Method Detail

      • appendToCommandLine

        public void appendToCommandLine​(java.util.function.Consumer<String> consumer,
                                        SourcePathResolverAdapter pathResolver)
        Description copied from interface: Arg
        Feed the contents of the Arg to the supplied consumer. This call may feed any number of elements (including zero) into the consumer. This is only ever safe to call when the rule is running, as it may do things like resolving source paths.
        Specified by:
        appendToCommandLine in interface Arg
      • create

        public static SanitizedArg create​(java.util.function.Function<? super String,​String> sanitizer,
                                          String unsanitized)
        Create a SanitizedArg by applying the given sanitizer function to an arg string.
      • from

        public static<Arg> from​(java.util.function.Function<? super String,​String> sanitizer,
                                                                        Iterable<String> args)
        Create a list of SanitizedArgs by applying the given sanitizer function to a list of arg strings and filtering empty args
      • fromArgs

        public static<Arg> fromArgs​(java.util.function.Function<? super String,​String> sanitizer,
                                                                            Iterable<Arg> args)
        Create a list of SanitizedArg from list of Arg by applying the given sanitizer StringArg and filtering empty StringArg.