Skip to content

Commit 7a726dc

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 276f2bf commit 7a726dc

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

+21
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import com.eprosima.idl.parser.typecode.TypeCode;
3838
import com.eprosima.idl.parser.typecode.Member;
3939
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
40+
import com.eprosima.log.ColorMessage;
41+
import java.io.InputStream;
4042
import java.util.ArrayList;
4143
import java.util.Arrays;
4244
import java.util.Collection;
@@ -475,6 +477,25 @@ public String getProduct()
475477
return "fastdds";
476478
}
477479

480+
public String getVersion()
481+
{
482+
try
483+
{
484+
InputStream input = this.getClass().getClassLoader().getResourceAsStream("version");
485+
byte[] b = new byte[input.available()];
486+
input.read(b);
487+
String text = new String(b);
488+
int beginindex = text.indexOf("=");
489+
return text.substring(beginindex + 1).trim();
490+
}
491+
catch (Exception ex)
492+
{
493+
System.out.println(ColorMessage.error() + "Getting version. " + ex.getMessage());
494+
}
495+
496+
return "";
497+
}
498+
478499
public String getNamespace()
479500
{
480501
return "fastcdr";

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

+1-1
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)