diff --git a/java_console/logging/src/main/java/com/rusefi/util/LazyFile.java b/java_console/logging/src/main/java/com/rusefi/util/LazyFile.java index 01490b42bf..d100572339 100644 --- a/java_console/logging/src/main/java/com/rusefi/util/LazyFile.java +++ b/java_console/logging/src/main/java/com/rusefi/util/LazyFile.java @@ -11,7 +11,6 @@ import java.util.regex.Pattern; public class LazyFile implements Output { public static final String LAZY_FILE_TAG = "was generated automatically by rusEFI tool "; public static final String LAZY_FILE_TAG_LOWER = LAZY_FILE_TAG.toLowerCase(); - private static boolean isLazyCheckEnabled = true; private final String filename; @@ -38,7 +37,7 @@ public class LazyFile implements Output { String fileContent = unifySpaces(readCurrentContent(filename)); String newContent = unifySpaces(contentWithoutTag.toString()); - if (fileContent.equals(newContent) && LazyFile.isLazyCheckEnabled()) { + if (fileContent.equals(newContent)) { SystemOut.println(getClass().getSimpleName() + ": Not updating " + filename + " since looks to be the same content, new content size=" + contentWithoutTag.length()); return; } @@ -57,14 +56,6 @@ public class LazyFile implements Output { fw.close(); } - public static void setLazyFileEnabled(boolean isEnabled) { - LazyFile.isLazyCheckEnabled = isEnabled; - } - - public static boolean isLazyCheckEnabled() { - return LazyFile.isLazyCheckEnabled; - } - public static String unifySpaces(String line) { line = line.replace("\r", ""); return line.replaceAll("\n[\n]*", ""); diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index 5866c3367f..0157b30344 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/ConfigDefinition.java b/java_tools/configuration_definition/src/main/java/com/rusefi/ConfigDefinition.java index 39348aa790..5e86362dc2 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/ConfigDefinition.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/ConfigDefinition.java @@ -4,7 +4,6 @@ import com.rusefi.newparse.ParseState; import com.rusefi.newparse.parsing.Definition; import com.rusefi.output.*; import com.rusefi.util.IoUtils; -import com.rusefi.util.LazyFile; import com.rusefi.util.SystemOut; import java.io.*; @@ -26,9 +25,6 @@ public class ConfigDefinition { private static final String KEY_TS_DESTINATION = "-ts_destination"; private static final String KEY_C_DESTINATION = "-c_destination"; private static final String KEY_C_DEFINES = "-c_defines"; - /** - * @see CHeaderConsumer#withC_Defines - */ private static final String KEY_WITH_C_DEFINES = "-with_c_defines"; private static final String KEY_JAVA_DESTINATION = "-java_destination"; private static final String KEY_ROMRAIDER_DESTINATION = "-romraider_destination"; @@ -81,15 +77,13 @@ public class ConfigDefinition { String signatureDestination = null; String signaturePrependFile = null; List enumInputFiles = new ArrayList<>(); - CHeaderConsumer.withC_Defines = true; + boolean withC_Defines = true; File[] boardYamlFiles = null; String tsOutputsDestination = null; String definitionInputFile = null; // used to update other files List inputFiles = new ArrayList<>(); - // disable the lazy checks because we use timestamps to detect changes - LazyFile.setLazyFileEnabled(true); List destinations = new ArrayList<>(); ReaderState state = new ReaderState(); @@ -111,13 +105,13 @@ public class ConfigDefinition { tsOutputsDestination = args[i + 1]; break; case KEY_C_DESTINATION: - destinations.add(new CHeaderConsumer(state.variableRegistry, args[i + 1])); + destinations.add(new CHeaderConsumer(state.variableRegistry, args[i + 1], withC_Defines)); break; case KEY_ZERO_INIT: needZeroInit = Boolean.parseBoolean(args[i + 1]); break; case KEY_WITH_C_DEFINES: - CHeaderConsumer.withC_Defines = Boolean.parseBoolean(args[i + 1]); + withC_Defines = Boolean.parseBoolean(args[i + 1]); break; case KEY_C_DEFINES: destCDefinesFileName = args[i + 1]; diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/output/CHeaderConsumer.java b/java_tools/configuration_definition/src/main/java/com/rusefi/output/CHeaderConsumer.java index 044608f5f1..20827b2587 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/output/CHeaderConsumer.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/output/CHeaderConsumer.java @@ -16,12 +16,13 @@ public class CHeaderConsumer extends BaseCHeaderConsumer { * looks like sometimes we want to not include "define XXX value" into generated C headers * TODO: document the use-case better */ - public static boolean withC_Defines; + private final boolean withC_Defines; private final LazyFile cHeader; private final VariableRegistry variableRegistry; - public CHeaderConsumer(VariableRegistry variableRegistry, String destCHeader) { + public CHeaderConsumer(VariableRegistry variableRegistry, String destCHeader, boolean withC_Defines) { this.variableRegistry = variableRegistry; + this.withC_Defines = withC_Defines; SystemOut.println("Writing C header to " + destCHeader); cHeader = new LazyFile(destCHeader); cHeader.write("// this section " + ConfigDefinition.MESSAGE + EOL);