Skip to content

Commit ff1bb20

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/grammar/Context.java # src/main/java/com/eprosima/fastdds/idl/templates/eprosima.stg
1 parent 35199c7 commit ff1bb20

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
import com.eprosima.idl.parser.typecode.Member;
2424
import com.eprosima.idl.parser.typecode.MapTypeCode;
2525
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
26+
<<<<<<< HEAD
2627
import com.eprosima.idl.parser.typecode.SequenceTypeCode;
2728
import com.eprosima.idl.parser.typecode.EnumTypeCode;
29+
=======
30+
import com.eprosima.log.ColorMessage;
31+
import java.io.InputStream;
32+
>>>>>>> a2ff4a4 (Sign the generated code with the Fast DDS-Gen version (#458))
2833
import java.util.ArrayList;
2934
import java.util.Collection;
3035
import java.util.Map.Entry;
@@ -224,6 +229,25 @@ public String getProduct()
224229
return "fastcdr";
225230
}
226231

232+
public String getVersion()
233+
{
234+
try
235+
{
236+
InputStream input = this.getClass().getClassLoader().getResourceAsStream("version");
237+
byte[] b = new byte[input.available()];
238+
input.read(b);
239+
String text = new String(b);
240+
int beginindex = text.indexOf("=");
241+
return text.substring(beginindex + 1).trim();
242+
}
243+
catch (Exception ex)
244+
{
245+
System.out.println(ColorMessage.error() + "Getting version. " + ex.getMessage());
246+
}
247+
248+
return "";
249+
}
250+
227251
public String getNamespace()
228252
{
229253
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)