Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
d3edbf1b
Commit
d3edbf1b
authored
Jan 30, 2019
by
Christopher Jan-Steffen Brix
Browse files
Use architecture to get the data path which is used for hashing
parent
5905c673
Pipeline
#101438
failed with stages
in 1 minute and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
View file @
d3edbf1b
...
...
@@ -182,8 +182,7 @@ public class EMADLGenerator {
List
<
FileContent
>
fileContentsTrainingHashes
=
new
ArrayList
<>();
for
(
ExpandedComponentInstanceSymbol
componentInstance
:
allInstances
)
{
ComponentSymbol
component
=
componentInstance
.
getComponentType
().
getReferencedSymbol
();
Optional
<
ArchitectureSymbol
>
architecture
=
component
.
getSpannedScope
().
resolve
(
""
,
ArchitectureSymbol
.
KIND
);
Optional
<
ArchitectureSymbol
>
architecture
=
componentInstance
.
getSpannedScope
().
resolve
(
""
,
ArchitectureSymbol
.
KIND
);
if
(!
architecture
.
isPresent
())
{
continue
;
...
...
@@ -203,16 +202,15 @@ public class EMADLGenerator {
// This is not the real path to the training data! Adapt accordingly once sub-task 4 is solved
String
trainConfigFilename
=
"NOT_FOUND"
;
String
componentConfigFilename
=
component
.
getFullName
().
replaceAll
(
"\\."
,
"/"
);
String
instanceConfigFilename
=
component
.
getFullName
().
replaceAll
(
"\\."
,
"/"
)
+
"_"
+
component
.
getName
();
String
componentConfigFilename
=
component
Instance
.
getFullName
().
replaceAll
(
"\\."
,
"/"
);
String
instanceConfigFilename
=
component
Instance
.
getFullName
().
replaceAll
(
"\\."
,
"/"
)
+
"_"
+
component
Instance
.
getName
();
if
(
Files
.
exists
(
Paths
.
get
(
getModelsPath
()
+
instanceConfigFilename
+
".cnnt"
)))
{
trainConfigFilename
=
instanceConfigFilename
;
}
else
if
(
Files
.
exists
(
Paths
.
get
(
getModelsPath
()
+
componentConfigFilename
+
".cnnt"
))){
trainConfigFilename
=
componentConfigFilename
;
}
Path
dataPath
=
Paths
.
get
(
getModelsPath
()
+
trainConfigFilename
+
".data"
);
byte
[]
dataHash
=
checksum
(
dataPath
);
byte
[]
dataHash
=
checksum
(
Paths
.
get
(
architecture
.
get
().
getDataPath
()));
String
trainingHash
=
creatorScriptHash
+
"-"
+
trainerScriptHash
+
"-"
+
convertByteArrayToHexString
(
dataHash
);
System
.
out
.
println
(
trainingHash
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment