parent
0fc13878ee
commit
5282e29d7c
|
@ -1756,6 +1756,8 @@
|
|||
#define triggerSimulatorPins3_offset_hex 2e2
|
||||
#define TS_FILE_VERSION 20171101
|
||||
#define TS_OUTPUT_SIZE 356
|
||||
#define ts_show_etb true
|
||||
#define ts_show_hip9011 true
|
||||
#define tunerStudioSerialSpeed_offset 728
|
||||
#define tunerStudioSerialSpeed_offset_hex 2d8
|
||||
#define twoWireBatchIgnition_offset 1476
|
||||
|
|
|
@ -17,7 +17,13 @@ rem lazy is broken - TS input is not considered a change
|
|||
rm build/config.gen
|
||||
|
||||
java -cp ../java_tools/ConfigDefinition.jar;../java_tools/configuration_definition/lib/snakeyaml.jar com.rusefi.board_generator.BoardReader -board %BOARDNAME% -firmware_path . -out tunerstudio
|
||||
java -jar ../java_tools/ConfigDefinition.jar -definition integration\rusefi_config.txt -ts_destination tunerstudio -ts_output_name rusefi_%BOARDNAME%.ini -prepend tunerstudio/%BOARDNAME%_prefix.txt -skip build/config.gen
|
||||
java -jar ../java_tools/ConfigDefinition.jar ^
|
||||
-definition integration\rusefi_config.txt ^
|
||||
-ts_destination tunerstudio ^
|
||||
-ts_output_name rusefi_%BOARDNAME%.ini ^
|
||||
-prepend tunerstudio/%BOARDNAME%_prefix.txt ^
|
||||
-prepend config/boards/%BOARDNAME%/prepend.txt ^
|
||||
-skip build/config.gen
|
||||
|
||||
|
||||
rem This would automatically copy latest file to 'dev' TS project
|
||||
|
|
Binary file not shown.
|
@ -29,13 +29,13 @@ public class ConfigDefinition {
|
|||
|
||||
private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml";
|
||||
private static final String ROM_RAIDER_XML_OUTPUT = "rusefi.xml";
|
||||
private static final String KEY_DEFINITION = "-definition";
|
||||
public static final String KEY_DEFINITION = "-definition";
|
||||
private static final String KEY_ROM_INPUT = "-romraider";
|
||||
private static final String KEY_TS_DESTINATION = "-ts_destination";
|
||||
public 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";
|
||||
private static final String KEY_CONSOLE_DESTINATION = "-java_destination";
|
||||
private static final String KEY_PREPEND = "-prepend";
|
||||
public static final String KEY_PREPEND = "-prepend";
|
||||
private static final String KEY_SKIP = "-skip";
|
||||
public static String definitionInputFile = null;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class ConfigDefinition {
|
|||
String destCHeader = null;
|
||||
String destCDefines = null;
|
||||
String javaConsolePath = null;
|
||||
String prependFile = null;
|
||||
List<String> prependFiles = new ArrayList<>();
|
||||
String skipRebuildFile = null;
|
||||
String romRaiderInputFile = null;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class ConfigDefinition {
|
|||
} else if (key.equals(KEY_CONSOLE_DESTINATION)) {
|
||||
javaConsolePath = args[i + 1];
|
||||
} else if (key.equals(KEY_PREPEND)) {
|
||||
prependFile = args[i + 1];
|
||||
prependFiles.add(args[i + 1]);
|
||||
} else if (key.equals(KEY_SKIP)) {
|
||||
skipRebuildFile = args[i + 1];
|
||||
} else if (key.equals("-ts_output_name")) {
|
||||
|
@ -95,7 +95,7 @@ public class ConfigDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
if (prependFile != null)
|
||||
for (String prependFile : prependFiles)
|
||||
readPrependValues(prependFile);
|
||||
|
||||
BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), CHARSET.name()));
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.rusefi;
|
|||
|
||||
import com.rusefi.util.LazyFile;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
|
|
@ -102,7 +102,9 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
TsFileContent tsContent = readTsFile(tsPath);
|
||||
System.out.println("Got " + tsContent.getPrefix().length() + "/" + tsContent.getPostfix().length() + " of " + TS_FILE_INPUT_NAME);
|
||||
|
||||
LazyFile tsHeader = new LazyFile(tsPath + File.separator + TS_FILE_OUTPUT_NAME);
|
||||
// File.getPath() would eliminate potential separator at the end of the path
|
||||
String fileName = new File(tsPath).getPath() + File.separator + TS_FILE_OUTPUT_NAME;
|
||||
LazyFile tsHeader = new LazyFile(fileName);
|
||||
tsHeader.write(tsContent.getPrefix());
|
||||
|
||||
tsHeader.write("; " + CONFIG_DEFINITION_START + ConfigDefinition.EOL);
|
||||
|
@ -158,7 +160,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
return new TsFileContent(prefix.toString(), postfix.toString());
|
||||
}
|
||||
|
||||
static String removeToken(String line) {
|
||||
public static String removeToken(String line) {
|
||||
int index = line.indexOf(TS_CONDITION);
|
||||
String token = getToken(line);
|
||||
int afterTokenIndex = index + TS_CONDITION.length() + token.length();
|
||||
|
@ -168,7 +170,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
return line;
|
||||
}
|
||||
|
||||
static String getToken(String line) {
|
||||
public static String getToken(String line) {
|
||||
int index = line.indexOf(TS_CONDITION) + TS_CONDITION.length();
|
||||
String token = "";
|
||||
while (index < line.length() && !Character.isWhitespace(line.charAt(index))) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.rusefi.test;
|
||||
|
||||
import com.rusefi.output.TSProjectConsumer;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TSProjectConsumerTest {
|
||||
@Test
|
||||
public void getTsCondition() {
|
||||
assertEquals("ts", TSProjectConsumer.getToken("\"HIP9011 Settings (knock sensor) (alpha version)\" @@if_ts\r\n"));
|
||||
assertEquals("ts_show_hip9011", TSProjectConsumer.getToken("\"HIP9011 Settings (knock sensor) (alpha version)\" @@if_ts_show_hip9011"));
|
||||
|
||||
assertEquals("1", TSProjectConsumer.removeToken("1@@if_ts"));
|
||||
assertEquals("12", TSProjectConsumer.removeToken("1@@if_ts 2"));
|
||||
assertEquals("H2\r\n", TSProjectConsumer.removeToken("H@@if_ts 2\r\n"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.rusefi.test.integration;
|
||||
|
||||
import com.rusefi.ConfigDefinition;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
//todo: un-ignore once Ant run works which is probably messed up about missing resources
|
||||
@Ignore
|
||||
public class IntegrationTest {
|
||||
@Test
|
||||
public void largeTest() throws IOException {
|
||||
|
||||
String[] parameters = new String[]{
|
||||
ConfigDefinition.KEY_DEFINITION,
|
||||
getClass().getResource("define.txt").getFile(),
|
||||
ConfigDefinition.KEY_TS_DESTINATION,
|
||||
getClass().getResource(".").getFile(),
|
||||
ConfigDefinition.KEY_PREPEND,
|
||||
getClass().getResource("prepend.txt").getFile()
|
||||
};
|
||||
|
||||
ConfigDefinition.main(parameters);
|
||||
|
||||
// todo: actually read and validate output
|
||||
// todo: continues integration for this whole module
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
#define ts_show_hip9011 true
|
||||
#define ts_show_etb true
|
|
@ -0,0 +1 @@
|
|||
this file would be overwritten by integration test
|
|
@ -0,0 +1 @@
|
|||
#define ts_show_hip9011 false
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
subMenu = hipFunction @@if_ts_show_hip9011
|
||||
subMenu = etb @@if_ts_show_etb
|
Loading…
Reference in New Issue