diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index 004b41caf9..eb789c3d26 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -28,4 +28,4 @@ jobs: ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} - run: ./gradlew publishRleasePublicationsToSonatypeRepository + run: ./gradlew publishReleasePublicationToSonatypeRepository diff --git a/.github/workflows/python-build.yml b/.github/workflows/publish-python.yml similarity index 87% rename from .github/workflows/python-build.yml rename to .github/workflows/publish-python.yml index 2c67d28a69..637e91e557 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/publish-python.yml @@ -1,4 +1,4 @@ -name: build-python-dist +name: publish-python on: release: @@ -73,9 +73,14 @@ jobs: path: wrappers/python/dist/*.tar.gz upload-pypi: - name: Deploy + name: Upload to PyPI needs: [build-wheels, build-sdist] runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/zxing-cpp + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing # only run if the commit is tagged... # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') if: github.event_name == 'release' || github.event.inputs.publish == 'y' @@ -86,7 +91,5 @@ jobs: path: dist - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_TOKEN }} - repository_url: https://test.pypi.org/legacy/ +# with: +# repository-url: https://test.pypi.org/legacy/ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 0fe3bb6abe..e870fb9c66 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15) -project (ZXing VERSION "2.2.0") +project (ZXing VERSION "2.2.1") set (ZXING_SONAME 3) # see https://github.com/zxing-cpp/zxing-cpp/issues/333 include(../zxing.cmake) @@ -105,6 +105,7 @@ if (BUILD_READERS) src/Content.h src/Content.cpp src/DecodeHints.h + src/DecodeHints.cpp src/DecoderResult.h src/DetectorResult.h src/Error.h diff --git a/core/src/DecodeHints.cpp b/core/src/DecodeHints.cpp new file mode 100644 index 0000000000..8dbd5a8685 --- /dev/null +++ b/core/src/DecodeHints.cpp @@ -0,0 +1,30 @@ +/* +* Copyright 2023 Axel Waggershauser +*/ +// SPDX-License-Identifier: Apache-2.0 + +#define HIDE_DECODE_HINTS_ALIAS + +#include "ReadBarcode.h" + +namespace ZXing { + +// Provide a struct that is binary compatible with ReaderOptions and is actually called DecodeHints so that +// the compiler generates a correctly mangled pair of ReadBarcode(s) symbols to keep backward ABI compatibility. + +struct DecodeHints +{ + char data[sizeof(ReaderOptions)]; +}; + +Result ReadBarcode(const ImageView& image, const DecodeHints& hints = {}) +{ + return ReadBarcode(image, reinterpret_cast(hints)); +} + +Results ReadBarcodes(const ImageView& image, const DecodeHints& hints = {}) +{ + return ReadBarcodes(image, reinterpret_cast(hints)); +} + +} // ZXing diff --git a/core/src/ReaderOptions.h b/core/src/ReaderOptions.h index e68d0592d7..3b4cabfa9e 100644 --- a/core/src/ReaderOptions.h +++ b/core/src/ReaderOptions.h @@ -172,6 +172,8 @@ class ReaderOptions bool hasFormat(BarcodeFormats f) const noexcept { return _formats.testFlags(f) || _formats.empty(); } }; +#ifndef HIDE_DECODE_HINTS_ALIAS using DecodeHints [[deprecated]] = ReaderOptions; +#endif } // ZXing diff --git a/wrappers/python/README.md b/wrappers/python/README.md index 5366af17da..2d7df24bc4 100644 --- a/wrappers/python/README.md +++ b/wrappers/python/README.md @@ -1,6 +1,5 @@ # Python bindings for zxing-cpp -[![Build + Deploy](https://github.com/zxing-cpp/zxing-cpp/actions/workflows/python-build.yml/badge.svg)](https://github.com/zxing-cpp/zxing-cpp/actions/workflows/python-build.yml) [![PyPI](https://img.shields.io/pypi/v/zxing-cpp.svg)](https://pypi.org/project/zxing-cpp/) ## Installation