is gen_config invoked too often now? #2387
This commit is contained in:
parent
dd2d253efb
commit
122fe16db7
|
@ -38,6 +38,11 @@ java -DSystemOut.name=gen_config_board \
|
||||||
|
|
||||||
[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit 1; }
|
[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit 1; }
|
||||||
|
|
||||||
|
# todo: make things consistent by
|
||||||
|
# 0) having generated content not in the same folder with the tool generating content?
|
||||||
|
# 1) using unique file name for each configuration?
|
||||||
|
# 2) leverage consistent caching mechanism so that image is generted only in case of fresh .ini. Laziest approach would be to return exit code from java process above
|
||||||
|
#
|
||||||
./hw_layer/mass_storage/create_ini_image.sh ./tunerstudio/generated/rusefi_${SHORT_BOARDNAME}.ini ./hw_layer/mass_storage/ramdisk_image.h
|
./hw_layer/mass_storage/create_ini_image.sh ./tunerstudio/generated/rusefi_${SHORT_BOARDNAME}.ini ./hw_layer/mass_storage/ramdisk_image.h
|
||||||
./hw_layer/mass_storage/create_ini_image_compressed.sh ./tunerstudio/generated/rusefi_${SHORT_BOARDNAME}.ini ./hw_layer/mass_storage/ramdisk_image_compressed.h
|
./hw_layer/mass_storage/create_ini_image_compressed.sh ./tunerstudio/generated/rusefi_${SHORT_BOARDNAME}.ini ./hw_layer/mass_storage/ramdisk_image_compressed.h
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -530,31 +530,35 @@ public class ConfigDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkIfOutputFilesAreOutdated(List<String> inputFiles, String cachePath, String cacheZipFile) {
|
private static boolean checkIfOutputFilesAreOutdated(List<String> inputFileNames, String cachePath, String cacheZipFile) {
|
||||||
if (cachePath == null)
|
if (cachePath == null)
|
||||||
return true;
|
return true;
|
||||||
// find if any input file was changed from the cached version
|
// find if any input file was changed from the cached version
|
||||||
for (String iFile : inputFiles) {
|
for (String inputFileName : inputFileNames) {
|
||||||
File newFile = new File(iFile);
|
File inputFile = new File(inputFileName);
|
||||||
try {
|
try {
|
||||||
byte[] f1 = Files.readAllBytes(newFile.toPath());
|
byte[] inputFileContent = Files.readAllBytes(inputFile.toPath());
|
||||||
byte[] f2;
|
byte[] f2;
|
||||||
if (cacheZipFile != null) {
|
if (cacheZipFile != null) {
|
||||||
f2 = unzipFileContents(cacheZipFile, cachePath + File.separator + iFile);
|
f2 = unzipFileContents(cacheZipFile, cachePath + File.separator + inputFileName);
|
||||||
} else {
|
} else {
|
||||||
String cachedFileName = getCachedInputFileName(newFile.getName(), cachePath);
|
String cachedFileName = getCachedInputFileName(cachePath, inputFile.getName());
|
||||||
|
SystemOut.println("* cache ZIP file not specified, reading " + cachedFileName + " vs " + inputFileName);
|
||||||
|
/**
|
||||||
|
* todo: do we have a bug in this branch? how often do we simply read same 'inputFile'?
|
||||||
|
*/
|
||||||
File cachedFile = new File(cachedFileName);
|
File cachedFile = new File(cachedFileName);
|
||||||
f2 = Files.readAllBytes(cachedFile.toPath());
|
f2 = Files.readAllBytes(cachedFile.toPath());
|
||||||
}
|
}
|
||||||
boolean isEqual = Arrays.equals(f1, f2);
|
boolean isEqual = Arrays.equals(inputFileContent, f2);
|
||||||
if (!isEqual) {
|
if (!isEqual) {
|
||||||
SystemOut.println("* the file " + iFile + " is changed!");
|
SystemOut.println("* the file " + inputFileName + " is changed!");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
SystemOut.println("* the file " + iFile + " is NOT changed!");
|
SystemOut.println("* the file " + inputFileName + " is NOT changed!");
|
||||||
}
|
}
|
||||||
} catch (java.io.IOException e) {
|
} catch (IOException e) {
|
||||||
SystemOut.println("* cannot validate the file " + iFile + ", so assuming it's changed.");
|
SystemOut.println("* cannot validate the file " + inputFileName + ", so assuming it's changed.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,11 +577,11 @@ public class ConfigDefinition {
|
||||||
} else {
|
} else {
|
||||||
for (String iFile : inputFiles) {
|
for (String iFile : inputFiles) {
|
||||||
File newFile = new File(iFile);
|
File newFile = new File(iFile);
|
||||||
File cachedFile = new File(getCachedInputFileName(newFile.getName(), cachePath));
|
File cachedFile = new File(getCachedInputFileName(cachePath, newFile.getName()));
|
||||||
cachedFile.mkdirs();
|
cachedFile.mkdirs();
|
||||||
try {
|
try {
|
||||||
Files.copy(newFile.toPath(), cachedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(newFile.toPath(), cachedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (java.io.IOException e) {
|
} catch (IOException e) {
|
||||||
SystemOut.println("* cannot store the cached file for " + iFile);
|
SystemOut.println("* cannot store the cached file for " + iFile);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -587,7 +591,7 @@ public class ConfigDefinition {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getCachedInputFileName(String inputFile, String cachePath) {
|
private static String getCachedInputFileName(String cachePath, String inputFile) {
|
||||||
return cachePath + File.separator + inputFile;
|
return cachePath + File.separator + inputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue