Skip to content
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
19 changes: 10 additions & 9 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# *************************************************************************************************
# Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *************************************************************************************************/
# *****************************************************************************
# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at *
# https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *****************************************************************************/

#http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Expand Down Expand Up @@ -114,7 +115,7 @@ BreakConstructorInitializersBeforeComma: true
# A column limit of 0 means that there is no column limit. In this case,
# clang-format will respect the input’s line breaking decisions within
# statements unless they contradict other rules.
ColumnLimit: 100
ColumnLimit: 80

# A regular expression that describes comments with special meaning, which
# should not be split into lines or otherwise changed.
Expand Down
17 changes: 9 additions & 8 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# *************************************************************************************************
# Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *************************************************************************************************/
# *****************************************************************************
# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at *
# https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *****************************************************************************/

Checks: '-checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus*'
WarningsAsErrors: true
Expand Down
1 change: 0 additions & 1 deletion .cppcheck.suppress
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
cstyleCast
missingIncludeSystem
missingInclude
23 changes: 23 additions & 0 deletions .github/scripts/check_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

tag=$1
echo "Input tag: '$tag'"

version="$(sed -rn 's/.*MAJOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*MINOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*PATCH.*\"(.*)\".*/\1/p' CMakeLists.txt)"

echo "Version in 'CMakeLists.txt' file: '$version'"

if [ "$tag" != "" ]; then
echo "Release mode: check version consistency..."
if [ "$tag" != "$version" ]; then
echo "ERROR: the tag '$tag' is different from the version '$version' in the 'CMakeLists.txt' file"
exit 1
fi
else
echo "Snapshot mode: fetch existing tags..."
git fetch --tags
if [ $(git tag -l "$version") ]; then
echo "ERROR: version '$version' has already been released"
exit 1
fi
fi
13 changes: 13 additions & 0 deletions .github/scripts/patch_doxyfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

echo "Compute the current API version..."
version=$1

if [ "$version" = "" ]; then
# SNAPSHOT version
version="$(sed -rn 's/.*MAJOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*MINOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*PATCH.*\"(.*)\".*/\1/p' CMakeLists.txt)-SNAPSHOT"
fi

echo "Computed current API version: $version"

sed -i "s/%PROJECT_VERSION%/$version/g" ./.github/doxygen/Doxyfile
41 changes: 41 additions & 0 deletions .github/scripts/prepare_doxygen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

echo "Compute the current API version..."
version=$1

if [ "$version" = "" ]; then
# SNAPSHOT version
version="$(sed -rn 's/.*MAJOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*MINOR.*\"(.*)\".*/\1/p' CMakeLists.txt).$(sed -rn 's/.*PATCH.*\"(.*)\".*/\1/p' CMakeLists.txt)-SNAPSHOT"
fi

echo "Computed current API version: $version"

repository_name=$(git rev-parse --show-toplevel | xargs basename)

echo "Clone $repository_name..."
git clone --branch gh-pages https://github.com/eclipse-keypop/"$repository_name".git

cd "$repository_name" || exit

echo "Delete existing SNAPSHOT directory..."
rm -rf ./*-SNAPSHOT

echo "Create target directory $version..."
mkdir "$version"

echo "Copy Doxygen doc..."
cp -rf ../.github/doxygen/out/html/* "$version"/

echo "Update versions list..."
echo "| Version | Documents |" >list_versions.md
echo "|:---:|---|" >>list_versions.md
for directory in $(ls -rd [0-9]*/ | cut -f1 -d'/'); do
echo "| $directory | [API documentation]($directory) |" >>list_versions.md
done

echo "Computed all versions:"
cat list_versions.md

cd ..

echo "Local docs update finished."
50 changes: 50 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and test code

on:
push:
branches:
- main
pull_request:

jobs:
build:

strategy:
matrix:
env:
- toolchain: "toolchain/gcc-linux.cmake"
runner: ubuntu-latest
generator: ""
- toolchain: "toolchain/clang-macos.cmake"
runner: macos-latest
generator: ""
- toolchain: "\"toolchain/clang-windows.cmake\""
runner: windows-latest
generator: "-G \"Visual Studio 17 2022\""

runs-on: ${{ matrix.env.runner }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Linux reqs
if: ${{ matrix.env.runner == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install -y clang cmake cppcheck clang-format clang-tidy gcc pre-commit

- name: Install macOS reqs
if: ${{ matrix.env.runner == 'macos-latest' }}
run: |
brew install llvm cppcheck clang-format gcc pre-commit

- name: Build
run: |
cmake ${{ matrix.env.generator }} -B build -S . -DCMAKE_TOOLCHAIN_FILE=${{ matrix.env.toolchain }}
cmake --build build -j8

- name: Run Linux/macOS tests
if: ${{ matrix.env.runner == 'ubuntu-latest' || matrix.env.runner == 'macos-latest' }}
run: |
./build/bin/keypopcard_ut
2 changes: 1 addition & 1 deletion .github/workflows/publish-doc-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
git commit -m "docs: update ${{ github.event.inputs.version || github.ref_name }} documentation"
git push origin doc --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-keypop-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
with:
token: ${{ secrets.ORG_GITHUB_BOT_TOKEN }}
repository: eclipse-keypop/keypop-api-docs
event-type: update-submodules
event-type: update-submodules
28 changes: 18 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# *************************************************************************************************
# Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *************************************************************************************************/
# *****************************************************************************
# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at *
# https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *****************************************************************************/

CMAKE_MINIMUM_REQUIRED(VERSION 3.5)

PROJECT(KeypopCardCppApi
VERSION 2.0.0
C CXX)
LANGUAGES C CXX)

SET(CMAKE_PROJECT_VERSION_MAJOR "2")
SET(CMAKE_PROJECT_VERSION_MINOR "0")
SET(CMAKE_PROJECT_VERSION_PATCH "0")

SET(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.
${CMAKE_PROJECT_VERSION_MINOR}.
${CMAKE_PROJECT_VERSION_PATCH}")

SET(PACKAGE_NAME "keypop-card-cpp-api")
SET(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
Expand Down
2 changes: 1 addition & 1 deletion CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set noparent
filter=-whitespace/indent,-build/c++11
linelength=120
linelength=80
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Keypop Card C++ API
## Overview
This repository contains C++ source files that define component interfaces aligned with the
This repository contains C++ source files that define component interfaces aligned with the
[**Terminal Card**](https://terminal-api.calypsonet.org/specifications/reader-layer/card-api/)
specifications proposed by the [Calypso Networks Association](https://www.calypsonet.org/). This C++
interface is a port of the [Keypop Card Java API](https://github.com/eclipse-keypop/keypop-card-java-api), which remains
Expand Down Expand Up @@ -37,4 +37,4 @@ Please adhere to the [Code of Conduct](CODE_OF_CONDUCT.md) when participating in

## License
This project is licensed under the [MIT License](LICENSE). For more details, please refer to the [LICENSE](LICENSE)
file.
file.
33 changes: 23 additions & 10 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
# *************************************************************************************************
# Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *************************************************************************************************/
# *****************************************************************************
# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
# *
# This program and the accompanying materials are made available under the *
# terms of the MIT License which is available at *
# https://opensource.org/licenses/MIT. *
# *
# SPDX-License-Identifier: MIT *
# *****************************************************************************/

SET(LIBRARY_NAME keypopcard)

# Declare this library as header only.
ADD_LIBRARY(

${LIBRARY_NAME}

INTERFACE
)

TARGET_INCLUDE_DIRECTORIES(

${LIBRARY_NAME}

INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/keypop/card

${CMAKE_CURRENT_SOURCE_DIR}
)

ADD_LIBRARY(Keypop::Card ALIAS ${LIBRARY_NAME})
ADD_LIBRARY(

Keypop::Card

ALIAS

${LIBRARY_NAME}
)
Loading
Loading