@Nullable private static File createCompilerExecutableWrapper(File blazeCompilerExecutableFile){
  try {
    File blazeCompilerWrapper=FileUtil.createTempFile("blaze_compiler",".sh",true);
    if (!blazeCompilerWrapper.setExecutable(true)) {
      return null;
    }
    ImmutableList<String> compilerWrapperScriptLines=ImmutableList.of("#!/bin/bash","","# The c toolchain compiler wrapper script doesn't handle arguments files, so we","# need to move the compiler arguments from the file to the command line.","","if [ $# -ne 2 ]; then","  echo \"Usage: $0 @arg-file compile-file\"","  exit 2;","fi","","if [[ $1 != @* ]]; then","  echo \"Usage: $0 @arg-file compile-file\"","  exit 3;","fi",""," # Remove the @ before the arguments file path","ARG_FILE=${1#@}","# The actual compiler wrapper script we get from blaze","EXE=" + blazeCompilerExecutableFile.getPath(),"# Read in the arguments file so we can pass the arguments on the command line.","ARGS=`cat $ARG_FILE`","$EXE $ARGS $2");
    try (PrintWriter pw=new PrintWriter(blazeCompilerWrapper)){
      compilerWrapperScriptLines.forEach(null);
    }
     return blazeCompilerWrapper;
  }
 catch (  IOException e) {
    return null;
  }
}

@ Nullable private static File createCompilerExecutableWrapper ( File blazeCompilerExecutableFile ) { try { File blazeCompilerWrapper = FileUtil . createTempFile ( "blaze_compiler" , ".sh" , true ) ; if ( ! blazeCompilerWrapper . setExecutable ( true ) ) { return null ; } ImmutableList < String > compilerWrapperScriptLines = ImmutableList . of ( "#!/bin/bash" , "" , "# The c toolchain compiler wrapper script doesn't handle arguments files, so we" , "# need to move the compiler arguments from the file to the command line." , "" , "if [ $# -ne 2 ]; then" , "  echo \"Usage: $0 @arg-file compile-file\"" , "  exit 2;" , "fi" , "" , "if [[ $1 != @* ]]; then" , "  echo \"Usage: $0 @arg-file compile-file\"" , "  exit 3;" , "fi" , "" , " # Remove the @ before the arguments file path" , "ARG_FILE=${1#@}" , "# The actual compiler wrapper script we get from blaze" , "EXE=" + blazeCompilerExecutableFile . getPath ( ) , "# Read in the arguments file so we can pass the arguments on the command line." , "ARGS=`cat $ARG_FILE`" , "$EXE $ARGS $2" ) ; try ( PrintWriter pw = new PrintWriter ( blazeCompilerWrapper ) ) { compilerWrapperScriptLines . forEach ( null ) ; } return blazeCompilerWrapper ; } catch ( IOException e ) { return null ; } }
create a wrapper script that transforms the clion compiler invocation into a safe invocation of the compiler script that blaze uses . < p > clion passes arguments to the compiler in an arguments file . the c toolchain compiler wrapper script doesn ' t handle arguments files , so we need to move the compiler arguments from the file to the command line .
