TriggerMetaGenerator has hardcoded paths fix #6129

This commit is contained in:
rusefillc 2024-03-03 21:16:06 -05:00
parent 841acbe408
commit e2d8c1357e
4 changed files with 22 additions and 16 deletions

View File

@ -9,8 +9,8 @@ cd ../firmware
java -DSystemOut.name=logs/gen_live_documentation \
-cp ../java_tools/configuration_definition_base/build/libs/config_definition_base-all.jar \
com.rusefi.ldmp.LiveDataProcessor integration/LiveData.yaml
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
com.rusefi.ldmp.LiveDataProcessor integration/LiveData.yaml integration/rusefi_config_trigger.txt ../unit_tests/test-framework/trigger_meta_generated.h ../java_tools/trigger-image/src/main/java/com/rusefi/config/generated/TriggerMeta.java
[ $? -eq 0 ] || { echo "ERROR generating with LiveDataProcessor"; exit 1; }
java -DSystemOut.name=logs/gen_java_enum -cp ../java_tools/enum_to_string/build/libs/enum_to_string-all.jar com.rusefi.ToJavaEnum -enumInputFile console/binary/generated/live_data_ids.h -outputPath ../java_console/io/src/main/java/com/rusefi/enums
[ $? -eq 0 ] || { echo "ERROR generating live data ids"; exit 1; }

View File

@ -117,8 +117,12 @@ public class ReaderStateImpl implements ReaderState {
* the destinations/writers
*/
SystemOut.println("Reading definition from " + Objects.requireNonNull(definitionInputFile));
BufferedReader definitionReader = new BufferedReader(readerProvider.read(RootHolder.ROOT + definitionInputFile));
readBufferedReader(definitionReader, destinations);
String fileNameWithRoot = RootHolder.ROOT + definitionInputFile;
try (BufferedReader definitionReader = new BufferedReader(readerProvider.read(fileNameWithRoot))) {
readBufferedReader(definitionReader, destinations);
} catch (Throwable e) {
throw new IllegalStateException("While processing " + fileNameWithRoot);
}
if (destCDefinesFileName != null) {
CHeaderConsumer.writeDefinesToFile(getVariableRegistry(), ConfigDefinitionRootOutputFolder.getValue() + destCDefinesFileName, definitionInputFile);

View File

@ -3,12 +3,14 @@ package com.rusefi;
import java.io.IOException;
public class TriggerMetaGenerator {
public static void main(String[] a) throws IOException {
public static void doJob(String definitionInputFileName, String headerFileName, String javaDestinationFileName) throws IOException {
System.out.println("Running with definitionInputFileName=[" + definitionInputFileName + "]");
System.out.println("Running with headerFileName=[" + headerFileName + "]");
System.out.println("Running with javaDestinationFileName=[" + javaDestinationFileName + "]");
ReaderStateImpl reader = new ReaderStateImpl();
reader.setDefinitionInputFile("integration/rusefi_config_trigger.txt");
reader.addCHeaderDestination("../unit_tests/test-framework/trigger_meta_generated.h");
reader.addJavaDestination("../java_tools/trigger-image/src/main/java/com/rusefi/config/generated/TriggerMeta.java");
reader.setDefinitionInputFile(definitionInputFileName);
reader.addCHeaderDestination(headerFileName);
reader.addJavaDestination(javaDestinationFileName);
reader.doJob();
}
}

View File

@ -7,10 +7,7 @@ import com.rusefi.util.LazyFile;
import org.yaml.snakeyaml.Yaml;
import java.io.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class LiveDataProcessor {
private final static Logging log = Logging.getLogging(LiveDataProcessor.class);
@ -60,12 +57,15 @@ public class LiveDataProcessor {
}
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("One parameter expected: name of live data yaml input file");
if (args.length != 4) {
System.err.println("Four arguments expected: name of live data yaml input file and else but got " + Arrays.toString(args));
System.exit(-1);
}
TriggerMetaGenerator.main(null);
String yamlFileName = args[0];
String definitionInputFileName = args[1];
String headerFileName = args[2];
String javaDestinationFileName = args[3];
TriggerMetaGenerator.doJob(definitionInputFileName, headerFileName, javaDestinationFileName);
Map<String, Object> data = getStringObjectMap(new FileReader(yamlFileName));