diff --git a/firmware/gen_config.bat b/firmware/gen_config.bat index ae8c5fc406..3ecf5085cd 100644 --- a/firmware/gen_config.bat +++ b/firmware/gen_config.bat @@ -57,4 +57,7 @@ IF NOT ERRORLEVEL 0 EXIT /B 1 cd config\boards\kinetis\config -!gen_config.bat +call !gen_config.bat +pwd + +call gen_enum_to_string.bat diff --git a/java_tools/enum2string.jar b/java_tools/enum2string.jar index a495430e56..22c1ff7f06 100644 Binary files a/java_tools/enum2string.jar and b/java_tools/enum2string.jar differ diff --git a/java_tools/enum_to_string/.idea/runConfigurations/EnumToString.xml b/java_tools/enum_to_string/.idea/runConfigurations/EnumToString.xml new file mode 100644 index 0000000000..65723abd0f --- /dev/null +++ b/java_tools/enum_to_string/.idea/runConfigurations/EnumToString.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/java_tools/enum_to_string/src/com/rusefi/EnumToString.java b/java_tools/enum_to_string/src/com/rusefi/EnumToString.java index 078fe8ea53..19afe71a7a 100644 --- a/java_tools/enum_to_string/src/com/rusefi/EnumToString.java +++ b/java_tools/enum_to_string/src/com/rusefi/EnumToString.java @@ -89,11 +89,10 @@ public class EnumToString { SystemOut.println("Reading enums from " + inFileName); String simpleFileName = f.getName(); - bothFilesHeader.insert(0, "// " + - LazyFile.LAZY_FILE_TAG + " from " + simpleFileName + " "); + bothFilesHeader.insert(0, "// " + LazyFile.LAZY_FILE_TAG + " from " + simpleFileName + " "); includesSection.append("#include \"" + simpleFileName + "\"\n"); - EnumsReader.process(new FileReader(inFileName)); + EnumsReader.process(new FileReader(f)); } public static void outputData() { diff --git a/java_tools/enum_to_string/src/com/rusefi/util/LazyFile.java b/java_tools/enum_to_string/src/com/rusefi/util/LazyFile.java index 5d30503986..a970b9d84a 100644 --- a/java_tools/enum_to_string/src/com/rusefi/util/LazyFile.java +++ b/java_tools/enum_to_string/src/com/rusefi/util/LazyFile.java @@ -40,7 +40,7 @@ public class LazyFile implements Output { @Override public void close() throws IOException { String fileContent = unifySpaces(readCurrentContent(filename)); - String newContent = unifySpaces(contentWithoutTag.toString().trim()); + String newContent = unifySpaces(contentWithoutTag.toString()); if (fileContent.equals(newContent)) { SystemOut.println(getClass().getSimpleName() + ": Not updating " + filename + " since looks to be the same content, new content size=" + contentWithoutTag.length()); return; @@ -60,9 +60,9 @@ public class LazyFile implements Output { fw.close(); } - private static String unifySpaces(String line) { + public static String unifySpaces(String line) { line = line.replace("\r", ""); - return line.replaceAll("\n[\n]*", "\n").trim(); + return line.replaceAll("\n[\n]*", ""); } private String readCurrentContent(String filename) throws IOException { diff --git a/java_tools/enum_to_string/src/com/rusefi/util/test/LazyFileTest.java b/java_tools/enum_to_string/src/com/rusefi/util/test/LazyFileTest.java new file mode 100644 index 0000000000..3f5cb7ed6b --- /dev/null +++ b/java_tools/enum_to_string/src/com/rusefi/util/test/LazyFileTest.java @@ -0,0 +1,13 @@ +package com.rusefi.util.test; + +import com.rusefi.util.LazyFile; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class LazyFileTest { + @Test + public void testUnifySpaces() { + assertEquals("abc", LazyFile.unifySpaces("a\r\n\r\nb\n\n\nc")); + } +}