don't print the date in generated files, rely on git for that
This commit is contained in:
parent
ed3eabb14a
commit
e4c4da2b20
|
@ -32,7 +32,6 @@ echo "Using COMMON_GEN_CONFIG [$COMMON_GEN_CONFIG]"
|
|||
|
||||
java \
|
||||
$COMMON_GEN_CONFIG_PREFIX \
|
||||
-tool ${BOARD_DIR}/config/gen_subaru_config.sh \
|
||||
$COMMON_GEN_CONFIG \
|
||||
-c_defines ${BOARD_DIR}/config/controllers/algo/rusefi_generated.h \
|
||||
-c_destination ${BOARD_DIR}/config/controllers/algo/engine_configuration_generated_structures.h \
|
||||
|
|
|
@ -41,10 +41,8 @@ source gen_config_common.sh
|
|||
echo "Using COMMON_GEN_CONFIG [$COMMON_GEN_CONFIG]"
|
||||
|
||||
# work in progress: migrating to fome_${BUNDLE_NAME}.txt
|
||||
# in rare cases order of arguments is important - '-tool' should be specified before '-definition'
|
||||
java \
|
||||
$COMMON_GEN_CONFIG_PREFIX \
|
||||
-tool gen_config.sh \
|
||||
$COMMON_GEN_CONFIG \
|
||||
-enumInputFile controllers/algo/rusefi_hw_enums.h \
|
||||
-c_defines controllers/generated/rusefi_generated.h \
|
||||
|
|
|
@ -75,10 +75,6 @@ public class ConfigDefinition {
|
|||
for (int i = 0; i < args.length - 1; i += 2) {
|
||||
String key = args[i];
|
||||
switch (key) {
|
||||
case "-tool":
|
||||
// lame: order of command line arguments is important
|
||||
ToolUtil.TOOL = args[i + 1];
|
||||
break;
|
||||
case KEY_DEFINITION:
|
||||
// lame: order of command line arguments is important, these arguments should be AFTER '-tool' argument
|
||||
state.setDefinitionInputFile(args[i + 1]);
|
||||
|
@ -219,7 +215,7 @@ public class ConfigDefinition {
|
|||
state.doJob();
|
||||
|
||||
if (destCDefinesFileName != null) {
|
||||
ExtraUtil.writeDefinesToFile(state.getVariableRegistry(), destCDefinesFileName, state.getDefinitionInputFile());
|
||||
ExtraUtil.writeDefinesToFile(state.getVariableRegistry(), destCDefinesFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,11 @@ import com.rusefi.util.SystemOut;
|
|||
import java.io.IOException;
|
||||
|
||||
public class ExtraUtil {
|
||||
public static void writeDefinesToFile(VariableRegistry variableRegistry, String fileName, String headerComment) throws IOException {
|
||||
public static void writeDefinesToFile(VariableRegistry variableRegistry, String fileName) throws IOException {
|
||||
|
||||
SystemOut.println("Writing to " + fileName);
|
||||
LazyFile cHeader = new LazyFile(fileName);
|
||||
|
||||
cHeader.write("//\n// " + ToolUtil.getGeneratedAutomaticallyTag() + headerComment + "\n//\n\n");
|
||||
cHeader.write(variableRegistry.getDefinesSection());
|
||||
cHeader.close();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ public class ReaderStateImpl implements ReaderState {
|
|||
private final Map<String, Integer> tsCustomSize = new HashMap<>();
|
||||
private final Map<String, String> tsCustomLine = new HashMap<>();
|
||||
private final Map<String, ConfigStructureImpl> structures = new HashMap<>();
|
||||
private String headerMessage;
|
||||
// well, technically those should be a builder for state, not this state class itself
|
||||
private String tsFileOutputName = "rusefi.ini";
|
||||
private String definitionInputFile = null;
|
||||
|
@ -339,17 +338,9 @@ public class ReaderStateImpl implements ReaderState {
|
|||
return quote(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader() {
|
||||
if (headerMessage == null)
|
||||
throw new NullPointerException("No header message yet");
|
||||
return headerMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefinitionInputFile(String definitionInputFile) {
|
||||
this.definitionInputFile = definitionInputFile;
|
||||
headerMessage = ToolUtil.getGeneratedAutomaticallyTag() + definitionInputFile + " " + new Date();
|
||||
inputFiles.add(definitionInputFile);
|
||||
}
|
||||
|
||||
|
@ -401,11 +392,6 @@ public class ReaderStateImpl implements ReaderState {
|
|||
return tsCustomLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeaderMessage(String headerMessage) {
|
||||
this.headerMessage = headerMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTsFileOutputName() {
|
||||
return tsFileOutputName;
|
||||
|
|
|
@ -187,7 +187,6 @@ public class StructLayout extends Layout {
|
|||
ps.println("*/");
|
||||
}
|
||||
|
||||
ps.println("// start of " + this.typeName);
|
||||
ps.println("struct " + this.typeName + " {");
|
||||
|
||||
this.children.forEach(c -> c.writeCLayout(ps));
|
||||
|
|
|
@ -15,7 +15,6 @@ public class CStructWriter {
|
|||
|
||||
public void writeCStructs(ParseState parser, PrintStream ps) {
|
||||
ps.println(
|
||||
"// begin\n" +
|
||||
"#pragma once\n" +
|
||||
"#include \"rusefi_types.h\""
|
||||
);
|
||||
|
@ -25,8 +24,6 @@ public class CStructWriter {
|
|||
sl.writeCLayoutRoot(ps);
|
||||
}
|
||||
|
||||
ps.println("// end");
|
||||
|
||||
ps.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
|||
content.append("/**" + EOL + packComment(structure.getComment(), "") + EOL + "*/" + EOL);
|
||||
}
|
||||
|
||||
content.append("// start of " + structure.getName() + EOL);
|
||||
content.append("struct " + structure.getName() + " {" + EOL);
|
||||
|
||||
FieldIteratorWithOffset iterator = new FieldIteratorWithOffset(structure.getcFields());
|
||||
|
|
|
@ -30,9 +30,6 @@ public class CHeaderConsumer extends BaseCHeaderConsumer {
|
|||
this.withC_Defines = withC_Defines;
|
||||
SystemOut.println("Writing C header to " + destCHeader);
|
||||
cHeader = new LazyFile(destCHeader);
|
||||
cHeader.write("// this section " + state.getHeader() + EOL);
|
||||
cHeader.write("// by " + getClass() + EOL);
|
||||
cHeader.write("// begin" + EOL);
|
||||
cHeader.write("#pragma once" + EOL);
|
||||
cHeader.write("#include \"rusefi_types.h\"" + EOL);
|
||||
}
|
||||
|
@ -42,8 +39,6 @@ public class CHeaderConsumer extends BaseCHeaderConsumer {
|
|||
if (withC_Defines)
|
||||
cHeader.write(variableRegistry.getDefinesSection());
|
||||
cHeader.write(getContent().toString());
|
||||
cHeader.write("// end" + EOL);
|
||||
cHeader.write("// this section " + state.getHeader() + EOL);
|
||||
cHeader.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
|
|||
@Override
|
||||
public void startFile() {
|
||||
javaFields.write("package " + JAVA_PACKAGE + ";" + ToolUtil.EOL + ToolUtil.EOL);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,6 @@ public class SignatureConsumer implements ConfigurationConsumer {
|
|||
|
||||
@Override
|
||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||
ExtraUtil.writeDefinesToFile(registry, destHeader, "by SignatureConsumer");
|
||||
ExtraUtil.writeDefinesToFile(registry, destHeader);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
tsHeader.write(tsContent.getPrefix());
|
||||
|
||||
tsHeader.write("; " + CONFIG_DEFINITION_START + ToolUtil.EOL);
|
||||
tsHeader.write("; this section " + state.getHeader() + ToolUtil.EOL + ToolUtil.EOL);
|
||||
tsHeader.write("pageSize = " + totalTsSize + ToolUtil.EOL);
|
||||
tsHeader.write("page = 1" + ToolUtil.EOL);
|
||||
tsHeader.write(fieldsSection);
|
||||
|
|
|
@ -28,7 +28,6 @@ public class BitParsingTest {
|
|||
writeContent(fieldsSection, new TsFileContent("", ""), createOutput(sw));
|
||||
}
|
||||
};
|
||||
state.setHeaderMessage("test");
|
||||
state.readBufferedReader(inputString, javaFieldsConsumer);
|
||||
|
||||
System.out.printf("start[" + sw + "]end");
|
||||
|
|
|
@ -363,8 +363,7 @@ public class ConfigFieldParserTest {
|
|||
"\tpublic static final Field ALIGNMENTFILL_AT_9 = Field.create(\"ALIGNMENTFILL_AT_9\", 9, FieldType.INT8).setScale(1.0).setBaseOffset(0);\n" +
|
||||
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 12, FieldType.BIT, 0).setBaseOffset(0);\n",
|
||||
javaFieldsConsumer.getContent());
|
||||
assertEquals("// start of pid_s\n" +
|
||||
"struct pid_s {\n" +
|
||||
assertEquals("struct pid_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\t * offset 0\n" +
|
||||
"\t */\n" +
|
||||
|
@ -507,8 +506,7 @@ public class ConfigFieldParserTest {
|
|||
state.readBufferedReader(test, consumer, javaFieldsConsumer);
|
||||
assertEquals("\tpublic static final Field FIELD1 = Field.create(\"FIELD1\", 0, FieldType.INT).setScale(0.01).setBaseOffset(0);\n",
|
||||
javaFieldsConsumer.getContent());
|
||||
assertEquals("// start of pid_s\n" +
|
||||
"struct pid_s {\n" +
|
||||
assertEquals("struct pid_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\tratio\n" +
|
||||
"\t * offset 0\n" +
|
||||
|
@ -533,8 +531,7 @@ public class ConfigFieldParserTest {
|
|||
BaseCHeaderConsumer consumer = new BaseCHeaderConsumer();
|
||||
ReaderStateImpl state = new ReaderStateImpl();
|
||||
state.readBufferedReader(test, consumer);
|
||||
assertEquals("// start of struct_s\n" +
|
||||
"struct struct_s {\n" +
|
||||
assertEquals("struct struct_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\t * offset 0\n" +
|
||||
"\t */\n" +
|
||||
|
@ -542,7 +539,6 @@ public class ConfigFieldParserTest {
|
|||
"};\n" +
|
||||
"static_assert(sizeof(struct_s) == 4);\n" +
|
||||
"\n" +
|
||||
"// start of pid_s\n" +
|
||||
"struct pid_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\t * offset 0\n" +
|
||||
|
@ -575,8 +571,7 @@ public class ConfigFieldParserTest {
|
|||
BaseCHeaderConsumer consumer = new BaseCHeaderConsumer();
|
||||
ReaderStateImpl state = new ReaderStateImpl();
|
||||
state.readBufferedReader(test, consumer);
|
||||
assertEquals("// start of pid_s\n" +
|
||||
"struct pid_s {\n" +
|
||||
assertEquals("struct pid_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\t * offset 0\n" +
|
||||
"\t */\n" +
|
||||
|
|
|
@ -66,8 +66,7 @@ public class TSProjectConsumerTest {
|
|||
javaFieldsConsumer.getContent());
|
||||
|
||||
|
||||
assertEquals("// start of pid_s\n" +
|
||||
"struct pid_s {\n" +
|
||||
assertEquals("struct pid_s {\n" +
|
||||
"\t/**\n" +
|
||||
"\t * PID dTime\n" +
|
||||
"\tms\n" +
|
||||
|
|
|
@ -12,8 +12,6 @@ public interface ReaderState {
|
|||
|
||||
void doJob() throws IOException;
|
||||
|
||||
String getHeader();
|
||||
|
||||
void setDefinitionInputFile(String definitionInputFile);
|
||||
|
||||
void addCHeaderDestination(String cHeader);
|
||||
|
@ -30,8 +28,6 @@ public interface ReaderState {
|
|||
|
||||
Map<String, String> getTsCustomLine();
|
||||
|
||||
void setHeaderMessage(String headerMessage);
|
||||
|
||||
String getTsFileOutputName();
|
||||
|
||||
void setTsFileOutputName(String tsFileOutputName);
|
||||
|
|
|
@ -81,8 +81,6 @@ public class EnumToString {
|
|||
File f = new File(inputPath + File.separator + headerInputFileName);
|
||||
SystemOut.println("Reading enums from " + headerInputFileName);
|
||||
|
||||
commonFilesHeader.insert(0, "// " + LazyFile.LAZY_FILE_TAG + " from " + f.getName() + " ");
|
||||
|
||||
includesSection.append("#include \"" + f.getName() + "\"\n");
|
||||
enumsReader.read(new FileReader(f));
|
||||
}
|
||||
|
|
|
@ -10,31 +10,6 @@ import static com.devexperts.logging.Logging.getLogging;
|
|||
public class ToolUtil {
|
||||
private static final Logging log = getLogging(ToolUtil.class);
|
||||
public static final String EOL = "\n";
|
||||
public static String TOOL = "(unknown script)";
|
||||
|
||||
static String getJarFileName() {
|
||||
try {
|
||||
|
||||
// Get path of the JAR file
|
||||
String jarPath = VariableRegistry.class
|
||||
.getProtectionDomain()
|
||||
.getCodeSource()
|
||||
.getLocation()
|
||||
.toURI()
|
||||
.getPath();
|
||||
if (log.debugEnabled())
|
||||
log.debug("JAR Path : " + jarPath);
|
||||
|
||||
// Get name of the JAR file
|
||||
return jarPath.substring(jarPath.lastIndexOf("/") + 1);
|
||||
} catch (URISyntaxException e) {
|
||||
return "(unknown jar)";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getGeneratedAutomaticallyTag() {
|
||||
return LazyFile.LAZY_FILE_TAG + getJarFileName() + " based on " + TOOL + " ";
|
||||
}
|
||||
|
||||
static boolean isEmptyDefinitionLine(String line) {
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue