Skip to content

Commit

Permalink
Refs #19595: -typeobject argument is deprecated. TypeObject files wil…
Browse files Browse the repository at this point in the history
…l always be generated

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
  • Loading branch information
JLBuenoLopez committed Nov 14, 2023
1 parent 95fed69 commit ce5f576
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/main/java/com/eprosima/fastdds/fastddsgen.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class fastddsgen
// Generates type naming compatible with ROS 2
private boolean m_type_ros2 = false;

// Generate TypeObject files?
// Generate deprecated TypeObject files
private boolean m_type_object_files = false;

// Generate string and sequence types compatible with C?
Expand Down Expand Up @@ -690,12 +690,12 @@ private Project parseIDL(

if (m_test)
{
// Load Serialization test template
// Load test template
tmanager.addGroup("com/eprosima/fastdds/idl/templates/SerializationTestSource.stg");
tmanager.addGroup("com/eprosima/fastdds/idl/templates/SerializationHeader.stg");
tmanager.addGroup("com/eprosima/fastdds/idl/templates/SerializationSource.stg");

if(m_type_object_files)
if(!m_type_object_files)
{
// Load TypeObject test template
tmanager.addGroup("com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg");
Expand Down Expand Up @@ -748,7 +748,7 @@ private Project parseIDL(
lexer.setContext(ctx);
CommonTokenStream tokens = new CommonTokenStream(lexer);
IDLParser parser = new IDLParser(tokens);
// Pass the finelame without the extension
// Pass the filename without the extension
Specification specification = parser.specification(ctx, tmanager, maintemplates).spec;
returnedValue = specification != null && !tmanager.get_st_error();;

Expand Down Expand Up @@ -811,7 +811,6 @@ private Project parseIDL(
project.addCommonIncludeFile(relative_dir + ctx.getFilename() + ".h");
project.addCommonSrcFile(relative_dir + ctx.getFilename() + ".cxx");


if (m_type_object_files)
{
System.out.println("Generating TypeObject files...");
Expand Down Expand Up @@ -865,7 +864,7 @@ private Project parseIDL(
project.addCommonTestingFile(trimmedElement + "Serialization.cpp");
}

if(m_type_object_files)
if(!m_type_object_files)
{
System.out.println("Generating TypeObjects Test file...");
String fileNameTO = output_dir + ctx.getFilename() + "TypeObjectTestingTest.cpp";
Expand Down Expand Up @@ -1229,7 +1228,7 @@ private boolean genCMakeLists(

cmake.add("solution", solution);
cmake.add("test", m_test);
cmake.add("type_object_files", m_type_object_files);
cmake.add("type_object_files", !m_type_object_files);

returnedValue = Utils.writeFile(m_outputDir + "CMakeLists.txt", cmake, m_replace);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ $endif$
find_package(fastcdr 2 REQUIRED)
find_package(fastrtps 2.12 REQUIRED)

$solution.projects : { project | $pub_sub_execs(project=project, libraries=solution.libraries, test=test)$}; separator="\n"$
$solution.projects : { project | $pub_sub_execs(project=project, libraries=solution.libraries, test=test, typeobject=type_object_files)$}; separator="\n"$

>>

pub_sub_execs(project, libraries, test) ::= <<
pub_sub_execs(project, libraries, test, typeobject) ::= <<

message(STATUS "Configuring $project.name$...")
add_library($project.name$_lib $project.commonSrcFiles : { file | $file$}; separator=" "$)
Expand Down Expand Up @@ -78,7 +78,7 @@ target_link_libraries($project.name$SerializationTest
$project.name$_lib $project.dependencies : { dep | $dep$_lib}; separator=" "$)
gtest_discover_tests($project.name$SerializationTest)

$if(type_object_files)$
$if(typeobject)$

# $project.name$ TypeObject Test
add_executable($project.name$TypeObjectTestingTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ $annotation.typeDefs : { it |$typedef_decl(ctx=ctx, parent=annotation, typedefs=

minimal_annotation_member(ctx, object) ::= <<
MinimalAnnotationParameter mam_$object.name$;
const TypeIdentifier* mam_$object.name$_typeId = $get_type_identifier(ctx=ctx, type=object.typecode, ek="false")$;
TypeIdentifier* mam_$object.name$_typeId = $get_type_identifier(ctx=ctx, type=object.typecode, ek="false")$;
if (mam_$object.name$_typeId != nullptr)
{
mam_$object.name$.common().member_type_id(*mam_$object.name$_typeId);
Expand All @@ -280,8 +280,8 @@ type_object->minimal().annotation_type().member_seq().emplace_back(mam_$object.n

complete_annotation_member(ctx, object) ::= <<
CompleteAnnotationParameter cam_$object.name$;
const TypeIdentifier* cam_$object.name$_typeId = $get_type_identifier(ctx=ctx, type=object.typecode, ek="true")$;
if (cam_$object.name$_typeId != nullptr)
TypeIdentifier* cam_$object.name$_typeId = $get_type_identifier(ctx=ctx, type=object.typecode, ek="true")$;
if (mam_$object.name$_typeId != nullptr)
{
cam_$object.name$.common().member_type_id(*cam_$object.name$_typeId);
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/eprosima/fastdds/FastDDSGenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class FastDDSGenTest

private static final String INPUT_PATH = "thirdparty/dds-types-test/IDL";
private static final String OUTPUT_PATH = "build/test/integration/idls";
private static final boolean TYPEOBJECTS_FLAG = true;

private static boolean isUnix()
{
Expand Down Expand Up @@ -119,7 +118,7 @@ public void runTests()

//Configure idl tests
TestManager tests = new TestManager(TestLevel.RUN, "share/fastddsgen/java/fastddsgen", INPUT_PATH,
OUTPUT_PATH, "CMake", TYPEOBJECTS_FLAG, list_tests);
OUTPUT_PATH, "CMake", list_tests);
tests.addCMakeArguments("-DCMAKE_BUILD_TYPE=Debug");
tests.removeTests("basic_inner_types");

Expand Down

0 comments on commit ce5f576

Please sign in to comment.