code generator progress

This commit is contained in:
rusefi 2019-05-27 17:44:10 -04:00
parent 8df2320432
commit bf362f46b5
4 changed files with 11 additions and 9 deletions

View File

@ -5,7 +5,7 @@ rem the storage section of rusefi.ini is updated as well
rem lazy is broken - TS input is not considered a change rem lazy is broken - TS input is not considered a change
rm build/config.gen rm build/config.gen
java -jar ../java_tools/ConfigDefinition.jar -definition integration\rusefi_config.txt -romraider integration -ts_destination tunerstudio -c_destination controllers\algo -java_destination ../java_console -skip build/config.gen java -jar ../java_tools/ConfigDefinition.jar -definition integration\rusefi_config.txt -romraider integration -ts_destination tunerstudio -c_defines controllers\algo\rusefi_generated.h -c_destination controllers\algo\engine_configuration_generated_structures.h -java_destination ../java_console -skip build/config.gen
rem This would automatically copy latest file to 'dev' TS project rem This would automatically copy latest file to 'dev' TS project

Binary file not shown.

View File

@ -24,11 +24,11 @@ public class ConfigDefinition {
private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml"; private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml";
private static final String ROM_RAIDER_XML_OUTPUT = "rusefi.xml"; private static final String ROM_RAIDER_XML_OUTPUT = "rusefi.xml";
private static final String ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H = "engine_configuration_generated_structures.h";
private static final String KEY_DEFINITION = "-definition"; private static final String KEY_DEFINITION = "-definition";
private static final String KEY_ROM_INPUT = "-romraider"; private static final String KEY_ROM_INPUT = "-romraider";
private static final String KEY_TS_DESTINATION = "-ts_destination"; private static final String KEY_TS_DESTINATION = "-ts_destination";
private static final String KEY_C_DESTINATION = "-c_destination"; private static final String KEY_C_DESTINATION = "-c_destination";
private static final String KEY_C_DEFINES = "-c_defines";
private static final String KEY_CONSOLE_DESTINATION = "-java_destination"; private static final String KEY_CONSOLE_DESTINATION = "-java_destination";
private static final String KEY_PREPEND = "-prepend"; private static final String KEY_PREPEND = "-prepend";
private static final String KEY_SKIP = "-skip"; private static final String KEY_SKIP = "-skip";
@ -48,7 +48,8 @@ public class ConfigDefinition {
String definitionInputFile = null; String definitionInputFile = null;
String tsPath = null; String tsPath = null;
String headerDestinationFolder = null; String destCHeader = null;
String destCDefines = null;
String javaConsolePath = null; String javaConsolePath = null;
String prependFile = null; String prependFile = null;
String skipRebuildFile = null; String skipRebuildFile = null;
@ -61,7 +62,9 @@ public class ConfigDefinition {
} else if (key.equals(KEY_TS_DESTINATION)) { } else if (key.equals(KEY_TS_DESTINATION)) {
tsPath = args[i + 1]; tsPath = args[i + 1];
} else if (key.equals(KEY_C_DESTINATION)) { } else if (key.equals(KEY_C_DESTINATION)) {
headerDestinationFolder = args[i + 1]; destCHeader = args[i + 1];
} else if (key.equals(KEY_C_DEFINES)) {
destCDefines = args[i + 1];
} else if (key.equals(KEY_CONSOLE_DESTINATION)) { } else if (key.equals(KEY_CONSOLE_DESTINATION)) {
javaConsolePath = args[i + 1]; javaConsolePath = args[i + 1];
} else if (key.equals(KEY_PREPEND)) { } else if (key.equals(KEY_PREPEND)) {
@ -86,8 +89,6 @@ public class ConfigDefinition {
return; return;
} }
} }
String destCHeader = headerDestinationFolder + File.separator + ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H;
System.out.println("Writing C header to " + destCHeader);
if (prependFile != null) if (prependFile != null)
readPrependValues(prependFile); readPrependValues(prependFile);
@ -98,6 +99,7 @@ public class ConfigDefinition {
List<ConfigurationConsumer> destinations = new ArrayList<>(); List<ConfigurationConsumer> destinations = new ArrayList<>();
BufferedWriter cHeader = null; BufferedWriter cHeader = null;
if (destCHeader != null) { if (destCHeader != null) {
System.out.println("Writing C header to " + destCHeader);
cHeader = new BufferedWriter(new FileWriter(destCHeader)); cHeader = new BufferedWriter(new FileWriter(destCHeader));
destinations.add(new CHeaderConsumer(cHeader)); destinations.add(new CHeaderConsumer(cHeader));
} }
@ -118,7 +120,8 @@ public class ConfigDefinition {
cHeader.close(); cHeader.close();
VariableRegistry.INSTANCE.writeNumericsToFile(headerDestinationFolder); if (destCDefines != null)
VariableRegistry.INSTANCE.writeNumericsToFile(destCDefines);
if (javaConsolePath != null && romRaiderInputFile != null) { if (javaConsolePath != null && romRaiderInputFile != null) {
String inputFileName = romRaiderInputFile + File.separator + ROM_RAIDER_XML_TEMPLATE; String inputFileName = romRaiderInputFile + File.separator + ROM_RAIDER_XML_TEMPLATE;

View File

@ -94,8 +94,7 @@ public class VariableRegistry extends TreeMap<String, String> {
register(name + "_hex", Integer.toString(value, 16)); register(name + "_hex", Integer.toString(value, 16));
} }
public void writeNumericsToFile(String headerDestinationFolder) throws IOException { public void writeNumericsToFile(String fileName) throws IOException {
String fileName = headerDestinationFolder + File.separator + "rusefi_generated.h";
System.out.println("Writing to " + fileName); System.out.println("Writing to " + fileName);
BufferedWriter cHeader = new BufferedWriter(new FileWriter(fileName)); BufferedWriter cHeader = new BufferedWriter(new FileWriter(fileName));