automation should be automated

todo: move output files to "generated" folder
This commit is contained in:
rusefi 2020-05-20 11:13:42 -04:00
parent f0bd4f033d
commit 2a1dec3472
6 changed files with 38 additions and 7 deletions

View File

@ -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

Binary file not shown.

View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="EnumToString" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rusefi.EnumToString" />
<module name="enum_to_string" />
<option name="PROGRAM_PARAMETERS" value="-inputPath ../../firmware -outputPath ../firmware/controllers/algo -enumInputFile controllers/algo/rusefi_enums.h -enumInputFile controllers/algo/rusefi_hw_enums.h" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rusefi.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -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() {

View File

@ -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 {

View File

@ -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"));
}
}