refactoring: merging state into state
This commit is contained in:
parent
4671ff812a
commit
3cc39848c3
|
@ -82,8 +82,6 @@ public class ConfigDefinition {
|
||||||
String tsOutputsDestination = null;
|
String tsOutputsDestination = null;
|
||||||
String definitionInputFile = null;
|
String definitionInputFile = null;
|
||||||
|
|
||||||
// used to update other files
|
|
||||||
List<String> inputFiles = new ArrayList<>();
|
|
||||||
|
|
||||||
List<ConfigurationConsumer> destinations = new ArrayList<>();
|
List<ConfigurationConsumer> destinations = new ArrayList<>();
|
||||||
ReaderState state = new ReaderState();
|
ReaderState state = new ReaderState();
|
||||||
|
@ -99,7 +97,7 @@ public class ConfigDefinition {
|
||||||
// lame: order of command line arguments is important, this arguments should be AFTER '-tool' argument
|
// lame: order of command line arguments is important, this arguments should be AFTER '-tool' argument
|
||||||
definitionInputFile = args[i + 1];
|
definitionInputFile = args[i + 1];
|
||||||
state.headerMessage = ToolUtil.getGeneratedAutomaticallyTag() + definitionInputFile + " " + new Date();
|
state.headerMessage = ToolUtil.getGeneratedAutomaticallyTag() + definitionInputFile + " " + new Date();
|
||||||
inputFiles.add(definitionInputFile);
|
state.inputFiles.add(definitionInputFile);
|
||||||
break;
|
break;
|
||||||
case KEY_TS_DESTINATION:
|
case KEY_TS_DESTINATION:
|
||||||
tsInputFileFolder = args[i + 1];
|
tsInputFileFolder = args[i + 1];
|
||||||
|
@ -133,10 +131,10 @@ public class ConfigDefinition {
|
||||||
// yes, we take three parameters here thus pre-increment!
|
// yes, we take three parameters here thus pre-increment!
|
||||||
String fileName = args[++i + 1];
|
String fileName = args[++i + 1];
|
||||||
state.variableRegistry.register(keyName, IoUtil2.readFile(fileName));
|
state.variableRegistry.register(keyName, IoUtil2.readFile(fileName));
|
||||||
inputFiles.add(fileName);
|
state.inputFiles.add(fileName);
|
||||||
case KEY_FIRING:
|
case KEY_FIRING:
|
||||||
firingEnumFileName = args[i + 1];
|
firingEnumFileName = args[i + 1];
|
||||||
inputFiles.add(firingEnumFileName);
|
state.inputFiles.add(firingEnumFileName);
|
||||||
break;
|
break;
|
||||||
case "-triggerFolder":
|
case "-triggerFolder":
|
||||||
triggersFolder = args[i + 1];
|
triggersFolder = args[i + 1];
|
||||||
|
@ -146,7 +144,7 @@ public class ConfigDefinition {
|
||||||
break;
|
break;
|
||||||
case KEY_PREPEND:
|
case KEY_PREPEND:
|
||||||
prependFiles.add(args[i + 1]);
|
prependFiles.add(args[i + 1]);
|
||||||
inputFiles.add(args[i + 1]);
|
state.inputFiles.add(args[i + 1]);
|
||||||
break;
|
break;
|
||||||
case KEY_SIGNATURE:
|
case KEY_SIGNATURE:
|
||||||
signaturePrependFile = args[i + 1];
|
signaturePrependFile = args[i + 1];
|
||||||
|
@ -165,20 +163,20 @@ public class ConfigDefinition {
|
||||||
case KEY_ROMRAIDER_INPUT:
|
case KEY_ROMRAIDER_INPUT:
|
||||||
String inputFilePath = args[i + 1];
|
String inputFilePath = args[i + 1];
|
||||||
romRaiderInputFile = inputFilePath + File.separator + ROM_RAIDER_XML_TEMPLATE;
|
romRaiderInputFile = inputFilePath + File.separator + ROM_RAIDER_XML_TEMPLATE;
|
||||||
inputFiles.add(romRaiderInputFile);
|
state.inputFiles.add(romRaiderInputFile);
|
||||||
break;
|
break;
|
||||||
case KEY_BOARD_NAME:
|
case KEY_BOARD_NAME:
|
||||||
String boardName = args[i + 1];
|
String boardName = args[i + 1];
|
||||||
pinoutLogic = PinoutLogic.create(boardName);
|
pinoutLogic = PinoutLogic.create(boardName);
|
||||||
if (pinoutLogic != null)
|
if (pinoutLogic != null)
|
||||||
inputFiles.addAll(pinoutLogic.getInputFiles());
|
state.inputFiles.addAll(pinoutLogic.getInputFiles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsInputFileFolder != null) {
|
if (tsInputFileFolder != null) {
|
||||||
// used to update .ini files
|
// used to update .ini files
|
||||||
inputFiles.add(TSProjectConsumer.getTsFileInputName(tsInputFileFolder));
|
state.inputFiles.add(TSProjectConsumer.getTsFileInputName(tsInputFileFolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enumInputFiles.isEmpty()) {
|
if (!enumInputFiles.isEmpty()) {
|
||||||
|
@ -191,7 +189,7 @@ public class ConfigDefinition {
|
||||||
|
|
||||||
ParseState parseState = new ParseState(state.enumsReader);
|
ParseState parseState = new ParseState(state.enumsReader);
|
||||||
// Add the variable for the config signature
|
// Add the variable for the config signature
|
||||||
long crc32 = IoUtil2.signatureHash(state, parseState, tsInputFileFolder, inputFiles);
|
long crc32 = IoUtil2.signatureHash(state, parseState, tsInputFileFolder, state.inputFiles);
|
||||||
|
|
||||||
ExtraUtil.handleFiringOrder(firingEnumFileName, state.variableRegistry, parseState);
|
ExtraUtil.handleFiringOrder(firingEnumFileName, state.variableRegistry, parseState);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ import static com.rusefi.ConfigField.BOOLEAN_T;
|
||||||
* 12/19/18
|
* 12/19/18
|
||||||
*/
|
*/
|
||||||
public class ReaderState {
|
public class ReaderState {
|
||||||
|
// used to update other files
|
||||||
|
public List<String> inputFiles = new ArrayList<>();
|
||||||
|
|
||||||
private static final Logging log = getLogging(ReaderState.class);
|
private static final Logging log = getLogging(ReaderState.class);
|
||||||
|
|
||||||
public static final String BIT = "bit";
|
public static final String BIT = "bit";
|
||||||
|
|
Loading…
Reference in New Issue