mirror of https://github.com/rusefi/rusefi.git
better argument name and better argument content
This commit is contained in:
parent
2479542aac
commit
0f0602e205
|
@ -8,7 +8,7 @@ COMMON_GEN_CONFIG="
|
|||
-readfile LIVE_DATA_MENU_FROM_FILE console/binary/generated/fancy_menu.ini \
|
||||
-readfile LIVE_DATA_PANELS_FROM_FILE console/binary/generated/fancy_content.ini \
|
||||
-readfile LIVE_DATA_GAUGES_FROM_FILE console/binary/generated/gauges.ini \
|
||||
-ts_destination tunerstudio \
|
||||
-ts_template tunerstudio/rusefi.input \
|
||||
-triggerInputFolder ../unit_tests \
|
||||
-with_c_defines false \
|
||||
-field_lookup_file controllers/lua/generated/value_lookup_generated.cpp controllers/lua/generated/value_lookup_generated.md \
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ConfigDefinition {
|
|||
public static final String SIGNATURE_HASH = "SIGNATURE_HASH";
|
||||
|
||||
private static final String KEY_DEFINITION = "-definition";
|
||||
private static final String KEY_TS_DESTINATION = "-ts_destination";
|
||||
private static final String KEY_TS_TEMPLATE = "-ts_template";
|
||||
private static final String KEY_C_DESTINATION = "-c_destination";
|
||||
private static final String KEY_C_DEFINES = "-c_defines";
|
||||
public static final String KEY_WITH_C_DEFINES = "-with_c_defines";
|
||||
|
@ -43,7 +43,7 @@ public class ConfigDefinition {
|
|||
if (totalArgs.length < 2) {
|
||||
SystemOut.println("Please specify\r\n"
|
||||
+ KEY_DEFINITION + " x\r\n"
|
||||
+ KEY_TS_DESTINATION + " x\r\n"
|
||||
+ KEY_TS_TEMPLATE + " x\r\n"
|
||||
+ KEY_C_DESTINATION + " x\r\n"
|
||||
+ KEY_JAVA_DESTINATION + " x\r\n"
|
||||
);
|
||||
|
@ -62,7 +62,7 @@ public class ConfigDefinition {
|
|||
public static void doJob(String[] args, ReaderStateImpl state) throws IOException {
|
||||
SystemOut.println(ConfigDefinition.class + " Invoked with " + Arrays.toString(args));
|
||||
|
||||
String tsInputFileFolder = null;
|
||||
String tsTemplateFile = null;
|
||||
|
||||
DefinitionsState parseState = state.getEnumsReader().parseState;
|
||||
String signatureDestination = null;
|
||||
|
@ -81,8 +81,8 @@ public class ConfigDefinition {
|
|||
// lame: order of command line arguments is important, these arguments should be AFTER '-tool' argument
|
||||
state.setDefinitionInputFile(args[i + 1]);
|
||||
break;
|
||||
case KEY_TS_DESTINATION:
|
||||
tsInputFileFolder = args[i + 1];
|
||||
case KEY_TS_TEMPLATE:
|
||||
tsTemplateFile = args[i + 1];
|
||||
break;
|
||||
case KEY_C_DESTINATION:
|
||||
state.addCHeaderDestination(args[i + 1]);
|
||||
|
@ -162,24 +162,24 @@ public class ConfigDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
if (tsInputFileFolder != null) {
|
||||
if (tsTemplateFile != null) {
|
||||
// used to update .ini files
|
||||
state.addInputFile(TSProjectConsumer.getTsFileInputName(tsInputFileFolder));
|
||||
state.addInputFile(tsTemplateFile);
|
||||
}
|
||||
|
||||
SystemOut.println(state.getEnumsReader().getEnums().size() + " total enumsReader");
|
||||
|
||||
// Add the variable for the config signature
|
||||
FirmwareVersion uniqueId = new FirmwareVersion(IoUtil2.getCrc32(state.getInputFiles()));
|
||||
SignatureConsumer.storeUniqueBuildId(state, parseState, tsInputFileFolder, uniqueId);
|
||||
SignatureConsumer.storeUniqueBuildId(state, parseState, tsTemplateFile, uniqueId);
|
||||
|
||||
|
||||
if (pinoutLogic != null) {
|
||||
pinoutLogic.registerBoardSpecificPinNames(state.getVariableRegistry(), parseState, state.getEnumsReader());
|
||||
}
|
||||
|
||||
if (tsInputFileFolder != null) {
|
||||
state.addDestination(new TSProjectConsumer(tsInputFileFolder, state));
|
||||
if (tsTemplateFile != null) {
|
||||
state.addDestination(new TSProjectConsumer(tsTemplateFile, state));
|
||||
|
||||
VariableRegistry tmpRegistry = new VariableRegistry();
|
||||
// store the CRC32 as a built-in variable
|
||||
|
|
|
@ -14,7 +14,6 @@ import static com.rusefi.util.IoUtils.CHARSET;
|
|||
* [Constants]
|
||||
*/
|
||||
public class TSProjectConsumer implements ConfigurationConsumer {
|
||||
private static final String TS_FILE_INPUT_NAME = "rusefi.input";
|
||||
private static final String CONFIG_DEFINITION_START = "CONFIG_DEFINITION_START";
|
||||
private static final String CONFIG_DEFINITION_END = "CONFIG_DEFINITION_END";
|
||||
private static final String TS_CONDITION = "@@if_";
|
||||
|
@ -39,12 +38,12 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
return tsOutput.getSettingContextHelp();
|
||||
}
|
||||
|
||||
protected void writeTunerStudioFile(String tsPath, String fieldsSection) throws IOException {
|
||||
TsFileContent tsContent = readTsTemplateInputFile(tsPath);
|
||||
SystemOut.println("Got " + tsContent.getPrefix().length() + "/" + tsContent.getPostfix().length() + " of " + TS_FILE_INPUT_NAME);
|
||||
protected void writeTunerStudioFile(String inputFile, String fieldsSection) throws IOException {
|
||||
TsFileContent tsContent = readTsTemplateInputFile(inputFile);
|
||||
SystemOut.println("Got " + tsContent.getPrefix().length() + "/" + tsContent.getPostfix().length() + " of " + inputFile);
|
||||
|
||||
// File.getPath() would eliminate potential separator at the end of the path
|
||||
String fileName = getTsFileOutputName(new File(ConfigDefinitionRootOutputFolder.getValue() + tsPath).getPath());
|
||||
String fileName = getTsFileOutputName(new File(ConfigDefinitionRootOutputFolder.getValue() + inputFile).getPath());
|
||||
Output tsHeader = new LazyFileImpl(fileName);
|
||||
writeContent(fieldsSection, tsContent, tsHeader);
|
||||
}
|
||||
|
@ -73,8 +72,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
* rusefi.input has all the content of the future .ini file with the exception of data page
|
||||
* TODO: start generating [outputs] section as well
|
||||
*/
|
||||
private TsFileContent readTsTemplateInputFile(String tsPath) throws IOException {
|
||||
String fileName = getTsFileInputName(tsPath);
|
||||
private TsFileContent readTsTemplateInputFile(String fileName) throws IOException {
|
||||
FileInputStream in = new FileInputStream(fileName);
|
||||
return getTsFileContent(in);
|
||||
}
|
||||
|
@ -148,10 +146,6 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
return tsPath + File.separator + state.getTsFileOutputName();
|
||||
}
|
||||
|
||||
public static String getTsFileInputName(String tsPath) {
|
||||
return tsPath + File.separator + TS_FILE_INPUT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
writeTunerStudioFile(tsPath, getContent());
|
||||
|
|
|
@ -24,7 +24,7 @@ public class BitParsingTest {
|
|||
|
||||
TSProjectConsumer javaFieldsConsumer = new TSProjectConsumer("", state) {
|
||||
@Override
|
||||
protected void writeTunerStudioFile(String tsPath, String fieldsSection) throws IOException {
|
||||
protected void writeTunerStudioFile(String inputFile, String fieldsSection) throws IOException {
|
||||
writeContent(fieldsSection, new TsFileContent("", ""), createOutput(sw));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue