Skip to content

[21921] Sign the generated code with the Fast DDS-Gen version (backport #458) #463

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from
Open
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
24 changes: 24 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 @@ -23,8 +23,13 @@
import com.eprosima.idl.parser.typecode.Member;
import com.eprosima.idl.parser.typecode.MapTypeCode;
import com.eprosima.idl.parser.typecode.MemberedTypeCode;
<<<<<<< HEAD
import com.eprosima.idl.parser.typecode.SequenceTypeCode;
import com.eprosima.idl.parser.typecode.EnumTypeCode;
=======
import com.eprosima.log.ColorMessage;
import java.io.InputStream;
>>>>>>> a2ff4a4 (Sign the generated code with the Fast DDS-Gen version (#458))
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map.Entry;
Expand Down Expand Up @@ -224,6 +229,25 @@ public String getProduct()
return "fastcdr";
}

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
9 changes: 9 additions & 0 deletions src/main/java/com/eprosima/fastdds/idl/templates/eprosima.stg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const $typecode.cppTypename$&
$endif$
>>

<<<<<<< HEAD
varDecl(variable, create) ::= <<
$if(variable)$
$if(variable.typecode.primitive)$
Expand All @@ -30,6 +31,14 @@ $else$
$variable.typecode.cppTypename$ $variable.name$;
$endif$
$endif$
=======
/*!
* @file $file$
* $description$
*
* This file was generated by the tool $ctx.product$gen (version: $ctx.version$).
*/
>>>>>>> a2ff4a4 (Sign the generated code with the Fast DDS-Gen version (#458))
>>

varDel(variable) ::= <<>>
Expand Down