Skip to content

Commit

Permalink
Improve CI (#250)
Browse files Browse the repository at this point in the history
* Refs #19787. Improve CI

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #19787. Improve ST error handling

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #19787. Fix errors

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs 19878. Update submodule

Signed-off-by: Ricardo González Moreno <[email protected]>

* Refs #19787. Apply suggestion

Signed-off-by: Ricardo González Moreno <[email protected]>

---------

Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware authored Oct 27, 2023
1 parent da6e240 commit 1959365
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .github/actions/fetch-fastddsgen-repos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
fastdds-branch:
description: 'Fast-DDS branch to be used'
required: true
fastdds-python-branch:
description: 'Fast-DDS-Python branch to be used'
required: true
runs:
using: "composite"
steps:
Expand All @@ -20,5 +23,6 @@ runs:
git clone https://github.com/eProsima/foonathan_memory_vendor.git --branch ${{ inputs.foonathan-memory-vendor-branch }}
git clone https://github.com/eProsima/Fast-CDR.git --branch ${{ inputs.fastcdr-branch }}
git clone https://github.com/eProsima/Fast-DDS.git --branch ${{ inputs.fastdds-branch }}
git clone https://github.com/eProsima/Fast-DDS-python.git --branch ${{ inputs.fastdds-python-branch }}
cd ..
shell: bash
27 changes: 22 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'Fast-DDS branch to be used'
required: false
default: 'master'
fastdds_python_branch:
description: 'Fast-DDS-Python branch to be used'
required: false
default: 'main'

push:
branches:
Expand Down Expand Up @@ -55,6 +59,7 @@ jobs:
foonathan-memory-vendor-branch: ${{ github.event.inputs.foonathan_memory_vendor_branch || 'master' }}
fastcdr-branch: ${{ github.event.inputs.fastcdr_branch || 'master' }}
fastdds-branch: ${{ github.event.inputs.fastdds_branch || 'master' }}
fastdds-python-branch: ${{ github.event.inputs.fastdds_python_branch || 'main' }}

- name: Get minimum supported version of CMake
uses: eProsima/eProsima-CI/external/get-cmake@v0
Expand All @@ -64,15 +69,27 @@ jobs:
- name: Setup CCache
uses: eProsima/eProsima-CI/external/setup-ccache-action@v0

- name: Build workspace
run: |
cmake --version
colcon build --event-handlers=console_direct+ --mixin rel-with-deb-info ccache
- name: Build fastddsgen
run: |
cd src/fastddsgen
./gradlew assemble
echo "$(pwd)/scripts" >> ${{ github.path }}
- name: Regenerate IDL files for Fast-DDS and Fast-DDS-python
run: |
cd src/Fast-DDS/utils/scripts
./update_generated_code_from_idl.sh
cd -
cd src/Fast-DDS-python/fastdds_python/test/types
./generate.sh
cd -
cd src/Fast-DDS-python/fastdds_python_examples/HelloWorldExample
fastddsgen -python -replace HelloWorld.idl
- name: Build workspace
run: |
cmake --version
colcon build --event-handlers=console_direct+ --mixin rel-with-deb-info ccache
- name: Test fastddsgen
run: |
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/eprosima/fastdds/fastddsgen.java
Original file line number Diff line number Diff line change
Expand Up @@ -745,19 +745,19 @@ private Project parseIDL(
// Pass the finelame without the extension

Specification specification = parser.specification(ctx, tmanager, maintemplates).spec;
returnedValue = specification != null;
returnedValue = specification != null && !tmanager.get_st_error();;

}
catch (FileNotFoundException ex)
{
System.out.println(ColorMessage.error(
"FileNotFounException") + "The File " + idlParseFileName + " was not found.");
}/* catch (ParseException ex) {
System.out.println(ColorMessage.error("ParseException") + ex.getMessage());
}*/
returnedValue = false;
}
catch (Exception ex)
{
System.out.println(ColorMessage.error("Exception") + ex.getMessage());
returnedValue = false;
}

if (returnedValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ $endif$
* @brief This class represents the TopicDataType of the type $struct.name$ defined by the user in the IDL file.
* @ingroup $ctx.trimfilename$
*/
class $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType : public eprosima::fastdds::dds::TopicDataType
class $struct.name$PubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:

typedef $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$ type;
typedef $struct.name$ type;

eProsima_user_DllExport $if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType();
eProsima_user_DllExport $struct.name$PubSubType();

eProsima_user_DllExport ~$if(parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType() override;
eProsima_user_DllExport ~$struct.name$PubSubType() override;

eProsima_user_DllExport bool serialize(
void* data,
Expand Down Expand Up @@ -225,7 +225,7 @@ public:
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
$if (struct.isPlain)$new (memory) $if(parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$()$else$static_cast<void>(memory)$endif$;
$if (struct.isPlain)$new (memory) $struct.name$()$else$static_cast<void>(memory)$endif$;
return $if (struct.isPlain)$true$else$false$endif$;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ typedef_decl(ctx, parent, typedefs, typedefs_type, declarator_type) ::= <<

$declarator_type$
$typedefs_type$

>>

struct_type(ctx, parent, struct, member_list) ::= <<
$member_list$
$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType()
$struct.name$PubSubType::$struct.name$PubSubType()
{
$if(ctx.GenerateTypesROS2)$setName("$struct.ROS2Scopedname$");$else$setName("$struct.scopedname$");$endif$
uint32_t type_size = $struct.cScopedname$_max_cdr_typesize;
Expand All @@ -104,20 +104,20 @@ $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::$if (pare
memset(m_keyBuffer, 0, keyLength);
}

$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::~$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType()
$struct.name$PubSubType::~$struct.name$PubSubType()
{
if (m_keyBuffer != nullptr)
{
free(m_keyBuffer);
}
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::serialize(
bool $struct.name$PubSubType::serialize(
void* data,
SerializedPayload_t* payload,
DataRepresentationId_t data_representation)
{
$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
Expand Down Expand Up @@ -148,14 +148,14 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::seri
return true;
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::deserialize(
bool $struct.name$PubSubType::deserialize(
SerializedPayload_t* payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->length);
Expand All @@ -178,7 +178,7 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::dese
return true;
}

std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getSerializedSizeProvider(
std::function<uint32_t()> $struct.name$PubSubType::getSerializedSizeProvider(
void* data,
DataRepresentationId_t data_representation)
{
Expand All @@ -191,7 +191,7 @@ std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<$if (parent.IsInterface)$$parent.name$_$endif$$struct.name$*>(data), current_alignment)) +
*static_cast<$struct.name$*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -201,18 +201,18 @@ std::function<uint32_t()> $if (parent.IsInterface)$$parent.name$_$endif$$struct.
};
}

void* $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::createData()
void* $struct.name$PubSubType::createData()
{
return reinterpret_cast<void*>(new $if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$());
return reinterpret_cast<void*>(new $struct.name$());
}

void $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::deleteData(
void $struct.name$PubSubType::deleteData(
void* data)
{
delete(reinterpret_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data));
delete(reinterpret_cast<$struct.name$*>(data));
}

bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getKey(
bool $struct.name$PubSubType::getKey(
void* data,
InstanceHandle_t* handle,
bool force_md5)
Expand All @@ -222,7 +222,7 @@ bool $if (parent.IsInterface)$$parent.name$_$endif$$struct.name$PubSubType::getK
return false;
}

$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$* p_type = static_cast<$if (parent.IsInterface)$$struct.scopedname$$else$$struct.name$$endif$*>(data);
$struct.name$* p_type = static_cast<$struct.name$*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,8 +1408,8 @@ const TypeObject* GetComplete$bitmask.name$Object()

type_object->complete().bitmask_type().header().common().bit_bound($bitmask.bitBound$);

$if(union.annotationList)$
$union.annotationList:{ ann |
$if(bitmask.annotationList)$
$bitmask.annotationList:{ ann |
{
AppliedAnnotation ann;
//ann.annotation_typeid(Get$ann.name$Identifier(true));
Expand Down Expand Up @@ -1648,8 +1648,8 @@ const TypeObject* GetComplete$bitset.name$Object()
//type_object->complete().bitset_type().bitset_flags().IS_NESTED(false);
//type_object->complete().bitset_type().bitset_flags().IS_AUTOID_HASH(false);

$if(union.annotationList)$
$union.annotationList:{ ann |
$if(bitset.annotationList)$
$bitset.annotationList:{ ann |
{
AppliedAnnotation ann;
//ann.annotation_typeid(Get$ann.name$Identifier(true));
Expand Down

0 comments on commit 1959365

Please sign in to comment.