Skip to content

Commit 67723af

Browse files
mergify[bot]depink5MiguelCompany
authored
Sign the generated code with the Fast DDS-Gen version (#458) (#462)
* 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 * Fix conflicts. Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Denisa Alexandru <[email protected]> Co-authored-by: Miguel Company <[email protected]>
1 parent 83c8b4b commit 67723af

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
@@ -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/Common.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)