Skip to content

Commit ab533a8

Browse files
authored
Fix introduction of no stable API (#267)
* Refs #23483. Fix stable api Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> * Refs #23483. Add github workflow Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> * Refs #23483. Support swig-version Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> * Refs #23483. Fix type resolution up to swig 4.2.0 Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> --------- Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
1 parent 7406caa commit ab533a8

4 files changed

Lines changed: 45 additions & 9 deletions

File tree

.github/workflows/reusable-windows-ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ on:
2525
description: 'Extra arguments for cmake cli'
2626
required: false
2727
type: string
28+
cmake-version:
29+
description: 'CMake version to install'
30+
required: false
31+
default: '3.24.4'
32+
type: string
2833
ctest-args:
2934
description: 'Extra arguments for ctest cli'
3035
required: false
@@ -52,6 +57,11 @@ on:
5257
required: false
5358
type: boolean
5459
default: true
60+
swig-version:
61+
description: 'SWIG version to install'
62+
required: false
63+
default: '4.0.2.04082020'
64+
type: string
5565
env:
5666
colcon-build-default-cmake-args: '-DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DTHIRDPARTY_fastcdr=OFF -DTHIRDPARTY_UPDATE=ON -DEPROSIMA_EXTRA_CMAKE_CXX_FLAGS="/MP /WX"'
5767
defaults:
@@ -91,7 +101,7 @@ jobs:
91101
- name: Get minimum supported version of CMake
92102
uses: eProsima/eProsima-CI/external/get-cmake@v0
93103
with:
94-
cmakeVersion: '3.24.4'
104+
cmakeVersion: ${{ inputs.cmake-version }}
95105

96106
- name: Install OpenSSL
97107
uses: eProsima/eprosima-CI/windows/install_openssl@v0
@@ -129,7 +139,7 @@ jobs:
129139

130140
- name: Install swig
131141
shell: pwsh
132-
run: choco install swig --allow-downgrade --version=4.0.2.04082020
142+
run: choco install swig --allow-downgrade --version=${{ inputs.swig-version }}
133143

134144
- name: Get Fast CDR branch
135145
id: get_fastcdr_branch
@@ -210,7 +220,7 @@ jobs:
210220
- name: Get minimum supported version of CMake
211221
uses: eProsima/eProsima-CI/external/get-cmake@v0
212222
with:
213-
cmakeVersion: '3.24.4'
223+
cmakeVersion: ${{ inputs.cmake-version }}
214224

215225
- name: Install OpenSSL
216226
uses: eProsima/eprosima-CI/windows/install_openssl@v0
@@ -248,7 +258,7 @@ jobs:
248258

249259
- name: Install swig
250260
shell: pwsh
251-
run: choco install swig --allow-downgrade --version=4.0.2.04082020
261+
run: choco install swig --allow-downgrade --version=${{ inputs.swig-version }}
252262

253263
- name: Install doxygen
254264
uses: eProsima/eProsima-CI/external/install_doxygen@v0

.github/workflows/windows-ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,24 @@ jobs:
6969
fastdds-branch: ${{ inputs.fastdds-branch || 'master' }}
7070
run-build: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
7171
run-tests: ${{ (inputs.run-tests == true) || ((github.event_name == 'pull_request') && (!contains(github.event.pull_request.labels.*.name, 'no-test'))) }}
72+
73+
windows-ci-stable-abi:
74+
if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'conflicts') }}
75+
strategy:
76+
fail-fast: false
77+
uses: ./.github/workflows/reusable-windows-ci.yml
78+
with:
79+
# It would be desirable to have a matrix of windows OS for this job, but due to the issue opened in this ticket:
80+
# https://github.com/orgs/community/discussions/128118 , it has been set as a single OS job.
81+
os-version: ${{ inputs.os-version || 'windows-2022' }}
82+
vs-toolset: 'v143'
83+
label: '${{ inputs.os-version }}-${{ matrix.vs-toolset }}-stable-api-ci-${{ inputs.fastdds-python-branch }}-${{ inputs.fastdds-branch }}'
84+
colcon-args: ${{ inputs.colcon-args }}
85+
cmake-args: '${{ inputs.cmake-args }} -DUSE_PYTHON_STABLE_ABI=ON'
86+
cmake-version: '3.30.8'
87+
ctest-args: ${{ inputs.ctest-args }}
88+
fastdds-python-branch: ${{ inputs.fastdds-python-branch || github.ref }}
89+
fastdds-branch: ${{ inputs.fastdds-branch || 'master' }}
90+
run-build: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
91+
run-tests: ${{ (inputs.run-tests == true) || ((github.event_name == 'pull_request') && (!contains(github.event.pull_request.labels.*.name, 'no-test'))) }}
92+
swig-version: '4.3.1'

fastdds_python/src/swig/fastdds.i

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,13 @@ bool has_statistics();
106106
#define FASTDDS_DEPRECATED_UNTIL(major, entity_name, msg)
107107
#define FASTDDS_TODO_BEFORE(major, minor, msg)
108108

109-
// Defined template for std::vector<std::string>
109+
// Defined template for some vector containers.
110110
%template(StringVector) std::vector<std::string>;
111+
%template(uint8_t_vector) std::vector<uint8_t>;
112+
%template(uint16_t_vector) std::vector<uint16_t>;
113+
%template(int32_t_vector) std::vector<int32_t>;
114+
%template(uint32_t_vector) std::vector<uint32_t>;
115+
%template(uint64_t_vector) std::vector<uint64_t>;
111116

112117
// Predeclaration of namespaces and/or classes not exported to the target language,
113118
// but that are part of the Fast DDS public API

fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ long hash(const eprosima::fastdds::rtps::InstanceHandle_t& handle)
5050

5151
// Fast-path: bytes
5252
if (PyBytes_Check(seq)) {
53-
if (PyBytes_GET_SIZE(seq) == 16)
53+
if (PyBytes_Size(seq) == 16)
5454
{
55-
const char* b = PyBytes_AS_STRING(seq);
55+
const char* b = PyBytes_AsString(seq);
5656
for (int i = 0; i < 16; ++i) (*self)[i] = (uint8_t)(unsigned char)b[i];
5757
}
5858
else
@@ -65,9 +65,9 @@ long hash(const eprosima::fastdds::rtps::InstanceHandle_t& handle)
6565
// Fast-path: bytearray
6666
else if (PyByteArray_Check(seq))
6767
{
68-
if (PyByteArray_GET_SIZE(seq) == 16)
68+
if (PyByteArray_Size(seq) == 16)
6969
{
70-
const char* b = PyByteArray_AS_STRING(seq);
70+
const char* b = PyByteArray_AsString(seq);
7171
for (int i = 0; i < 16; ++i) (*self)[i] = (uint8_t)(unsigned char)b[i];
7272
}
7373
else

0 commit comments

Comments
 (0)