Skip to content

Commit 5ce207b

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)
1 parent 3ced80d commit 5ce207b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
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
@@ -34,6 +34,8 @@
3434
import com.eprosima.idl.parser.typecode.TypeCode;
3535
import com.eprosima.idl.parser.typecode.Member;
3636
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
37+
import com.eprosima.log.ColorMessage;
38+
import java.io.InputStream;
3739
import java.util.ArrayList;
3840
import java.util.Collection;
3941
import java.util.Map.Entry;
@@ -340,6 +342,25 @@ public String getProduct()
340342
return "fastdds";
341343
}
342344

345+
public String getVersion()
346+
{
347+
try
348+
{
349+
InputStream input = this.getClass().getClassLoader().getResourceAsStream("version");
350+
byte[] b = new byte[input.available()];
351+
input.read(b);
352+
String text = new String(b);
353+
int beginindex = text.indexOf("=");
354+
return text.substring(beginindex + 1).trim();
355+
}
356+
catch (Exception ex)
357+
{
358+
System.out.println(ColorMessage.error() + "Getting version. " + ex.getMessage());
359+
}
360+
361+
return "";
362+
}
363+
343364
public String getNamespace()
344365
{
345366
return "fastcdr";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fileHeader(ctx, file, description) ::= <<
3333
* @file $file$
3434
* $description$
3535
*
36-
* This file was generated by the tool $ctx.product$gen.
36+
* This file was generated by the tool $ctx.product$gen (version: $ctx.version$).
3737
*/
3838
>>
3939

0 commit comments

Comments
 (0)