Skip to content

[21921] Sign the generated code with the Fast DDS-Gen version #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/main/java/com/eprosima/fastdds/idl/grammar/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import com.eprosima.idl.parser.typecode.TypeCode;
import com.eprosima.idl.parser.typecode.Member;
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
import com.eprosima.log.ColorMessage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -475,6 +477,25 @@ public String getProduct()
return "fastdds";
}

public String getVersion()
{
try
{
InputStream input = this.getClass().getClassLoader().getResourceAsStream("version");
byte[] b = new byte[input.available()];
input.read(b);
String text = new String(b);
int beginindex = text.indexOf("=");
return text.substring(beginindex + 1).trim();
}
catch (Exception ex)
{
System.out.println(ColorMessage.error() + "Getting version. " + ex.getMessage());
}

return "";
}

public String getNamespace()
{
return "fastcdr";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fileHeader(ctx, file, description) ::= <<
* @file $file$
* $description$
*
* This file was generated by the tool $ctx.product$gen.
* This file was generated by the tool $ctx.product$gen (version: $ctx.version$).
*/
>>

Expand Down
Loading