automation should be automated
todo: move output files to "generated" folder
This commit is contained in:
parent
bd1d1fb58f
commit
75b33bc1a3
|
@ -57,4 +57,7 @@ IF NOT ERRORLEVEL 0 EXIT /B 1
|
||||||
|
|
||||||
|
|
||||||
cd config\boards\kinetis\config
|
cd config\boards\kinetis\config
|
||||||
!gen_config.bat
|
call !gen_config.bat
|
||||||
|
pwd
|
||||||
|
|
||||||
|
call gen_enum_to_string.bat
|
||||||
|
|
Binary file not shown.
|
@ -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>
|
|
@ -89,11 +89,10 @@ public class EnumToString {
|
||||||
SystemOut.println("Reading enums from " + inFileName);
|
SystemOut.println("Reading enums from " + inFileName);
|
||||||
String simpleFileName = f.getName();
|
String simpleFileName = f.getName();
|
||||||
|
|
||||||
bothFilesHeader.insert(0, "// " +
|
bothFilesHeader.insert(0, "// " + LazyFile.LAZY_FILE_TAG + " from " + simpleFileName + " ");
|
||||||
LazyFile.LAZY_FILE_TAG + " from " + simpleFileName + " ");
|
|
||||||
|
|
||||||
includesSection.append("#include \"" + simpleFileName + "\"\n");
|
includesSection.append("#include \"" + simpleFileName + "\"\n");
|
||||||
EnumsReader.process(new FileReader(inFileName));
|
EnumsReader.process(new FileReader(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void outputData() {
|
public static void outputData() {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class LazyFile implements Output {
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
String fileContent = unifySpaces(readCurrentContent(filename));
|
String fileContent = unifySpaces(readCurrentContent(filename));
|
||||||
String newContent = unifySpaces(contentWithoutTag.toString().trim());
|
String newContent = unifySpaces(contentWithoutTag.toString());
|
||||||
if (fileContent.equals(newContent)) {
|
if (fileContent.equals(newContent)) {
|
||||||
SystemOut.println(getClass().getSimpleName() + ": Not updating " + filename + " since looks to be the same content, new content size=" + contentWithoutTag.length());
|
SystemOut.println(getClass().getSimpleName() + ": Not updating " + filename + " since looks to be the same content, new content size=" + contentWithoutTag.length());
|
||||||
return;
|
return;
|
||||||
|
@ -60,9 +60,9 @@ public class LazyFile implements Output {
|
||||||
fw.close();
|
fw.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String unifySpaces(String line) {
|
public static String unifySpaces(String line) {
|
||||||
line = line.replace("\r", "");
|
line = line.replace("\r", "");
|
||||||
return line.replaceAll("\n[\n]*", "\n").trim();
|
return line.replaceAll("\n[\n]*", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readCurrentContent(String filename) throws IOException {
|
private String readCurrentContent(String filename) throws IOException {
|
||||||
|
|
|
@ -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"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue