Skip to content

Commit 64d302b

Browse files
depink5mergify[bot]
authored andcommitted
Sign the generated code with the Fast DDS-Gen version (#458)
Signed-off-by: Denisa <[email protected]> (cherry picked from commit a2ff4a4) # Conflicts: # src/main/java/com/eprosima/fastdds/idl/templates/eprosima.stg
1 parent 83c8b4b commit 64d302b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/main/java/com/eprosima/fastdds/idl/grammar/Context.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import com.eprosima.idl.parser.typecode.TypeCode;
3434
import com.eprosima.idl.parser.typecode.Member;
3535
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
36+
import com.eprosima.log.ColorMessage;
37+
import java.io.InputStream;
3638
import java.util.ArrayList;
3739
import java.util.Collection;
3840
import java.util.Map.Entry;
@@ -323,6 +325,25 @@ public String getProduct()
323325
return "fastcdr";
324326
}
325327

328+
public String getVersion()
329+
{
330+
try
331+
{
332+
InputStream input = this.getClass().getClassLoader().getResourceAsStream("version");
333+
byte[] b = new byte[input.available()];
334+
input.read(b);
335+
String text = new String(b);
336+
int beginindex = text.indexOf("=");
337+
return text.substring(beginindex + 1).trim();
338+
}
339+
catch (Exception ex)
340+
{
341+
System.out.println(ColorMessage.error() + "Getting version. " + ex.getMessage());
342+
}
343+
344+
return "";
345+
}
346+
326347
public String getNamespace()
327348
{
328349
return "fastcdr";

src/main/java/com/eprosima/fastdds/idl/templates/eprosima.stg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const $typecode.cppTypename$&
2222
$endif$
2323
>>
2424

25+
<<<<<<< HEAD
2526
varDecl(variable, create) ::= <<
2627
$if(variable)$
2728
$if(variable.typecode.primitive)$
@@ -30,6 +31,14 @@ $else$
3031
$variable.typecode.cppTypename$ $variable.name$;
3132
$endif$
3233
$endif$
34+
=======
35+
/*!
36+
* @file $file$
37+
* $description$
38+
*
39+
* This file was generated by the tool $ctx.product$gen (version: $ctx.version$).
40+
*/
41+
>>>>>>> a2ff4a4 (Sign the generated code with the Fast DDS-Gen version (#458))
3342
>>
3443

3544
varDel(variable) ::= <<>>

0 commit comments

Comments
 (0)