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.
This commit is contained in:
Thad House
2016-11-29 20:20:49 -08:00
committed by Peter Johnson
parent ee0318f697
commit 051df14046

View File

@@ -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 <vxWorks_compat.h>', '# include <windows.h>' )
file.write( contents, 'UTF-8' )
String contents = file.getText('UTF-8')
contents = contents.replaceAll('#ifdef WIN32', '#ifdef _WIN32')
contents = contents.replaceAll('# include <vxWorks_compat.h>', '# include <windows.h>')
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