From 051df140461d8bc452b703ee110324daf8f2d8cf Mon Sep 17 00:00:00 2001 From: Thad House Date: Tue, 29 Nov 2016 20:20:49 -0800 Subject: [PATCH] Updates ni patch task to automatically switch all files to LF (#381) Still requires manual intervention to make files not readonly, but that's easier. --- ni-libraries/ni-libraries.gradle | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ni-libraries/ni-libraries.gradle b/ni-libraries/ni-libraries.gradle index aa56080947..0d29658270 100644 --- a/ni-libraries/ni-libraries.gradle +++ b/ni-libraries/ni-libraries.gradle @@ -6,20 +6,26 @@ task patchNiLibraries() { // Patch ChipObject headers to be self contained FileTree chipTree = fileTree(dir: "$rootDir/ni-libraries/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace") chipTree.each {File file -> - String contents = file.getText( 'UTF-8' ) - contents = contents.replaceAll( '#include \"tSystemInterface.h\"', '#include \"../tSystem.h\"\n#include \"../tSystemInterface.h\"' ) - file.write( contents, 'UTF-8' ) + String contents = file.getText('UTF-8') + contents = contents.replaceAll('#include \"tSystemInterface.h\"', '#include \"../tSystem.h\"\n#include \"../tSystemInterface.h\"') + file.write(contents, 'UTF-8') } // Patch NetComm headers to work on Windows FileTree netTree = fileTree(dir: "$rootDir/ni-libraries/include/FRC_NetworkCommunication") netTree.each {File file -> - String contents = file.getText( 'UTF-8' ) - contents = contents.replaceAll( '#ifdef WIN32', '#ifdef _WIN32' ) - contents = contents.replaceAll( '# include ', '# include ' ) - file.write( contents, 'UTF-8' ) + String contents = file.getText('UTF-8') + contents = contents.replaceAll('#ifdef WIN32', '#ifdef _WIN32') + contents = contents.replaceAll('# include ', '# include ') + file.write(contents, 'UTF-8') } + FileTree allTree = fileTree(dir: "$rootDir/ni-libraries/include/") + allTree.each {File file -> + String contents = file.getText('UTF-8') + contents = contents.replaceAll('\r\n', '\n') + file.write(contents, 'UTF-8') + } // Generate genlinks