parent
f59c4cffe0
commit
ebeed4e9ea
|
@ -287,12 +287,12 @@ public class ReaderStateImpl implements ReaderState {
|
|||
} else if (ToolUtil.startsWithToken(line, CUSTOM)) {
|
||||
handleCustomLine(line);
|
||||
|
||||
} else if (ToolUtil.startsWithToken(line, VariableRegistry.DEFINE)) {
|
||||
} else if (VariableRegistry.looksLikeDefineLine(line)) {
|
||||
/**
|
||||
* for example
|
||||
* #define CLT_CURVE_SIZE 16
|
||||
*/
|
||||
variableRegistry.processDefine(line.substring(VariableRegistry.DEFINE.length()).trim());
|
||||
variableRegistry.processLine(line);
|
||||
} else {
|
||||
if (isStackEmpty())
|
||||
throw new IllegalStateException("Expected to be within structure at line " + lineIndex + ": " + line);
|
||||
|
|
|
@ -25,6 +25,7 @@ public class LiveDataProcessor {
|
|||
public static final String STATE_DICTIONARY_FACTORY_JAVA = "../java_console/io/src/main/java/com/rusefi/enums/StateDictionaryFactory.java";
|
||||
public static final String FANCY_CONTENT_INI = "console/binary/generated/fancy_content.ini";
|
||||
public static final String FANCY_MENU_INI = "console/binary/generated/fancy_menu.ini";
|
||||
public static final String JAVA_DESTINATION = "../java_console/models/src/main/java/com/rusefi/config/generated/";
|
||||
|
||||
private final ReaderProvider readerProvider;
|
||||
private final LazyFile.LazyFileFactory fileFactory;
|
||||
|
@ -161,7 +162,7 @@ public class LiveDataProcessor {
|
|||
state.addCHeaderDestination(folder + File.separator + name + "_generated.h");
|
||||
|
||||
int baseOffset = outputsSections.getBaseOffset();
|
||||
state.addDestination(new FileJavaFieldsConsumer(state, "../java_console/models/src/main/java/com/rusefi/config/generated/" + javaName, baseOffset, fileFactory));
|
||||
state.addDestination(new FileJavaFieldsConsumer(state, JAVA_DESTINATION + javaName, baseOffset, fileFactory));
|
||||
|
||||
if (constexpr != null) {
|
||||
sdCardFieldsConsumer.home = constexpr;
|
||||
|
|
|
@ -33,11 +33,19 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
|
|||
|
||||
@Override
|
||||
public void startFile() {
|
||||
javaFields.write("package " + JAVA_PACKAGE + ";" + ToolUtil.EOL + ToolUtil.EOL);
|
||||
writePackageLine(javaFields);
|
||||
javaFields.write("// this file " + state.getHeader() + ToolUtil.EOL + EOL);
|
||||
javaFields.write("// by " + getClass() + EOL);
|
||||
javaFields.write("import com.rusefi.config.*;" + EOL + EOL);
|
||||
javaFields.write("public class " + className + " {" + ToolUtil.EOL);
|
||||
writeClassOpenLine(javaFields, className);
|
||||
}
|
||||
|
||||
public static void writeClassOpenLine(LazyFile lazyFile, String className1) {
|
||||
lazyFile.write("public class " + className1 + " {" + ToolUtil.EOL);
|
||||
}
|
||||
|
||||
public static void writePackageLine(LazyFile lazyFile) {
|
||||
lazyFile.write("package " + JAVA_PACKAGE + ";" + ToolUtil.EOL + ToolUtil.EOL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,6 +56,10 @@ public class VariableRegistry {
|
|||
return token;
|
||||
}
|
||||
|
||||
static boolean looksLikeDefineLine(String line) {
|
||||
return ToolUtil.startsWithToken(line, DEFINE);
|
||||
}
|
||||
|
||||
public void readPrependValues(String prependFile, boolean ignoreUnexpectedLined) {
|
||||
File file = new File(RootHolder.ROOT + prependFile);
|
||||
try {
|
||||
|
@ -83,6 +87,10 @@ public class VariableRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
void processLine(String line) {
|
||||
processDefine(line.substring(VariableRegistry.DEFINE.length()).trim());
|
||||
}
|
||||
|
||||
void processDefine(String line) {
|
||||
int index = line.indexOf(' ');
|
||||
String name;
|
||||
|
|
Loading…
Reference in New Issue