Home | History | Annotate | Download | only in options
      1 // Copyright 2017 The Bazel Authors. All rights reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //    http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 package com.google.devtools.common.options;
     15 
     16 import static java.nio.charset.StandardCharsets.UTF_8;
     17 
     18 import java.io.IOException;
     19 import java.nio.file.FileSystem;
     20 import java.nio.file.Files;
     21 import java.nio.file.Path;
     22 import java.util.List;
     23 
     24 /**
     25  * A {@link ParamsFilePreProcessor} that processes a parameter file using the {@code
     26  * com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType.UNQUOTED} format. This
     27  * format assumes each parameter is on a separate line and does not perform any special handling on
     28  * non-newline whitespace or special characters.
     29  */
     30 public class UnquotedParamsFilePreProcessor extends ParamsFilePreProcessor {
     31 
     32   public UnquotedParamsFilePreProcessor(FileSystem fs) {
     33     super(fs);
     34   }
     35 
     36   @Override
     37   protected List<String> parse(Path paramsFile) throws IOException {
     38     return Files.readAllLines(paramsFile, UTF_8);
     39   }
     40 }
     41