encapsulation
This commit is contained in:
parent
8c2a524773
commit
0ec0fca9be
|
@ -175,7 +175,7 @@ public class ConfigDefinition {
|
|||
|
||||
ParseState parseState = new ParseState(state.enumsReader);
|
||||
// Add the variable for the config signature
|
||||
long uniqueId = IoUtil2.getCrc32(state.inputFiles);
|
||||
FirmwareVersion uniqueId = new FirmwareVersion(IoUtil2.getCrc32(state.inputFiles));
|
||||
SignatureConsumer.storeUniqueBuildId(state, parseState, tsInputFileFolder, uniqueId);
|
||||
|
||||
ExtraUtil.handleFiringOrder(firingEnumFileName, state.variableRegistry, parseState);
|
||||
|
@ -227,7 +227,7 @@ public class ConfigDefinition {
|
|||
|
||||
VariableRegistry tmpRegistry = new VariableRegistry();
|
||||
// store the CRC32 as a built-in variable
|
||||
tmpRegistry.register(SIGNATURE_HASH, "" + uniqueId);
|
||||
tmpRegistry.register(SIGNATURE_HASH, uniqueId.encode());
|
||||
tmpRegistry.readPrependValues(signaturePrependFile);
|
||||
state.destinations.add(new SignatureConsumer(signatureDestination, tmpRegistry));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.rusefi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FirmwareVersion {
|
||||
private final long crc32;
|
||||
|
||||
public FirmwareVersion(long crc32) {
|
||||
|
||||
this.crc32 = crc32;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String encode() {
|
||||
return Long.toString(crc32);
|
||||
}
|
||||
}
|
|
@ -20,13 +20,13 @@ public class SignatureConsumer implements ConfigurationConsumer {
|
|||
this.registry = registry;
|
||||
}
|
||||
|
||||
public static void storeUniqueBuildId(ReaderState state, ParseState parseState, String tsPath, long uniqueId) {
|
||||
public static void storeUniqueBuildId(ReaderState state, ParseState parseState, String tsPath, FirmwareVersion uniqueId) {
|
||||
// store a hash as a built-in variable
|
||||
|
||||
// nasty trick - do not insert signature into live data files
|
||||
if (tsPath != null) {
|
||||
parseState.addDefinition(state.variableRegistry,
|
||||
ConfigDefinition.SIGNATURE_HASH, Long.toString(uniqueId), Definition.OverwritePolicy.NotAllowed);
|
||||
ConfigDefinition.SIGNATURE_HASH, uniqueId.encode(), Definition.OverwritePolicy.NotAllowed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue