diff --git a/.github/workflows/release-cpan.yaml b/.github/workflows/release-cpan.yaml index a96e20e3..5b8934e2 100644 --- a/.github/workflows/release-cpan.yaml +++ b/.github/workflows/release-cpan.yaml @@ -12,8 +12,8 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 - - uses: cucumber/action-publish-cpan@v1.0.0 + - uses: actions/checkout@v4 + - uses: cucumber/action-publish-cpan@v1.0.1 with: cpan-user: ${{ secrets.CPAN_USER }} cpan-password: ${{ secrets.CPAN_PASSWORD }} diff --git a/.github/workflows/release-github.yaml b/.github/workflows/release-github.yaml index 00aa02d8..8030e412 100644 --- a/.github/workflows/release-github.yaml +++ b/.github/workflows/release-github.yaml @@ -12,7 +12,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: cucumber/action-create-github-release@v1.1.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-mvn.yml b/.github/workflows/release-mvn.yml index 50f5ba88..2e95bc0b 100644 --- a/.github/workflows/release-mvn.yml +++ b/.github/workflows/release-mvn.yml @@ -10,8 +10,8 @@ jobs: runs-on: ubuntu-latest environment: Release steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '11' diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index b027774a..9de01c6c 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -10,15 +10,15 @@ jobs: runs-on: ubuntu-latest environment: Release steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '20' cache: 'npm' cache-dependency-path: javascript/package-lock.json - run: npm install-test working-directory: javascript - - uses: cucumber/action-publish-npm@v1.1.0 + - uses: cucumber/action-publish-npm@v1.1.1 with: npm-token: ${{ secrets.NPM_TOKEN }} working-directory: javascript diff --git a/.github/workflows/release-nuget.yaml b/.github/workflows/release-nuget.yaml index 0c8da484..a40a7a97 100644 --- a/.github/workflows/release-nuget.yaml +++ b/.github/workflows/release-nuget.yaml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest environment: Release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.x - uses: cucumber/action-publish-nuget@v1.0.0 diff --git a/.github/workflows/release-php.yaml b/.github/workflows/release-php.yaml index 9c29970b..31a427ee 100644 --- a/.github/workflows/release-php.yaml +++ b/.github/workflows/release-php.yaml @@ -12,7 +12,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: '0' - uses: cucumber/action-publish-subrepo@v1.1.0 diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 54149566..0314b2b2 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest environment: Release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0.2' + ruby-version: '3.2' bundler-cache: true - uses: cucumber/action-publish-rubygem@v1.0.0 with: diff --git a/.github/workflows/test-codegen.yml b/.github/workflows/test-codegen.yml index ec24fc73..c1ac7613 100644 --- a/.github/workflows/test-codegen.yml +++ b/.github/workflows/test-codegen.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 cache: "npm" diff --git a/.github/workflows/test-cpp.yml b/.github/workflows/test-cpp.yml index 809449eb..13071911 100644 --- a/.github/workflows/test-cpp.yml +++ b/.github/workflows/test-cpp.yml @@ -12,22 +12,23 @@ on: jobs: test-cpp: - runs-on: ubuntu-latest - + strategy: + matrix: + os: + - ubuntu-20.04 + - ubuntu-22.04 + # - windows-2019 + # - windows-2022 + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - - name: install cmake and libraries + - uses: actions/checkout@v4 + - name: install dependencies + working-directory: cpp run: | - sudo apt-get update - sudo apt-get install ninja-build cmake - sudo apt-get install nlohmann-json3-dev - ninja --version - cmake --version - gcc --version + cmake -P cmake/cmade install - name: configure and build - run: | - cmake -S . -B build - cmake --build build working-directory: cpp + run: | + cmake -P cmake/cmate configure + cmake -P cmake/cmate build diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index bfb71199..cc62a820 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-dotnet@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 with: dotnet-version: '5.0.x' diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index e20a276f..55974cbe 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -18,17 +18,17 @@ jobs: matrix: os: - ubuntu-latest - go: ['1.13.x', '1.18.x'] + go: ['1.20.x', '1.21.x'] include: - os: windows-latest - go: '1.18.x' + go: '1.21.x' - os: macos-latest - go: '1.18.x' + go: '1.21.x' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} diff --git a/.github/workflows/test-java.yml b/.github/workflows/test-java.yml index 79089cc3..be18dbd7 100644 --- a/.github/workflows/test-java.yml +++ b/.github/workflows/test-java.yml @@ -27,9 +27,9 @@ jobs: java: "17" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: "temurin" java-version: ${{ matrix.java }} diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index 5939f585..61e47a35 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -18,21 +18,21 @@ jobs: matrix: os: - ubuntu-latest - node-version: ["12.x", "14.x", "16.x", "17.x", "18.x"] + node-version: ["18.x", "20.x"] include: - os: windows-latest - node-version: "18.x" + node-version: "20.x" - os: macos-latest - node-version: "18.x" + node-version: "20.x" steps: - name: set git core.autocrlf to 'input' run: git config --global core.autocrlf input - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: "npm" diff --git a/.github/workflows/test-perl.yml b/.github/workflows/test-perl.yml index faabc400..1fbfa2d7 100644 --- a/.github/workflows/test-perl.yml +++ b/.github/workflows/test-perl.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install cpanm and multiple modules uses: perl-actions/install-with-cpanm@v1 diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 2de50e41..7cca3666 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -19,7 +19,7 @@ jobs: composer-mode: ['low-deps', 'high-deps'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/test-ruby.yml b/.github/workflows/test-ruby.yml index b84a3020..eafea738 100644 --- a/.github/workflows/test-ruby.yml +++ b/.github/workflows/test-ruby.yml @@ -18,20 +18,17 @@ jobs: matrix: os: - ubuntu-latest - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ['2.6', '2.7', '3.0', '3.1', '3.2'] include: - os: macos-latest - ruby: "3.1" + ruby: '3.2' steps: - - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true working-directory: ruby - - run: bundle exec rake working-directory: ruby diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e8bad9d..8f122aed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] + +## [24.0.1] - 2023-12-21 +### Fixed +- Update repo URLs ([#190](https://github.com/cucumber/messages/pull/190)) + +## [24.0.0] - 2023-11-24 +### Added +- Add `stackTrace` prop to `Exception` message ([#182](https://github.com/cucumber/messages/pull/182)) + +## [23.0.0] - 2023-11-01 ### Added - Added Python implementation ([#165](https://github.com/cucumber/messages/pull/165)) - Added C++ implementation ([#152](https://github.com/cucumber/messages/pull/152)) +### Changed +- [Ruby] Updated minimum Ruby version to 2.5 - ([#177](https://github.com/cucumber/messages/pull/177) [luke-hill](https://github.com/luke-hill)) + ## [22.0.0] - 2023-04-06 ### Added - Added source reference to parameter type ([#45](https://github.com/cucumber/messages/pull/145)) @@ -497,13 +510,16 @@ aggregated status. ### Added - Protobuf messages for Go, Java, JavaScript, TypeScript and Ruby -[Unreleased]: https://github.com/cucumber/messages/compare/v22.0.0...main -[22.0.0]: https://github.com/cucumber/messages/compare/v21.0.1...main -[21.0.1]: https://github.com/cucumber/messages/compare/v21.0.0...main -[21.0.0]: https://github.com/cucumber/messages/compare/v20.0.0...main -[20.0.0]: https://github.com/cucumber/messages/compare/v19.1.4...main -[19.1.4]: https://github.com/cucumber/messages/compare/v19.1.3...main -[19.1.3]: https://github.com/cucumber/messages/compare/v19.1.2...main +[Unreleased]: https://github.com/cucumber/messages/compare/v24.0.1...HEAD +[24.0.1]: https://github.com/cucumber/messages/compare/v24.0.0...v24.0.1 +[24.0.0]: https://github.com/cucumber/messages/compare/v23.0.0...v24.0.0 +[23.0.0]: https://github.com/cucumber/messages/compare/v22.0.0...v23.0.0 +[22.0.0]: https://github.com/cucumber/messages/compare/v21.0.1...v22.0.0 +[21.0.1]: https://github.com/cucumber/messages/compare/v21.0.0...v21.0.1 +[21.0.0]: https://github.com/cucumber/messages/compare/v20.0.0...v21.0.0 +[20.0.0]: https://github.com/cucumber/messages/compare/v19.1.4...v20.0.0 +[19.1.4]: https://github.com/cucumber/messages/compare/v19.1.3...v19.1.4 +[19.1.3]: https://github.com/cucumber/messages/compare/v19.1.2...v19.1.3 [19.1.2]: https://github.com/cucumber/messages/compare/v19.1.1...v19.1.2 [19.1.1]: https://github.com/cucumber/messages/compare/v19.1.0...v19.1.1 [19.1.0]: https://github.com/cucumber/messages/compare/v19.0.0...v19.1.0 diff --git a/cpp/LICENSE b/LICENSE similarity index 100% rename from cpp/LICENSE rename to LICENSE diff --git a/README.md b/README.md index 88904605..268c5120 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ However, it does not contain the following information (but Cucumber Messages do * Parameter types This kind of information is required to produce rich reports and analytics, and is -used in [@cucumber/react](https://github.com/cucumber/cucumber-react) and [Cucumber Reports](https://reports.cucumber.io/). +used in [@cucumber/react-components](https://github.com/cucumber/react-components) and [Cucumber Reports](https://reports.cucumber.io/). ## Examples diff --git a/cpp/.gitignore b/cpp/.gitignore index c99592be..cd795b40 100644 --- a/cpp/.gitignore +++ b/cpp/.gitignore @@ -1,5 +1,5 @@ .configured .built +.cmade/ build/ -ext/ stage/ diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 30290aa5..2236a816 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,35 +1,30 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) -project(cucumber-messages VERSION 1.0.0 LANGUAGES CXX) +project(cucumber_messages VERSION 1.0.0 LANGUAGES C CXX) include(GNUInstallDirs) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) find_package(nlohmann_json CONFIG REQUIRED) -add_subdirectory(src) +add_subdirectory(src/lib/messages) install( TARGETS - cucumber-messages - EXPORT cucumber-messages-config + cucumber_messages_lib + EXPORT cucumber_messages-config RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install( - DIRECTORY "${CMAKE_SOURCE_DIR}/include/" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cucumber -) - -install( - EXPORT cucumber-messages-config - FILE cucumber-messages-config.cmake + EXPORT cucumber_messages-config + FILE cucumber_messages-config.cmake NAMESPACE cucumber:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cucumber-messages + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cucumber_messages ) diff --git a/cpp/Dockerfile b/cpp/Dockerfile index 39f12155..a212c540 100644 --- a/cpp/Dockerfile +++ b/cpp/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image FROM debian:bullseye-slim AS cpp diff --git a/cpp/Makefile b/cpp/Makefile index d8ea5dac..c95c2769 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -10,7 +10,7 @@ SOURCES = \ $(shell find $(LIB_DIR) -name "*.[ch]pp") HERE = $(shell pwd) -CMAKE_BUILDROOT = $(HERE)/build/root +CMAKE_BUILDROOT = $(HERE)/.cmade/env CMAKELISTS = $(shell find . -name CMakeLists.txt) help: ## Show this help diff --git a/cpp/cmake/cmade b/cpp/cmake/cmade new file mode 100755 index 00000000..adda9d26 --- /dev/null +++ b/cpp/cmake/cmade @@ -0,0 +1,528 @@ +#!/usr/bin/env -S cmake -P +# -*- CMake -*- + +set(CMADE "cmade") +set(CMADE_DEPSFILE "deps.txt") +set(CMADE_VERSION "X.Y.Z") +list( + APPEND + CMADE_VARS + "CMADE_GIT_HOST=GH" + "CMADE_GH=https://github.com" + "CMADE_GL=https://gitlab.com" + "CMADE_BB=https://bitbucket.org" +) +list( + APPEND + CMADE_OPTIONS + "verbose" + "simulate" + "no-cache" +) + + +############################################################################## +# +# Utility functions +# +############################################################################## +function(cmade_show_help) + message("\ +CMake Dependency Installer v${CMADE_VERSION} + +usage: ${CMADE} [OPTIONS] COMMAND + +Options: + --verbose Verbose operation + --simulate Echo commands instead of running them + --no-cache Ignore/erase existing repositories + +Commands: + install Install dependencies from ${CMADE_DEPSFILE} + clean Clean local environment + help Display this information +") +endfunction() + +function(cmade_die MSG) + message(FATAL_ERROR "CMade: error: ${MSG}") +endfunction() + +function(cmade_msg MSG) + message("CMade: ${MSG}") +endfunction() + +function(cmade_info MSG) + if(CMADE_VERBOSE) + cmade_msg(${MSG}) + endif() +endfunction() + +function(cmade_setg VAR VAL) + set(${VAR} "${VAL}" CACHE INTERNAL "${VAR}") +endfunction() + +function(cmade_run_prog) + cmake_parse_arguments(RUN "" "DIR" "CMD" ${ARGN}) + + if(CMADE_SIMULATE) + list(PREPEND RUN_CMD "echo") + endif() + + execute_process( + COMMAND ${RUN_CMD} + WORKING_DIRECTORY "${RUN_DIR}" + RESULTS_VARIABLE RC + ) + + if(RC) + list(JOIN ARGV " " RUN_CMD) + cmade_die("command failed: ${RUN_CMD}") + endif() +endfunction() + +function(cmade_download URL FILE) + if(CMADE_SIMULATE) + cmade_msg("download ${URL} to ${FILE}") + else() + file(DOWNLOAD ${URL} ${FILE} STATUS ST) + endif() + + list(GET ST 0 RC) + + if(RC) + cmade_die("download of ${URL} failed: ${ST}") + endif() +endfunction() + +function(cmade_unique_dir PATH VAR) + file(GLOB PATHS "${PATH}/*") + + foreach(PATH ${PATHS}) + if(IS_DIRECTORY ${PATH}) + list(APPEND ALL_DIRS ${PATH}) + endif() + endforeach() + + list(LENGTH ALL_DIRS DIRS) + + if(DIRS EQUAL 0) + cmade_die("no directories found in ${PATH}") + elseif(DIRS GREATER 1) + cmade_die("multiple directories found ${PATH}") + endif() + + list(GET ALL_DIRS 0 DIR) + set(${VAR} ${DIR} PARENT_SCOPE) +endfunction() + +function(cmade_set_cache_dir NAME) + string(REPLACE "/" "_" DIR ${NAME}) + set(DIR "${CMADE_CACHE}/${DIR}") + cmade_setg(CMADE_CACHE_DIR ${DIR}) + cmade_setg(CMADE_SOURCE_DIR "${DIR}/sources") + cmade_setg(CMADE_BUILD_DIR "${DIR}/build") + cmade_setg(CMADE_STATE_DIR "${DIR}/state") + + if(CMADE_NO_CACHE) + file(REMOVE_RECURSE "${DIR}") + endif() +endfunction() + +function(cmade_state_file STATE VAR) + set(${VAR} "${CMADE_STATE_DIR}/.${STATE}" PARENT_SCOPE) +endfunction() + +function(cmade_set_state STATE) + file(MAKE_DIRECTORY ${CMADE_STATE_DIR}) + cmade_state_file(${STATE} FILE) + file(TOUCH ${FILE}) +endfunction() + +function(cmade_fetch_repo HOST REPO REF) + if(HOST MATCHES "^\\$\\{(.+)\\}$") + # Dereference variable + set(HOST ${${CMAKE_MATCH_1}}) + endif() + + if(HOST STREQUAL "GH") + set(HOST "https://github.com") + elseif(TYPE STREQUAL "GL") + set(HOST "https://gitlab.com") + endif() + + set(URL "${HOST}/${REPO}.git") + + set(GIT_ARGS "clone") + list( + APPEND GIT_ARGS + -c advice.detachedHead=false + --depth 1 + ) + + if(REF) + list(APPEND GIT_ARGS --branch "${REF}") + endif() + + cmade_set_cache_dir(${REPO}) + cmade_state_file("fetched" FETCHED) + + if(NOT IS_DIRECTORY ${CMADE_SOURCE_DIR} OR NOT EXISTS ${FETCHED}) + # Whatever the reason, we're (re-)fetching + file(REMOVE_RECURSE ${CMADE_SOURCE_DIR}) + cmade_info("cloning ${URL} in ${CMADE_SOURCE_DIR}") + cmade_run_prog(CMD git ${GIT_ARGS} ${URL} ${CMADE_SOURCE_DIR}) + cmade_set_state("fetched") + endif() +endfunction() + +function(cmade_fetch_url URL) + string(MD5 HASH ${URL}) + + if(URL MATCHES "/([^/]+)$") + set(FILE ${CMAKE_MATCH_1}) + else() + cmade_die("can't find filename from URL: ${URL}") + endif() + + cmade_set_cache_dir(${HASH}) + cmade_state_file("fetched" FETCHED) + cmade_state_file("extracted" EXTRACTED) + set(CFILE "${CMADE_CACHE_DIR}/${FILE}") + + if(NOT EXISTS ${CFILE}) + cmade_info("downloading ${URL} in ${CDIR}") + cmade_download(${URL} ${CFILE}) + cmade_set_state("fetched") + endif() + + if(NOT IS_DIRECTORY ${CMADE_SOURCE_DIR} OR NOT EXISTS ${EXTRACTED}) + file(REMOVE_RECURSE ${CMADE_SOURCE_DIR}) + cmade_info("extracting ${FILE}") + file( + ARCHIVE_EXTRACT + INPUT ${CFILE} + DESTINATION ${CMADE_SOURCE_DIR} + ) + cmade_set_state("extracted") + endif() + + cmade_unique_dir(${CMADE_SOURCE_DIR} SDIR) + cmade_setg(CMADE_SOURCE_DIR ${SDIR}) +endfunction() + +############################################################################## +# +# Dependency installation functions +# +############################################################################## +function(cmade_build_cmake_dep) + cmade_state_file("configured" CONFIGURED) + cmade_state_file("built" BUILT) + cmade_state_file("installed" INSTALLED) + + cmade_msg("building with: ${ARGV}") + + if(NOT EXISTS ${CONFIGURED}) + cmade_run_prog( + CMD + ${CMAKE_COMMAND} + -DCMAKE_PREFIX_PATH=${CMADE_ENV} + -DCMAKE_INSTALL_PREFIX=${CMADE_ENV} + -DCMAKE_BUILD_TYPE:STRING=Release + -S ${CMADE_SOURCE_DIR} -B ${CMADE_BUILD_DIR} + ${ARGV} + ) + cmade_set_state("configured") + endif() + if(NOT EXISTS ${BUILT}) + cmade_run_prog(CMD ${CMAKE_COMMAND} --build ${CMADE_BUILD_DIR} --parallel) + cmade_set_state("built") + endif() + if(NOT EXISTS ${INSTALLED}) + cmade_run_prog(CMD ${CMAKE_COMMAND} --install ${CMADE_BUILD_DIR}) + cmade_set_state("installed") + endif() +endfunction() + +function(cmade_build_meson_dep) + cmade_state_file("configured" CONFIGURED) + cmade_state_file("installed" INSTALLED) + file(MAKE_DIRECTORY ${CMADE_BUILD_DIR}) + + if(NOT EXISTS ${CONFIGURED}) + cmade_run_prog( + DIR ${CMADE_BUILD_DIR} + CMD + meson + --prefix=${CMADE_ENV} + --pkg-config-path=${CMADE_ENV} + --cmake-prefix-path=${CMADE_ENV} + ${ARGV} + . ${SRCDIR} + ) + cmade_set_state("configured") + endif() + if(NOT EXISTS ${INSTALLED}) + cmade_run_prog(meson install) + cmade_set_state("installed") + endif() +endfunction() + +function(cmade_build_autotools_dep) + cmade_state_file("configured" CONFIGURED) + cmade_state_file("installed" INSTALLED) + file(MAKE_DIRECTORY ${CMADE_BUILD_DIR}) + + if(NOT EXISTS ${CONFIGURED}) + cmade_run_prog( + DIR ${CMADE_BUILD_DIR} + CMD + ${CMADE_SOURCE_DIR}/configure + --prefix=${CMADE_ENV} + ${ARGV} + ) + cmade_set_state("configured") + endif() + if(NOT EXISTS ${INSTALLED}) + cmade_run_prog( + DIR ${CMADE_BUILD_DIR} + CMD make install + ) + cmade_set_state("installed") + endif() +endfunction() + +function(cmade_build_makefile_dep) + cmade_state_file("built" BUILT) + cmade_state_file("installed" INSTALLED) + file(MAKE_DIRECTORY ${CMADE_BUILD_DIR}) + + if(NOT EXISTS ${BUILT}) + cmade_run_prog( + DIR ${CMADE_SOURCE_DIR} + CMD make + ) + cmade_set_state("built") + endif() + if(NOT EXISTS ${INSTALLED}) + cmade_run_prog( + DIR ${CMADE_SOURCE_DIR} + CMD make prefix=${CMADE_ENV} install + ) + cmade_set_state("installed") + endif() +endfunction() + +function(cmade_build_dep ARGS) + set(OPT_PROC ON) + string(REGEX MATCHALL "[^ \"']+|\"([^\"]*)\"|'([^']*)'" ARGS "${ARGS}") + + foreach(ARG ${ARGS}) + if(OPT_PROC AND ARG MATCHES "^--") + if(ARG STREQUAL "--") + set(OPT_PROC OFF) + elseif(ARG MATCHES "^--srcdir=(.+)") + cmade_setg( + CMADE_SOURCE_DIR + "${CMADE_SOURCE_DIR}/${CMAKE_MATCH_1}" + ) + endif() + else() + list(APPEND CONF_ARGS ${ARG}) + endif() + endforeach() + + if(NOT IS_DIRECTORY "${CMADE_SOURCE_DIR}") + cmade_die("invalid source directory: ${CMADE_SOURCE_DIR}") + endif() + + if(EXISTS "${CMADE_SOURCE_DIR}/CMakeLists.txt") + cmade_build_cmake_dep(${CONF_ARGS}) + elseif(EXISTS "${CMADE_SOURCE_DIR}/meson.build") + cmade_build_meson_dep(${CONF_ARGS}) + elseif(EXISTS "${CMADE_SOURCE_DIR}/configure") + cmade_build_autotools_dep(${CONF_ARGS}) + elseif(EXISTS "${CMADE_SOURCE_DIR}/Makefile") + cmade_build_makefile_dep(${CONF_ARGS}) + else() + cmade_die("don't know how to build in ${CMADE_SOURCE_DIR}") + endif() +endfunction() + +function(cmade_install_repo HOST REPO TAG ARGS) + cmade_fetch_repo(${HOST} ${REPO} "${TAG}") + cmade_build_dep("${ARGS}") +endfunction() + +function(cmade_install_url URL ARGS) + cmade_fetch_url(${URL}) + cmade_build_dep("${ARGS}") +endfunction() + +function(cmade_install) + if(NOT EXISTS ${CMADE_DEPSFILE}) + cmade_msg("no dependencies") + return() + endif() + + file(STRINGS ${CMADE_DEPSFILE} DEPS) + + foreach(SPEC ${DEPS}) + if(SPEC MATCHES "^#") + # Skip comments + continue() + elseif(SPEC MATCHES "^([A-Za-z0-9_-]+)=(.+)$") + # Variable assignment + cmade_setg("CMADE_${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + elseif(SPEC MATCHES "^(https?://[^ ]+)([ ](.+))?$") + # URL + set(URL ${CMAKE_MATCH_1}) + set(ARGS "${CMAKE_MATCH_3}") + cmade_msg("checking ${URL}") + cmade_install_url(${URL} "${ARGS}") + elseif(SPEC MATCHES "^(([^: ]+):)?([^@ ]+)(@([^ ]+))?([ ](.+))?$") + # GitHub/GitLab style project short ref + if(CMAKE_MATCH_2) + if(CMADE_${CMAKE_MATCH_2}) + set(HOST ${CMADE_${CMAKE_MATCH_2}}) + else() + cmade_die("unknown id: ${CMAKE_MATCH_2}") + endif() + else() + set(HOST ${CMADE_${CMADE_GIT_HOST}}) + endif() + + set(REPO ${CMAKE_MATCH_3}) + set(TAG ${CMAKE_MATCH_5}) + set(ARGS "${CMAKE_MATCH_7}") + cmade_msg("checking ${REPO}") + cmade_install_repo(${HOST} ${REPO} "${TAG}" "${ARGS}") + else() + cmade_die("invalid dependency line: ${SPEC}") + endif() + endforeach() +endfunction() + +############################################################################## +# +# Environment cleaning functions +# +############################################################################## +function(cmade_clean) + cmade_msg("cleaning: ${CMADE_ROOT}") + + if (IS_DIRECTORY ${CMADE_ROOT}) + file(REMOVE_RECURSE ${CMADE_ROOT}) + endif() +endfunction() + +############################################################################## +# +# Argument functions +# +############################################################################## +function(cmade_locate_cmade_arguments) + set(FOUND OFF) + + foreach(POS RANGE ${CMAKE_ARGC}) + string(TOLOWER "${CMAKE_ARGV${POS}}" ARG) + math(EXPR POS "${POS}+1") + + if (ARG MATCHES "${CMADE}$") + # Script args follow us, POS already incremented + set(FOUND ON) + cmade_setg(CMADE_POS ${POS}) + break() + endif() + endforeach() + + if(NOT FOUND) + # Should not happen if script has correct name (see CMADE at top) + cmade_die("parse_argument") + endif() +endfunction() + +function(cmade_parse_arguments) + cmade_locate_cmade_arguments() + + while(CMADE_POS LESS ${CMAKE_ARGC}) + if ("${CMAKE_ARGV${CMADE_POS}}" MATCHES "--?([A-Za-z0-9_-]+)") + list(FIND CMADE_OPTIONS ${CMAKE_MATCH_1} OPT) + + if (OPT LESS 0) + cmade_die("unknown option: ${CMAKE_MATCH_1}") + else() + string(TOUPPER "CMADE_${CMAKE_MATCH_1}" OPT) + string(REPLACE "-" "_" OPT "${OPT}") + cmade_setg(${OPT} 1) + endif() + else() + list(APPEND CMADE_ARGS "${CMAKE_ARGV${CMADE_POS}}") + endif() + + math(EXPR CMADE_POS "${CMADE_POS}+1") + endwhile() + + list(LENGTH CMADE_ARGS CMADE_ARGC) + + if (CMADE_ARGC GREATER 0) + list(POP_FRONT CMADE_ARGS CMADE_CMD) + cmade_setg(CMADE_CMD "${CMADE_CMD}") + endif() + + cmade_setg(CMADE_ARGS "${CMADE_ARGS}") + get_filename_component(CMADE_ENV "${CMADE_ENV}" REALPATH) + cmade_setg(CMADE_ENV ${CMADE_ENV}) +endfunction() + +############################################################################## +# +# Default variables +# +############################################################################## +function(cmade_set_vars) + get_filename_component(DIR ".cmade" ABSOLUTE) + cmade_setg(CMADE_ROOT ${DIR}) + get_filename_component(DIR "cache" ABSOLUTE BASE_DIR ${CMADE_ROOT}) + cmade_setg(CMADE_CACHE ${DIR}) + get_filename_component(DIR "env" ABSOLUTE BASE_DIR ${CMADE_ROOT}) + cmade_setg(CMADE_ENV ${DIR}) + + foreach(VDEF ${CMADE_VARS}) + if(VDEF MATCHES "^CMADE_([^=]+)=(.*)$") + cmade_info("default: ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}") + cmade_setg("CMADE_${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif() + endforeach() +endfunction() + +############################################################################## +# +# Command processing +# +############################################################################## +function(cmade_process_cmd) + if (CMADE_CMD STREQUAL "version") + message(${CMADE_VERSION}) + elseif (CMADE_CMD STREQUAL "install") + cmade_install() + elseif (CMADE_CMD STREQUAL "clean") + cmade_clean() + elseif (CMADE_CMD STREQUAL "help") + cmade_show_help() + elseif(CMADE_CMD) + cmade_msg("unknown command: ${CMADE_CMD}") + elseif(NOT CMADE_CMD) + cmade_msg("no command") + endif() +endfunction() + +############################################################################## +# +# Main part +# +############################################################################## +cmade_parse_arguments() +cmade_set_vars() +cmade_process_cmd() diff --git a/cpp/cmake/cmate b/cpp/cmake/cmate new file mode 100755 index 00000000..373b2b93 --- /dev/null +++ b/cpp/cmake/cmate @@ -0,0 +1,854 @@ +#!/usr/bin/env -S cmake -P +# -*- CMake -*- + +set(CMATE "cmate") +set(CMATE_VER "X.Y.Z") +set(CMATE_CONF "cmate.json") +cmake_policy(SET CMP0057 NEW) +list( + APPEND + CMATE_CMDS + "configure" + "build" + "clean" +) +list( + APPEND + CMATE_OPTIONS + "verbose" +) +list( + APPEND + CMATE_CONFIGURE_OPTIONS + "dry-run" + "dump" + "namespace" + "version" + "version-file" + "source-pat" + "header-pat" +) +############################################################################## +# +# Help messages +# +############################################################################## +set(CMATE_HELP_HEADER "CMake Automatic TargEts v${CMATE_VER}") + +# Generic help +set( + CMATE_HELP + " +Usage: cmate [OPTIONS] COMMAND + +Options: + --verbose Verbose operation + +Commands: + configure Scans and configures targets + build + clean + help Display this information + +See 'cmate help ' to read about a specific subcommand." +) + +# Configure help +set( + CMATE_CONFIGURE_HELP + " +Usage: cmate configure [OPTIONS] + +Configure local project + +Options: + --dry-run Don't touch anything + --dump Dump generated CMakeLists.txt + --namespace=NS CMake package namespace + --version=SEMVER CMake package version + --version-file=FILE CMake package version from FILE + --version-file=FILE CMake package version from FILE + --source-pat=PATTERN CMate targets source file glob pattern + (default: \$CACHE{CMATE_SOURCE_PAT}) + --header-pat=PATTERN CMate targets header file glob pattern + (default: \$CACHE{CMATE_HEADER_PAT})" +) + +# Build help +set( + CMATE_BUILD_HELP + " +Usage: cmate build + +Build local project" +) + +# Clean help +set( + CMATE_CLEAN_HELP + " +Usage: cmate clean + +Clean local project" +) +############################################################################## +# +# Targets +# +############################################################################## +set(CMATE_TARGETS "") + +############################################################################## +# +# Utility functions +# +############################################################################## +function(cmate_show_help) + set(HVAR "CMATE") + if(CMATE_ARGC GREATER 0) + list(GET CMATE_ARGS 0 HCMD) + + if(${HCMD} IN_LIST CMATE_CMDS) + string(TOUPPER "${HCMD}" HCMD) + string(APPEND HVAR "_${HCMD}") + else() + cmate_die("no such command: ${HCMD}") + endif() + endif() + + string(APPEND HVAR "_HELP") + string(CONFIGURE ${${HVAR}} HELP) + + message("${CMATE_HELP_HEADER}") + message(${HELP}) +endfunction() + +function(cmate_die MSG) + message(FATAL_ERROR "CMate: error: ${MSG}") +endfunction() + +function(cmate_msg) + list(JOIN ARGV "" MSGS) + message("CMate: ${MSGS}") +endfunction() + +function(cmate_warn MSG) + message(WARNING "CMate: ${MSG}") +endfunction() + +function(cmate_info MSG) + if(CMATE_VERBOSE) + cmate_msg(${MSG}) + endif() +endfunction() + +function(cmate_setg VAR VAL) + set(${VAR} "${VAL}" CACHE INTERNAL "${VAR}") +endfunction() + +function(cmate_state_file STATE VAR) + set(${VAR} "${CMATE_STATE_DIR}/.${STATE}" PARENT_SCOPE) +endfunction() + +function(cmate_clear_state STATE) + file(MAKE_DIRECTORY ${CMATE_STATE_DIR}) + cmate_state_file(${STATE} FILE) + file(REMOVE ${FILE}) +endfunction() + +function(cmate_set_state STATE) + file(MAKE_DIRECTORY ${CMATE_STATE_DIR}) + cmate_state_file(${STATE} FILE) + file(TOUCH ${FILE}) +endfunction() + +function(cmate_load_version) + if(NOT "${CMATE_VERSION}" STREQUAL "") + return() + endif() + + if("${CMATE_VERSION_FILE}" STREQUAL "") + cmate_setg( + CMATE_VERSION_FILE + "${CMATE_ROOT_DIR}/version.txt" + ) + endif() + + if(EXISTS ${CMATE_VERSION_FILE}) + file( + STRINGS ${CMATE_VERSION_FILE} VER + REGEX "^[^\\.]+\\.[^\\.]+\\.[^\\.]+$" + LIMIT_COUNT 1 + ) + + cmate_setg(CMATE_VERSION ${VER}) + endif() +endfunction() + +function(cmate_set_version) + cmate_load_version() + + if("${CMATE_VERSION}" STREQUAL "") + cmate_warn("using default version: 0.1.0") + cmate_setg(CMATE_VERSION "0.1.0") + endif() + + if("${CMATE_VERSION}" MATCHES "^([^\\.]+)\\.([^\\.]+)\\.([^\\.]+)$") + cmate_setg(CMATE_VERSION_MAJOR ${CMAKE_MATCH_1}) + cmate_setg(CMATE_VERSION_MINOR ${CMAKE_MATCH_2}) + cmate_setg(CMATE_VERSION_PATCH ${CMAKE_MATCH_3}) + else() + cmate_die("unable to parse version: ${CMATE_VERSION}") + endif() +endfunction() + +macro(cmate_setv VAR VAL) + if("${${VAR}}" STREQUAL "") + set(${VAR} ${VAL}) + endif() +endmacro() + +function(cmate_json_get_array JSON KEY VAR) + string(JSON ARRAY ERROR_VARIABLE ERR GET ${JSON} ${KEY}) + set(ITEMS "") + + if (NOT ERR) + string(JSON N LENGTH ${ARRAY}) + + if(${N} GREATER_EQUAL 1) + math(EXPR N "${N}-1") + + foreach(I RANGE ${N}) + string(JSON ITEM GET ${ARRAY} ${I}) + list(APPEND ITEMS ${ITEM}) + endforeach() + endif() + endif() + + set(${VAR} ${ITEMS} PARENT_SCOPE) +endfunction() + +function(cmate_load_cmake_package_deps JSON PREFIX) + cmate_json_get_array(${JSON} "cmake" "PKGS") + set(PACKAGES "") + + foreach(PKG ${PKGS}) + set(PKGTYPE "STRING") + + if("${PKG}" MATCHES "^[[{].*$") + string(JSON PKGTYPE TYPE ${PKG}) + endif() + + if(${PKGTYPE} STREQUAL "STRING") + # Simple module + list(APPEND PACKAGES ${PKG}) + elseif(${PKGTYPE} STREQUAL "OBJECT") + # Module and components + string(JSON PKGNAME MEMBER ${PKG} 0) + list(APPEND PACKAGES ${PKGNAME}) + + cmate_json_get_array(${PKG} ${PKGNAME} "COMPS") + + set("${PREFIX}_CMAKE_${PKGNAME}_COMPS" ${COMPS} PARENT_SCOPE) + endif() + endforeach() + + set("${PREFIX}_CMAKE_PACKAGES" ${PACKAGES} PARENT_SCOPE) +endfunction() + +function(cmate_load_pkgconfig_package_deps JSON PREFIX) + cmate_json_get_array(${JSON} "pkgconfig" "PKGS") + set("${PREFIX}_PKGCONFIG_PACKAGES" ${PKGS} PARENT_SCOPE) +endfunction() + +function(cmate_load_conf FILE) + if(NOT EXISTS ${FILE}) + return() + endif() + + file(READ ${FILE} JSON) + + string(JSON PROJECT GET ${JSON} "name") + cmate_setg(CMATE_PROJECT ${PROJECT}) + string(JSON VERSION GET ${JSON} "version") + cmate_setg(CMATE_VERSION ${VERSION}) + string(JSON NAMESPACE GET ${JSON} "namespace") + cmate_setg(CMATE_NAMESPACE ${NAMESPACE}) + + string(JSON PKGS GET ${JSON} "packages") + cmate_setg(CMATE_PACKAGES ${PKGS}) +endfunction() + +function(cmate_load_link_deps FILE PREFIX) + set(PUBLIC_DEPS "") + set(PRIVATE_DEPS "") + set(LVAR "PUBLIC_DEPS") + + if(EXISTS ${FILE}) + file(READ ${FILE} JSON) + string(JSON LIBS GET ${JSON} "libs") + + foreach(TYPE PUBLIC PRIVATE) + # TODO: add more checks for correct JSON structure + string(TOLOWER ${TYPE} KEY) + cmate_json_get_array(${LIBS} ${KEY} "${TYPE}_DEPS") + endforeach() + endif() + + set(${PREFIX}_PUBLIC_DEPS ${PUBLIC_DEPS} PARENT_SCOPE) + list(LENGTH PUBLIC_DEPS PUBLIC_DEPS_COUNT) + set(${PREFIX}_PUBLIC_DEPS_COUNT ${PUBLIC_DEPS_COUNT} PARENT_SCOPE) + + set(${PREFIX}_PRIVATE_DEPS ${PRIVATE_DEPS} PARENT_SCOPE) + list(LENGTH PRIVATE_DEPS PRIVATE_DEPS_COUNT) + set(${PREFIX}_PRIVATE_DEPS_COUNT ${PRIVATE_DEPS_COUNT} PARENT_SCOPE) + + math(EXPR DEPS_COUNT "${PUBLIC_DEPS_COUNT} + ${PRIVATE_DEPS_COUNT}") + set(${PREFIX}_DEPS_COUNT ${DEPS_COUNT} PARENT_SCOPE) +endfunction() + +############################################################################## +# +# Target common functions +# +############################################################################## +function(cmate_target_link_deps NAME DEPS_FILE VAR) + cmate_load_link_deps(${DEPS_FILE} TGT) + + if(${TGT_DEPS_COUNT} GREATER 0) + set(TDEPS "\ntarget_link_libraries(\n ${NAME}") + + foreach(TYPE PUBLIC PRIVATE) + if(${TGT_${TYPE}_DEPS_COUNT} GREATER 0) + string(APPEND TDEPS "\n ${TYPE}") + + foreach(DEP ${TGT_${TYPE}_DEPS}) + string(APPEND TDEPS "\n ${DEP}") + endforeach() + endif() + endforeach() + + string(APPEND TDEPS "\n)\n") + set(${VAR} ${TDEPS} PARENT_SCOPE) + endif() +endfunction() + +function(cmate_target_name NAME TYPE VAR) + string(TOLOWER "${CMATE_NAMESPACE}_${NAME}_${TYPE}" TBASE) + string(REPLACE "-" "_" TBASE ${TBASE}) + set(${VAR} ${TBASE} PARENT_SCOPE) +endfunction() + +############################################################################## +# +# Library processing functions +# +############################################################################## +function(cmate_configure_lib NAME TBASE INC_BASE SRC_BASE) + string(TOUPPER ${TBASE} VBASE) + + if(${CMATE_DRY_RUN}) + cmate_msg( + "found library ${NAME}" + " (I:${INC_BASE}/${NAME}" + ", S:${SRC_BASE}/${NAME})" + ) + return() + endif() + + list(APPEND CMATE_TARGETS ${TBASE}) + + set(HDIR "${CMATE_ROOT_DIR}/${INC_BASE}/${NAME}") + set(SDIR "${CMATE_ROOT_DIR}/${SRC_BASE}/${NAME}") + set(CM_FILE "${SDIR}/CMakeLists.txt") + set(DEPS_FILE "${SDIR}/cmate.json") + file(GLOB_RECURSE HEADERS "${HDIR}/${CMATE_HEADER_PAT}") + file(GLOB_RECURSE SOURCES "${SDIR}/${CMATE_SOURCE_PAT}") + + string(APPEND CONTENT "add_library(${TBASE})\n") + + if(CMATE_NAMESPACE) + string( + APPEND + CONTENT + "add_library(${CMATE_NAMESPACE}::${NAME} ALIAS ${TBASE})\n" + ) + endif() + + string( + APPEND + CONTENT + " +set(${VBASE}_INC_DIR \"\${PROJECT_SOURCE_DIR}/${INC_BASE}/${NAME}\") +file(GLOB_RECURSE ${VBASE}_HEADERS \${${VBASE}_INC_DIR}/${CMATE_HEADER_PAT}) +list(APPEND ${VBASE}_ALL_SOURCES \${${VBASE}_HEADERS}) + +set(${VBASE}_SRC_DIR \"\${CMAKE_CURRENT_SOURCE_DIR}\") +file(GLOB_RECURSE ${VBASE}_SOURCES \${${VBASE}_SRC_DIR}/${CMATE_SOURCE_PAT}) +list(APPEND ${VBASE}_ALL_SOURCES \${${VBASE}_SOURCES}) + +target_sources( + ${TBASE} + PRIVATE + \${${VBASE}_ALL_SOURCES} +) + +target_include_directories( + ${TBASE} + PUBLIC + $ + $ + PRIVATE + \${CMAKE_CURRENT_SOURCE_DIR} +) +" + ) + + cmate_target_link_deps(${TBASE} ${DEPS_FILE} DEPS) + string(APPEND CONTENT ${DEPS}) + + string( + APPEND + CONTENT + " +set_target_properties( + ${TBASE} + PROPERTIES + VERSION ${CMATE_VERSION} + SOVERSION ${CMATE_VERSION_MAJOR}.${CMATE_VERSION_MINOR} + OUTPUT_NAME ${CMATE_NAMESPACE}_${NAME} +) +" + ) + + if(${CMATE_DUMP}) + message(${CONTENT}) + endif() + + file(WRITE ${CM_FILE} ${CONTENT}) +endfunction() + +############################################################################## +# +# Binary processing functions +# +############################################################################## +function(cmate_configure_prog TYPE NAME TBASE SRC_BASE) + string(TOUPPER ${TBASE} VBASE) + + if(${CMATE_DRY_RUN}) + cmate_msg("found ${TYPE} ${NAME} (${SRC_BASE}/${NAME})") + return() + endif() + + set(SDIR "${CMATE_ROOT_DIR}/${SRC_BASE}/${NAME}") + set(CM_FILE "${SDIR}/CMakeLists.txt") + set(DEPS_FILE "${SDIR}/link.txt") + file(GLOB_RECURSE SOURCES "${SDIR}/${CMATE_SOURCE_PAT}") + + string(APPEND CONTENT "add_${TYPE}(${TBASE})\n") + + string( + APPEND + CONTENT + " +set(${VBASE}_SRC_DIR \"\${CMAKE_CURRENT_SOURCE_DIR}\") +file(GLOB_RECURSE ${VBASE}_SOURCES \${${VBASE}_SRC_DIR}/${CMATE_SOURCE_PAT}) +list(APPEND ${VBASE}_ALL_SOURCES \${${VBASE}_SOURCES}) + +target_sources( + ${TBASE} + PRIVATE + \${${VBASE}_ALL_SOURCES} +) + +target_include_directories( + ${TBASE} + PRIVATE + \${CMAKE_CURRENT_SOURCE_DIR} +) +" + ) + + cmate_target_link_deps(${NAME} ${DEPS_FILE} DEPS) + string(APPEND CONTENT ${DEPS}) + + string( + APPEND + CONTENT + " +set_target_properties( + ${TBASE} + PROPERTIES + OUTPUT_NAME ${NAME} +) +" + ) + + if(${CMATE_DUMP}) + message(${CONTENT}) + endif() + + file(WRITE ${CM_FILE} ${CONTENT}) +endfunction() + +function(cmate_configure_bin NAME TBASE SRC_BASE) + cmate_configure_prog("executable" ${NAME} ${TBASE} ${SRC_BASE}) +endfunction() + +function(cmate_configure_test NAME TBASE SRC_BASE) + cmate_configure_prog("test" ${NAME} ${TBASE} ${SRC_BASE}) +endfunction() + +function(cmate_configure_project_packages VAR) + # CMake style packages + cmate_load_cmake_package_deps(${CMATE_PACKAGES} "PRJ") + set(CONTENT "") + + if(PRJ_CMAKE_PACKAGES) + string(APPEND CONTENT "\n") + endif() + + foreach(PKG ${PRJ_CMAKE_PACKAGES}) + if(PRJ_CMAKE_${PKG}_COMPS) + string( + APPEND + CONTENT + "find_package( + ${PKG} CONFIG REQUIRED + COMPONENTS +" + ) + + foreach(PC ${PRJ_CMAKE_${PKG}_COMPS}) + string(APPEND CONTENT " ${PC}\n") + endforeach() + + string(APPEND CONTENT ")\n") + else() + string(APPEND CONTENT "find_package(${PKG} CONFIG REQUIRED)\n") + endif() + endforeach() + + # PkgConfig style packages + cmate_load_pkgconfig_package_deps(${CMATE_PACKAGES} "PRJ") + + if(PRJ_PKGCONFIG_PACKAGES) + string(APPEND CONTENT "find_package(PkgConfig REQUIRED)\n") + endif() + + foreach(PKG ${PRJ_PKGCONFIG_PACKAGES}) + string( + APPEND + CONTENT + "pkg_check_modules(${PKG} REQUIRED IMPORTED_TARGET ${PKG})\n" + ) + endforeach() + + set(${VAR} ${CONTENT} PARENT_SCOPE) +endfunction() + +function(cmate_configure_project TARGETS SUBDIRS) + if(${CMATE_DRY_RUN}) + return() + endif() + + set(CM_FILE "${CMATE_ROOT_DIR}/CMakeLists.txt") + + string( + APPEND + CONTENT + "cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(${CMATE_PROJECT} VERSION 1.0.0 LANGUAGES C CXX) + +include(GNUInstallDirs) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +" + ) + + cmate_configure_project_packages(PKGS) + + if(PKGS) + string(APPEND CONTENT "${PKGS}") + endif() + + # Target subdirs + if(SUBDIRS) + string(APPEND CONTENT "\n") + + foreach(SUBDIR ${SUBDIRS}) + string(APPEND CONTENT "add_subdirectory(${SUBDIR})\n") + endforeach() + endif() + + string( + APPEND + CONTENT + " +install( + TARGETS" + ) + + foreach(TARGET ${TARGETS}) + string(APPEND CONTENT "\n ${TARGET}") + endforeach() + + string( + APPEND + CONTENT + " + EXPORT ${CMATE_PROJECT}-config + RUNTIME DESTINATION \${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION \${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION \${CMAKE_INSTALL_LIBDIR} +) + +install( + EXPORT ${CMATE_PROJECT}-config + FILE ${CMATE_PROJECT}-config.cmake + NAMESPACE ${CMATE_NAMESPACE}:: + DESTINATION \${CMAKE_INSTALL_LIBDIR}/cmake/${CMATE_PROJECT} +) +" + ) + + file(WRITE ${CM_FILE} ${CONTENT}) +endfunction() + +############################################################################## +# +# Target processing functions +# +############################################################################## +function(cmate_configure) + # Find libraries (libraries have headers) + file(GLOB LIB_INC_DIRS "${CMATE_ROOT_DIR}/include/*") + set(TARGETS "") + set(SUBDIRS "") + + foreach(LIB_INC_DIR ${LIB_INC_DIRS}) + string(REPLACE "${CMATE_ROOT_DIR}/include/" "" NAME ${LIB_INC_DIR}) + cmate_target_name(${NAME} "lib" "TNAME") + cmate_configure_lib(${NAME} ${TNAME} "include" "src/lib") + list(APPEND TARGETS ${TNAME}) + list(APPEND SUBDIRS "src/lib/${NAME}") + endforeach() + + # Binaries and tests + foreach(TYPE bin test) + file(GLOB SRC_DIRS "${CMATE_ROOT_DIR}/src/${TYPE}/*") + + foreach(SRC_DIR ${SRC_DIRS}) + string(REPLACE "${CMATE_ROOT_DIR}/src/${TYPE}/" "" NAME ${SRC_DIR}) + cmate_target_name(${NAME} ${TYPE} "TNAME") + cmake_language( + CALL "cmate_configure_${TYPE}" + ${NAME} ${TNAME} "src/${TYPE}" + ) + + if(NOT "${TYPE}" STREQUAL "test") + list(APPEND TARGETS ${TNAME}) + endif() + + list(APPEND SUBDIRS "src/${TYPE}/${NAME}") + endforeach() + endforeach() + + # Top-level project + cmate_configure_project("${TARGETS}" "${SUBDIRS}") + + cmate_state_file("configured" CONFIGURED) + + if(NOT EXISTS ${CONFIGURED}) + set(BUILD_DIR "${CMATE_ROOT_DIR}/build") + set(STAGE_DIR "${CMATE_ROOT_DIR}/stage") + file(MAKE_DIRECTORY ${BUILD_DIR}) + + set(ARGS "") + + if (EXISTS "${CMATE_CMADE_ENV}") + list(APPEND ARGS "-DCMAKE_PREFIX_PATH=${CMATE_CMADE_ENV}") + endif() + + list(APPEND ARGS "-DCMAKE_INSTALL_PREFIX=${STAGE_DIR}") + list(APPEND ARGS "-DCMAKE_BUILD_TYPE:STRING=Release") + # list(APPEND ARGS "-G" "Ninja") + list(APPEND ARGS "-S" "${CMATE_ROOT_DIR}") + list(APPEND ARGS "-B" "${BUILD_DIR}") + + execute_process( + COMMAND + ${CMAKE_COMMAND} + ${ARGS} + WORKING_DIRECTORY "${BUILD_DIR}" + RESULTS_VARIABLE RC + ) + + if(RC) + list(JOIN ARGS " " RUN_CMD) + cmate_die("command failed: ${RUN_CMD}") + endif() + + cmate_set_state("configured") + endif() +endfunction() + +function(cmate_build) + cmate_state_file("configured" CONFIGURED) + + if(NOT EXISTS ${CONFIGURED}) + cmate_die("please configure first") + endif() + + set(BUILD_DIR "${CMATE_ROOT_DIR}/build") + set(STAGE_DIR "${CMATE_ROOT_DIR}/stage") + set(ARGS "") + + list(APPEND ARGS "--build" "${BUILD_DIR}") + list(APPEND ARGS "--parallel") + + execute_process( + COMMAND + ${CMAKE_COMMAND} + ${ARGS} + RESULTS_VARIABLE RC + ) + + if(RC) + list(JOIN ARGS " " RUN_CMD) + cmate_die("command failed: ${RUN_CMD}") + endif() +endfunction() + +############################################################################## +# +# Configuration functions +# +############################################################################## +function(cmate_check_option OPT OPTS LABEL) + list(FIND OPTS ${OPT} IDX) + + if (IDX LESS 0) + cmate_die("unknown ${LABEL} option: ${OPT}") + endif() +endfunction() + +function(cmate_set_defaults) + get_filename_component(DIR "." ABSOLUTE) + cmate_setg(CMATE_ROOT_DIR ${DIR}) + cmake_path(GET DIR FILENAME PROJECT) + + get_filename_component(DIR ".cmate" ABSOLUTE) + cmate_setg(CMATE_STATE_DIR ${DIR}) + + cmate_setg(CMATE_PROJECT ${PROJECT}) + cmate_setg(CMATE_HEADER_PAT "*.hpp") + cmate_setg(CMATE_SOURCE_PAT "*.[ch]pp") + + cmate_setg(CMATE_CMADE_ENV "${CMATE_ROOT_DIR}/.cmade/env") +endfunction() + +############################################################################## +# +# Argument functions +# +############################################################################## +function(cmate_locate_cmate_arguments) + set(FOUND OFF) + + foreach(POS RANGE ${CMAKE_ARGC}) + string(TOLOWER "${CMAKE_ARGV${POS}}" ARG) + math(EXPR POS "${POS}+1") + + if (ARG MATCHES "${CMATE}$") + # Script args follow us, POS already incremented + set(FOUND ON) + cmate_setg(CMATE_POS ${POS}) + break() + endif() + endforeach() + + if(NOT FOUND) + # Should not happen if script has correct name (see CMATE at top) + cmate_die("parse_argument") + endif() +endfunction() + +function(cmate_parse_arguments) + cmate_locate_cmate_arguments() + set(OPTS_LABEL "generic") + set(OPTS ${CMATE_OPTIONS}) + + while(CMATE_POS LESS ${CMAKE_ARGC}) + if ("${CMAKE_ARGV${CMATE_POS}}" MATCHES "^--?([A-Za-z0-9_-]+)(=(.+))?$") + cmate_check_option(${CMAKE_MATCH_1} "${OPTS}" ${OPTS_LABEL}) + set(OPT "CMATE") + string(APPEND OPT "_${CMAKE_MATCH_1}") + string(REPLACE "-" "_" OPT "${OPT}") + string(TOUPPER ${OPT} OPT) + + if("${CMAKE_MATCH_3}" STREQUAL "") + cmate_setg(${OPT} 1) + else() + cmate_setg(${OPT} "${CMAKE_MATCH_3}") + endif() + elseif("${CMATE_CMD}" STREQUAL "") + set(CMATE_CMD "${CMAKE_ARGV${CMATE_POS}}") + set(OPTS_LABEL ${CMATE_CMD}) + set(OPTS_VAR CMATE_${CMATE_CMD}_OPTIONS) + string(TOUPPER "${OPTS_VAR}" OPTS_VAR) + set(OPTS ${${OPTS_VAR}}) + else() + list(APPEND CMATE_ARGS "${CMAKE_ARGV${CMATE_POS}}") + endif() + + math(EXPR CMATE_POS "${CMATE_POS}+1") + endwhile() + + list(LENGTH CMATE_ARGS CMATE_ARGC) + + cmate_setg(CMATE_CMD "${CMATE_CMD}") + cmate_setg(CMATE_ARGS "${CMATE_ARGS}") + cmate_setg(CMATE_ARGC ${CMATE_ARGC}) + get_filename_component(CMATE_ENV "${CMATE_ENV}" REALPATH) + cmate_setg(CMATE_ENV ${CMATE_ENV}) +endfunction() + +############################################################################## +# +# Command processing +# +############################################################################## +function(cmate_process_cmd) + if (CMATE_CMD STREQUAL "version") + message(${CMATE_VERSION}) + elseif (CMATE_CMD STREQUAL "configure") + cmate_set_version() + cmate_configure() + elseif (CMATE_CMD STREQUAL "build") + cmate_build() + elseif (CMATE_CMD STREQUAL "help") + cmate_show_help() + elseif(CMATE_CMD) + cmate_msg("unknown command: ${CMATE_CMD}") + elseif(NOT CMATE_CMD) + cmate_msg("no command") + endif() +endfunction() + +############################################################################## +# +# Main part +# +############################################################################## +if(CMAKE_SCRIPT_MODE_FILE AND NOT CMAKE_PARENT_LIST_FILE) + cmate_set_defaults() + cmate_parse_arguments() + cmate_load_conf("${CMATE_ROOT_DIR}/${CMATE_CONF}") + cmate_process_cmd() +endif() diff --git a/cpp/cmate.json b/cpp/cmate.json new file mode 100644 index 00000000..fedef7b1 --- /dev/null +++ b/cpp/cmate.json @@ -0,0 +1,10 @@ +{ + "name": "cucumber_messages", + "version": "0.1.0", + "namespace": "cucumber", + "packages": { + "cmake": [ + "nlohmann_json", + ] + } +} diff --git a/cpp/deps.txt b/cpp/deps.txt index 81debec6..98640189 100644 --- a/cpp/deps.txt +++ b/cpp/deps.txt @@ -1 +1 @@ -https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.zip -DJSON_BuildTests=OFF +nlohmann/json@v3.11.3 -DJSON_BuildTests=OFF diff --git a/cpp/include/cucumber/messages/all.hpp b/cpp/include/messages/cucumber/messages/all.hpp similarity index 100% rename from cpp/include/cucumber/messages/all.hpp rename to cpp/include/messages/cucumber/messages/all.hpp diff --git a/cpp/include/cucumber/messages/attachment.hpp b/cpp/include/messages/cucumber/messages/attachment.hpp similarity index 100% rename from cpp/include/cucumber/messages/attachment.hpp rename to cpp/include/messages/cucumber/messages/attachment.hpp diff --git a/cpp/include/cucumber/messages/attachment_content_encoding.hpp b/cpp/include/messages/cucumber/messages/attachment_content_encoding.hpp similarity index 100% rename from cpp/include/cucumber/messages/attachment_content_encoding.hpp rename to cpp/include/messages/cucumber/messages/attachment_content_encoding.hpp diff --git a/cpp/include/cucumber/messages/background.hpp b/cpp/include/messages/cucumber/messages/background.hpp similarity index 100% rename from cpp/include/cucumber/messages/background.hpp rename to cpp/include/messages/cucumber/messages/background.hpp diff --git a/cpp/include/cucumber/messages/ci.hpp b/cpp/include/messages/cucumber/messages/ci.hpp similarity index 100% rename from cpp/include/cucumber/messages/ci.hpp rename to cpp/include/messages/cucumber/messages/ci.hpp diff --git a/cpp/include/cucumber/messages/comment.hpp b/cpp/include/messages/cucumber/messages/comment.hpp similarity index 100% rename from cpp/include/cucumber/messages/comment.hpp rename to cpp/include/messages/cucumber/messages/comment.hpp diff --git a/cpp/include/cucumber/messages/data_table.hpp b/cpp/include/messages/cucumber/messages/data_table.hpp similarity index 100% rename from cpp/include/cucumber/messages/data_table.hpp rename to cpp/include/messages/cucumber/messages/data_table.hpp diff --git a/cpp/include/cucumber/messages/doc_string.hpp b/cpp/include/messages/cucumber/messages/doc_string.hpp similarity index 100% rename from cpp/include/cucumber/messages/doc_string.hpp rename to cpp/include/messages/cucumber/messages/doc_string.hpp diff --git a/cpp/include/cucumber/messages/duration.hpp b/cpp/include/messages/cucumber/messages/duration.hpp similarity index 100% rename from cpp/include/cucumber/messages/duration.hpp rename to cpp/include/messages/cucumber/messages/duration.hpp diff --git a/cpp/include/cucumber/messages/envelope.hpp b/cpp/include/messages/cucumber/messages/envelope.hpp similarity index 100% rename from cpp/include/cucumber/messages/envelope.hpp rename to cpp/include/messages/cucumber/messages/envelope.hpp diff --git a/cpp/include/cucumber/messages/examples.hpp b/cpp/include/messages/cucumber/messages/examples.hpp similarity index 100% rename from cpp/include/cucumber/messages/examples.hpp rename to cpp/include/messages/cucumber/messages/examples.hpp diff --git a/cpp/include/cucumber/messages/exception.hpp b/cpp/include/messages/cucumber/messages/exception.hpp similarity index 94% rename from cpp/include/cucumber/messages/exception.hpp rename to cpp/include/messages/cucumber/messages/exception.hpp index c231ca4e..be55c71e 100644 --- a/cpp/include/cucumber/messages/exception.hpp +++ b/cpp/include/messages/cucumber/messages/exception.hpp @@ -22,6 +22,7 @@ struct exception { std::string type; std::optional message; + std::optional stack_trace; std::string to_string() const; diff --git a/cpp/include/cucumber/messages/feature.hpp b/cpp/include/messages/cucumber/messages/feature.hpp similarity index 100% rename from cpp/include/cucumber/messages/feature.hpp rename to cpp/include/messages/cucumber/messages/feature.hpp diff --git a/cpp/include/cucumber/messages/feature_child.hpp b/cpp/include/messages/cucumber/messages/feature_child.hpp similarity index 100% rename from cpp/include/cucumber/messages/feature_child.hpp rename to cpp/include/messages/cucumber/messages/feature_child.hpp diff --git a/cpp/include/cucumber/messages/gherkin_document.hpp b/cpp/include/messages/cucumber/messages/gherkin_document.hpp similarity index 100% rename from cpp/include/cucumber/messages/gherkin_document.hpp rename to cpp/include/messages/cucumber/messages/gherkin_document.hpp diff --git a/cpp/include/cucumber/messages/git.hpp b/cpp/include/messages/cucumber/messages/git.hpp similarity index 100% rename from cpp/include/cucumber/messages/git.hpp rename to cpp/include/messages/cucumber/messages/git.hpp diff --git a/cpp/include/cucumber/messages/group.hpp b/cpp/include/messages/cucumber/messages/group.hpp similarity index 100% rename from cpp/include/cucumber/messages/group.hpp rename to cpp/include/messages/cucumber/messages/group.hpp diff --git a/cpp/include/cucumber/messages/hook.hpp b/cpp/include/messages/cucumber/messages/hook.hpp similarity index 100% rename from cpp/include/cucumber/messages/hook.hpp rename to cpp/include/messages/cucumber/messages/hook.hpp diff --git a/cpp/include/cucumber/messages/java_method.hpp b/cpp/include/messages/cucumber/messages/java_method.hpp similarity index 100% rename from cpp/include/cucumber/messages/java_method.hpp rename to cpp/include/messages/cucumber/messages/java_method.hpp diff --git a/cpp/include/cucumber/messages/java_stack_trace_element.hpp b/cpp/include/messages/cucumber/messages/java_stack_trace_element.hpp similarity index 100% rename from cpp/include/cucumber/messages/java_stack_trace_element.hpp rename to cpp/include/messages/cucumber/messages/java_stack_trace_element.hpp diff --git a/cpp/include/cucumber/messages/location.hpp b/cpp/include/messages/cucumber/messages/location.hpp similarity index 100% rename from cpp/include/cucumber/messages/location.hpp rename to cpp/include/messages/cucumber/messages/location.hpp diff --git a/cpp/include/cucumber/messages/meta.hpp b/cpp/include/messages/cucumber/messages/meta.hpp similarity index 100% rename from cpp/include/cucumber/messages/meta.hpp rename to cpp/include/messages/cucumber/messages/meta.hpp diff --git a/cpp/include/cucumber/messages/parameter_type.hpp b/cpp/include/messages/cucumber/messages/parameter_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/parameter_type.hpp rename to cpp/include/messages/cucumber/messages/parameter_type.hpp diff --git a/cpp/include/cucumber/messages/parse_error.hpp b/cpp/include/messages/cucumber/messages/parse_error.hpp similarity index 100% rename from cpp/include/cucumber/messages/parse_error.hpp rename to cpp/include/messages/cucumber/messages/parse_error.hpp diff --git a/cpp/include/cucumber/messages/pickle.hpp b/cpp/include/messages/cucumber/messages/pickle.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle.hpp rename to cpp/include/messages/cucumber/messages/pickle.hpp diff --git a/cpp/include/cucumber/messages/pickle_doc_string.hpp b/cpp/include/messages/cucumber/messages/pickle_doc_string.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_doc_string.hpp rename to cpp/include/messages/cucumber/messages/pickle_doc_string.hpp diff --git a/cpp/include/cucumber/messages/pickle_step.hpp b/cpp/include/messages/cucumber/messages/pickle_step.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_step.hpp rename to cpp/include/messages/cucumber/messages/pickle_step.hpp diff --git a/cpp/include/cucumber/messages/pickle_step_argument.hpp b/cpp/include/messages/cucumber/messages/pickle_step_argument.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_step_argument.hpp rename to cpp/include/messages/cucumber/messages/pickle_step_argument.hpp diff --git a/cpp/include/cucumber/messages/pickle_step_type.hpp b/cpp/include/messages/cucumber/messages/pickle_step_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_step_type.hpp rename to cpp/include/messages/cucumber/messages/pickle_step_type.hpp diff --git a/cpp/include/cucumber/messages/pickle_table.hpp b/cpp/include/messages/cucumber/messages/pickle_table.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_table.hpp rename to cpp/include/messages/cucumber/messages/pickle_table.hpp diff --git a/cpp/include/cucumber/messages/pickle_table_cell.hpp b/cpp/include/messages/cucumber/messages/pickle_table_cell.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_table_cell.hpp rename to cpp/include/messages/cucumber/messages/pickle_table_cell.hpp diff --git a/cpp/include/cucumber/messages/pickle_table_row.hpp b/cpp/include/messages/cucumber/messages/pickle_table_row.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_table_row.hpp rename to cpp/include/messages/cucumber/messages/pickle_table_row.hpp diff --git a/cpp/include/cucumber/messages/pickle_tag.hpp b/cpp/include/messages/cucumber/messages/pickle_tag.hpp similarity index 100% rename from cpp/include/cucumber/messages/pickle_tag.hpp rename to cpp/include/messages/cucumber/messages/pickle_tag.hpp diff --git a/cpp/include/cucumber/messages/product.hpp b/cpp/include/messages/cucumber/messages/product.hpp similarity index 100% rename from cpp/include/cucumber/messages/product.hpp rename to cpp/include/messages/cucumber/messages/product.hpp diff --git a/cpp/include/cucumber/messages/rule.hpp b/cpp/include/messages/cucumber/messages/rule.hpp similarity index 100% rename from cpp/include/cucumber/messages/rule.hpp rename to cpp/include/messages/cucumber/messages/rule.hpp diff --git a/cpp/include/cucumber/messages/rule_child.hpp b/cpp/include/messages/cucumber/messages/rule_child.hpp similarity index 100% rename from cpp/include/cucumber/messages/rule_child.hpp rename to cpp/include/messages/cucumber/messages/rule_child.hpp diff --git a/cpp/include/cucumber/messages/scenario.hpp b/cpp/include/messages/cucumber/messages/scenario.hpp similarity index 100% rename from cpp/include/cucumber/messages/scenario.hpp rename to cpp/include/messages/cucumber/messages/scenario.hpp diff --git a/cpp/include/cucumber/messages/source.hpp b/cpp/include/messages/cucumber/messages/source.hpp similarity index 100% rename from cpp/include/cucumber/messages/source.hpp rename to cpp/include/messages/cucumber/messages/source.hpp diff --git a/cpp/include/cucumber/messages/source_media_type.hpp b/cpp/include/messages/cucumber/messages/source_media_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/source_media_type.hpp rename to cpp/include/messages/cucumber/messages/source_media_type.hpp diff --git a/cpp/include/cucumber/messages/source_reference.hpp b/cpp/include/messages/cucumber/messages/source_reference.hpp similarity index 100% rename from cpp/include/cucumber/messages/source_reference.hpp rename to cpp/include/messages/cucumber/messages/source_reference.hpp diff --git a/cpp/include/cucumber/messages/step.hpp b/cpp/include/messages/cucumber/messages/step.hpp similarity index 100% rename from cpp/include/cucumber/messages/step.hpp rename to cpp/include/messages/cucumber/messages/step.hpp diff --git a/cpp/include/cucumber/messages/step_definition.hpp b/cpp/include/messages/cucumber/messages/step_definition.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_definition.hpp rename to cpp/include/messages/cucumber/messages/step_definition.hpp diff --git a/cpp/include/cucumber/messages/step_definition_pattern.hpp b/cpp/include/messages/cucumber/messages/step_definition_pattern.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_definition_pattern.hpp rename to cpp/include/messages/cucumber/messages/step_definition_pattern.hpp diff --git a/cpp/include/cucumber/messages/step_definition_pattern_type.hpp b/cpp/include/messages/cucumber/messages/step_definition_pattern_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_definition_pattern_type.hpp rename to cpp/include/messages/cucumber/messages/step_definition_pattern_type.hpp diff --git a/cpp/include/cucumber/messages/step_keyword_type.hpp b/cpp/include/messages/cucumber/messages/step_keyword_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_keyword_type.hpp rename to cpp/include/messages/cucumber/messages/step_keyword_type.hpp diff --git a/cpp/include/cucumber/messages/step_match_argument.hpp b/cpp/include/messages/cucumber/messages/step_match_argument.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_match_argument.hpp rename to cpp/include/messages/cucumber/messages/step_match_argument.hpp diff --git a/cpp/include/cucumber/messages/step_match_arguments_list.hpp b/cpp/include/messages/cucumber/messages/step_match_arguments_list.hpp similarity index 100% rename from cpp/include/cucumber/messages/step_match_arguments_list.hpp rename to cpp/include/messages/cucumber/messages/step_match_arguments_list.hpp diff --git a/cpp/include/cucumber/messages/table_cell.hpp b/cpp/include/messages/cucumber/messages/table_cell.hpp similarity index 100% rename from cpp/include/cucumber/messages/table_cell.hpp rename to cpp/include/messages/cucumber/messages/table_cell.hpp diff --git a/cpp/include/cucumber/messages/table_row.hpp b/cpp/include/messages/cucumber/messages/table_row.hpp similarity index 100% rename from cpp/include/cucumber/messages/table_row.hpp rename to cpp/include/messages/cucumber/messages/table_row.hpp diff --git a/cpp/include/cucumber/messages/tag.hpp b/cpp/include/messages/cucumber/messages/tag.hpp similarity index 100% rename from cpp/include/cucumber/messages/tag.hpp rename to cpp/include/messages/cucumber/messages/tag.hpp diff --git a/cpp/include/cucumber/messages/test_case.hpp b/cpp/include/messages/cucumber/messages/test_case.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_case.hpp rename to cpp/include/messages/cucumber/messages/test_case.hpp diff --git a/cpp/include/cucumber/messages/test_case_finished.hpp b/cpp/include/messages/cucumber/messages/test_case_finished.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_case_finished.hpp rename to cpp/include/messages/cucumber/messages/test_case_finished.hpp diff --git a/cpp/include/cucumber/messages/test_case_started.hpp b/cpp/include/messages/cucumber/messages/test_case_started.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_case_started.hpp rename to cpp/include/messages/cucumber/messages/test_case_started.hpp diff --git a/cpp/include/cucumber/messages/test_run_finished.hpp b/cpp/include/messages/cucumber/messages/test_run_finished.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_run_finished.hpp rename to cpp/include/messages/cucumber/messages/test_run_finished.hpp diff --git a/cpp/include/cucumber/messages/test_run_started.hpp b/cpp/include/messages/cucumber/messages/test_run_started.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_run_started.hpp rename to cpp/include/messages/cucumber/messages/test_run_started.hpp diff --git a/cpp/include/cucumber/messages/test_step.hpp b/cpp/include/messages/cucumber/messages/test_step.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_step.hpp rename to cpp/include/messages/cucumber/messages/test_step.hpp diff --git a/cpp/include/cucumber/messages/test_step_finished.hpp b/cpp/include/messages/cucumber/messages/test_step_finished.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_step_finished.hpp rename to cpp/include/messages/cucumber/messages/test_step_finished.hpp diff --git a/cpp/include/cucumber/messages/test_step_result.hpp b/cpp/include/messages/cucumber/messages/test_step_result.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_step_result.hpp rename to cpp/include/messages/cucumber/messages/test_step_result.hpp diff --git a/cpp/include/cucumber/messages/test_step_result_status.hpp b/cpp/include/messages/cucumber/messages/test_step_result_status.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_step_result_status.hpp rename to cpp/include/messages/cucumber/messages/test_step_result_status.hpp diff --git a/cpp/include/cucumber/messages/test_step_started.hpp b/cpp/include/messages/cucumber/messages/test_step_started.hpp similarity index 100% rename from cpp/include/cucumber/messages/test_step_started.hpp rename to cpp/include/messages/cucumber/messages/test_step_started.hpp diff --git a/cpp/include/cucumber/messages/timestamp.hpp b/cpp/include/messages/cucumber/messages/timestamp.hpp similarity index 100% rename from cpp/include/cucumber/messages/timestamp.hpp rename to cpp/include/messages/cucumber/messages/timestamp.hpp diff --git a/cpp/include/cucumber/messages/undefined_parameter_type.hpp b/cpp/include/messages/cucumber/messages/undefined_parameter_type.hpp similarity index 100% rename from cpp/include/cucumber/messages/undefined_parameter_type.hpp rename to cpp/include/messages/cucumber/messages/undefined_parameter_type.hpp diff --git a/cpp/scripts/build-ext b/cpp/scripts/build-ext deleted file mode 100755 index b3595953..00000000 --- a/cpp/scripts/build-ext +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -set -e - -ME=$(basename $0) -MYDIR=$(cd $(dirname $0)/.. && pwd) - -############################################################################### -# -# Minimal checks -# -############################################################################### -[ -z "$1" ] && echo "$ME: missing directory" && exit 1 -[ ! -d "$1" ] && echo "$ME: invalid directory: $1" && exit 1 - -SRCDIR="$1" -shift - -while ((${#1})); do - case "$1" in - --src-dir=*) - SUBDIR="${1##--src-dir=}" - SRCDIR="$SRCDIR/$SUBDIR" - shift - ;; - *) - break - ;; - esac -done - -############################################################################### -# -# Compiler setup -# -############################################################################### -BUILDROOT=$MYDIR/build/root -CC= -CFLAGS= -CXX= -CXXFLAGS=$CFLAGS -CPATH=$BUILDROOT/include -LIBRARY_PATH=$BUILDROOT/lib -LD_LIBRARY_PATH=$BUILDROOT/lib -PKG_CONFIG_PATH=$LIBRARY_PATH/pkgconfig - -#CCACHE=$(which ccache || true) - -# if [ -n "$CCACHE" ]; then -# CC="$CCACHE $CC" -# CXX="$CCACHE $CXX" -# fi - -export CC CFLAGS CXX CXXFLAGS CPATH LIBRARY_PATH LD_LIBRARY_PATH - -############################################################################### -# -# Parallel compilation setup -# -############################################################################### -MAKEARGS= -CMAKEARGS= - -if [ -n "$NPROCS" ]; then - CMAKEARGS="--parallel $NPROCS" - MAKEARGS="-j$NPROCS" -else - CMAKEARGS="--parallel" -fi - -############################################################################### -# -# Project build -# -############################################################################### -PROJECT=$(basename $SRCDIR) -BUILDDIR=$MYDIR/build/$PROJECT - -mkdir -p $LIBRARY_PATH -rm -rf $BUILDDIR && mkdir -p $BUILDDIR - -if [ -f $SRCDIR/CMakeLists.txt ]; then - cmake \ - -DCMAKE_PREFIX_PATH=$BUILDROOT \ - -DCMAKE_INSTALL_PREFIX=$BUILDROOT \ - -DCMAKE_TOOLCHAIN_FILE=$MYDIR/cmake/toolchains/ext.cmake \ - -S $SRCDIR -B $BUILDDIR \ - "$@" - cmake --build $BUILDDIR $CMAKEARGS - cmake --install $BUILDDIR -elif [ -f $SRCDIR/meson.build ]; then - cd $BUILDDIR - meson \ - --prefix=$BUILDROOT \ - --pkg-config-path=$BUILDROOT \ - --cmake-prefix-path=$BUILDROOT \ - "$@" \ - . $SRCDIR - meson install -elif [ -x $SRCDIR/configure ]; then - cd $BUILDDIR - $SRCDIR/configure \ - --prefix=$BUILDROOT \ - --enable-shared \ - "$@" - make $MAKEARGS - make install -elif [ -x $SRCDIR/config ]; then - cd $BUILDDIR - $SRCDIR/config --prefix=$BUILDROOT "$@" - make $MAKEARGS - make install -elif [ -f $SRCDIR/Makefile ]; then - cd $SRCDIR - make $MAKEARGS - make prefix=$BUILDROOT install -else - echo "$ME: don't know how to build $SRCDIR" - exit 1 -fi - -rm -rf $BUILDDIR diff --git a/cpp/scripts/build-externals b/cpp/scripts/build-externals deleted file mode 100755 index 42ef6a78..00000000 --- a/cpp/scripts/build-externals +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env bash - -############################################################################### -# -# Barebones dependency installer -# -############################################################################### -set -e -trap "exit 1" TERM - -ME=$(basename $0) -MYDIR=$(cd $(dirname $0)/.. && pwd) -MYPID=$$ - -BUILDER=$MYDIR/scripts/build-ext - -EXTDIR=$MYDIR/ext -DLFILE=$EXTDIR/.downloaded -INSTFILE=$EXTDIR/.installed -TMPDIR=$EXTDIR/tmp -ARCDIR=$EXTDIR/archives - -function error() { - echo "$@" >&2 - kill -TERM $MYPID - exit 1 -} - -function clean_tmp() { - rm -rf $TMPDIR && mkdir -p $TMPDIR -} - -function get_unique() { - local WHERE=$1 - local TYPE=$2 - - local COUNT=$(find $WHERE -mindepth 1 -maxdepth 1 -type $TYPE | wc -l) - - [ "$COUNT" -ne "1" ] && error "no unique entry of type $TYPE in $WHERE" - - local ENTRY=$(find $WHERE -mindepth 1 -maxdepth 1 -type $TYPE) - - echo $ENTRY -} - -function get_md5() { - local WHAT=$1 - local MD5 - - case $(uname -s) in - Darwin) - MD5=$(md5 -qs "$WHAT") - ;; - *) - MD5=$(echo -n "$WHAT" | md5sum | cut -d ' ' -f 1) - ;; - esac - - echo $MD5 -} - -function download() { - local PKG=$1 - - local MD5=$(get_md5 "$PKG") - local ARCHIVE=$(grep $MD5 $DLFILE | cut -d ' ' -f 2) - - if [ -z "$ARCHIVE" ]; then - clean_tmp - - (cd $TMPDIR && curl -LJO $PKG) - - mkdir -p $ARCDIR - - ARCHIVE=$(get_unique $TMPDIR f) - - mv $ARCHIVE $ARCDIR - - ARCHIVE=$(basename $ARCHIVE) - echo "$MD5 $ARCHIVE" >> $DLFILE - fi - - echo $ARCHIVE -} - -function extract() { - local ARCHIVE=$1 - - local ARCFILE=$ARCDIR/$ARCHIVE - local TAROPTS - - case $(uname -s) in - Darwin) - TAROPTS=xf - ;; - *) - TAROPTS=xaf - ;; - esac - - clean_tmp - - if [[ "$ARCFILE" =~ \.zip$ ]]; then - (cd $TMPDIR && unzip -q $ARCFILE) - elif [[ "$ARCFILE" =~ \.tar\.(gz|bz2|xz)$ ]]; then - (cd $TMPDIR && tar $TAROPTS $ARCFILE) - else - error "unhandled archive format $ARCHIVE" - fi - - DIR=$(get_unique $TMPDIR d) - - echo $DIR -} - -function build() { - local URL=$1 - shift - - local ARCHIVE=$(download $URL) - local INSTALLED=$(grep $ARCHIVE $INSTFILE) - - if [ -z "$INSTALLED" ]; then - local DEPDIR=$(extract $ARCHIVE) - - echo "building from $URL" - - $BUILDER $DEPDIR "$@" - - echo $ARCHIVE >> $INSTFILE - else - echo "skipping already installed $ARCHIVE from $URL" - fi -} - -function build_list() { - local EXTFILE=$1 - local -a SPEC=() - - while read LINE; do - [[ "$LINE" =~ ^([[:space:]]*(#.*)?)?$ ]] && continue - - build $LINE - done < $EXTFILE -} - -mkdir -p $EXTDIR -touch $DLFILE $INSTFILE - -[ -z "$1" ] && echo "usage: $ME FILE|URL" && exit 1 - -WHAT=$1 -shift - -if [ -f $WHAT ]; then - # Assume a dependency list file - if [ -n "$1" ]; then - # Short keyword to easily select something in the list file - LINE=$(grep "$1" $WHAT) - - if [ -n "$LINE" ]; then - build $LINE - fi - else - build_list $WHAT - fi -else - # Assume a URL - build $WHAT "$@" -fi - -exit 0 diff --git a/cpp/src/lib/cucumber-messages/CMakeLists.txt b/cpp/src/lib/cucumber-messages/CMakeLists.txt deleted file mode 100644 index 70193a89..00000000 --- a/cpp/src/lib/cucumber-messages/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -add_library(cucumber-messages) -add_library(cucumber::messages ALIAS cucumber-messages) - -set(INC_DIR "${CMAKE_SOURCE_DIR}/include") - -# We prefer it that way... -file(GLOB_RECURSE CUCUMBER_MESSAGES_HEADERS ${INC_DIR}/*.[ch]pp) -file(GLOB_RECURSE CUCUMBER_MESSAGES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.[ch]pp) - -target_sources( - cucumber-messages - PRIVATE - ${CUCUMBER_MESSAGES_HEADERS} - ${CUCUMBER_MESSAGES_SOURCES} -) - -target_include_directories( - cucumber-messages - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_link_libraries( - cucumber-messages - PUBLIC - nlohmann_json::nlohmann_json -) - -set_target_properties( - cucumber-messages - PROPERTIES - OUTPUT_NAME cucumber_messages -) diff --git a/cpp/src/lib/messages/CMakeLists.txt b/cpp/src/lib/messages/CMakeLists.txt new file mode 100644 index 00000000..b8fb61ba --- /dev/null +++ b/cpp/src/lib/messages/CMakeLists.txt @@ -0,0 +1,39 @@ +add_library(cucumber_messages_lib) +add_library(cucumber::messages ALIAS cucumber_messages_lib) + +set(CUCUMBER_MESSAGES_LIB_INC_DIR "${PROJECT_SOURCE_DIR}/include/messages") +file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_HEADERS ${CUCUMBER_MESSAGES_LIB_INC_DIR}/*.hpp) +list(APPEND CUCUMBER_MESSAGES_LIB_ALL_SOURCES ${CUCUMBER_MESSAGES_LIB_HEADERS}) + +set(CUCUMBER_MESSAGES_LIB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_SOURCES ${CUCUMBER_MESSAGES_LIB_SRC_DIR}/*.[ch]pp) +list(APPEND CUCUMBER_MESSAGES_LIB_ALL_SOURCES ${CUCUMBER_MESSAGES_LIB_SOURCES}) + +target_sources( + cucumber_messages_lib + PRIVATE + ${CUCUMBER_MESSAGES_LIB_ALL_SOURCES} +) + +target_include_directories( + cucumber_messages_lib + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_link_libraries( + cucumber_messages_lib + PUBLIC + nlohmann_json::nlohmann_json +) + +set_target_properties( + cucumber_messages_lib + PROPERTIES + VERSION 0.1.0 + SOVERSION 0.1 + OUTPUT_NAME cucumber_messages +) diff --git a/cpp/src/lib/messages/cmate.json b/cpp/src/lib/messages/cmate.json new file mode 100644 index 00000000..e0048127 --- /dev/null +++ b/cpp/src/lib/messages/cmate.json @@ -0,0 +1,7 @@ +{ + "libs": { + "public": [ + "nlohmann_json::nlohmann_json" + ] + } +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp b/cpp/src/lib/messages/cucumber/messages/attachment.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp rename to cpp/src/lib/messages/cucumber/messages/attachment.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp b/cpp/src/lib/messages/cucumber/messages/attachment_content_encoding.cpp similarity index 96% rename from cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp rename to cpp/src/lib/messages/cucumber/messages/attachment_content_encoding.cpp index 22cde9f8..34d159d3 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp +++ b/cpp/src/lib/messages/cucumber/messages/attachment_content_encoding.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp b/cpp/src/lib/messages/cucumber/messages/background.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp rename to cpp/src/lib/messages/cucumber/messages/background.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp b/cpp/src/lib/messages/cucumber/messages/ci.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp rename to cpp/src/lib/messages/cucumber/messages/ci.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp b/cpp/src/lib/messages/cucumber/messages/comment.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp rename to cpp/src/lib/messages/cucumber/messages/comment.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp b/cpp/src/lib/messages/cucumber/messages/data_table.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp rename to cpp/src/lib/messages/cucumber/messages/data_table.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp b/cpp/src/lib/messages/cucumber/messages/doc_string.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp rename to cpp/src/lib/messages/cucumber/messages/doc_string.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp b/cpp/src/lib/messages/cucumber/messages/duration.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp rename to cpp/src/lib/messages/cucumber/messages/duration.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp b/cpp/src/lib/messages/cucumber/messages/envelope.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp rename to cpp/src/lib/messages/cucumber/messages/envelope.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp b/cpp/src/lib/messages/cucumber/messages/examples.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp rename to cpp/src/lib/messages/cucumber/messages/examples.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp b/cpp/src/lib/messages/cucumber/messages/exception.cpp similarity index 85% rename from cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp rename to cpp/src/lib/messages/cucumber/messages/exception.cpp index c7a6a29c..e6ea57a7 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp +++ b/cpp/src/lib/messages/cucumber/messages/exception.cpp @@ -12,6 +12,7 @@ exception::to_string() const cucumber::messages::to_string(oss, "type=", type); cucumber::messages::to_string(oss, ", message=", message); + cucumber::messages::to_string(oss, ", stack_trace=", stack_trace); return oss.str(); } @@ -21,6 +22,7 @@ exception::to_json(json& j) const { cucumber::messages::to_json(j, camelize("type"), type); cucumber::messages::to_json(j, camelize("message"), message); + cucumber::messages::to_json(j, camelize("stack_trace"), stack_trace); } std::string diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp b/cpp/src/lib/messages/cucumber/messages/feature.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp rename to cpp/src/lib/messages/cucumber/messages/feature.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp b/cpp/src/lib/messages/cucumber/messages/feature_child.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp rename to cpp/src/lib/messages/cucumber/messages/feature_child.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp b/cpp/src/lib/messages/cucumber/messages/gherkin_document.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp rename to cpp/src/lib/messages/cucumber/messages/gherkin_document.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp b/cpp/src/lib/messages/cucumber/messages/git.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp rename to cpp/src/lib/messages/cucumber/messages/git.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp b/cpp/src/lib/messages/cucumber/messages/group.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp rename to cpp/src/lib/messages/cucumber/messages/group.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp b/cpp/src/lib/messages/cucumber/messages/hook.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp rename to cpp/src/lib/messages/cucumber/messages/hook.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp b/cpp/src/lib/messages/cucumber/messages/java_method.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp rename to cpp/src/lib/messages/cucumber/messages/java_method.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp b/cpp/src/lib/messages/cucumber/messages/java_stack_trace_element.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp rename to cpp/src/lib/messages/cucumber/messages/java_stack_trace_element.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp b/cpp/src/lib/messages/cucumber/messages/location.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp rename to cpp/src/lib/messages/cucumber/messages/location.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp b/cpp/src/lib/messages/cucumber/messages/meta.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp rename to cpp/src/lib/messages/cucumber/messages/meta.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp b/cpp/src/lib/messages/cucumber/messages/parameter_type.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp rename to cpp/src/lib/messages/cucumber/messages/parameter_type.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp b/cpp/src/lib/messages/cucumber/messages/parse_error.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp rename to cpp/src/lib/messages/cucumber/messages/parse_error.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp b/cpp/src/lib/messages/cucumber/messages/pickle.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_doc_string.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_doc_string.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_step.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_step.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_step_argument.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_step_argument.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_step_type.cpp similarity index 96% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_step_type.cpp index 897da3c4..969a7bd5 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp +++ b/cpp/src/lib/messages/cucumber/messages/pickle_step_type.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_table.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_table.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_table_cell.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_table_cell.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_table_row.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_table_row.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp b/cpp/src/lib/messages/cucumber/messages/pickle_tag.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp rename to cpp/src/lib/messages/cucumber/messages/pickle_tag.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp b/cpp/src/lib/messages/cucumber/messages/product.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp rename to cpp/src/lib/messages/cucumber/messages/product.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp b/cpp/src/lib/messages/cucumber/messages/rule.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp rename to cpp/src/lib/messages/cucumber/messages/rule.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp b/cpp/src/lib/messages/cucumber/messages/rule_child.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp rename to cpp/src/lib/messages/cucumber/messages/rule_child.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp b/cpp/src/lib/messages/cucumber/messages/scenario.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp rename to cpp/src/lib/messages/cucumber/messages/scenario.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp b/cpp/src/lib/messages/cucumber/messages/source.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp rename to cpp/src/lib/messages/cucumber/messages/source.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp b/cpp/src/lib/messages/cucumber/messages/source_media_type.cpp similarity index 96% rename from cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp rename to cpp/src/lib/messages/cucumber/messages/source_media_type.cpp index 550ba295..6c44e8ac 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp +++ b/cpp/src/lib/messages/cucumber/messages/source_media_type.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp b/cpp/src/lib/messages/cucumber/messages/source_reference.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp rename to cpp/src/lib/messages/cucumber/messages/source_reference.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp b/cpp/src/lib/messages/cucumber/messages/step.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp rename to cpp/src/lib/messages/cucumber/messages/step.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp b/cpp/src/lib/messages/cucumber/messages/step_definition.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp rename to cpp/src/lib/messages/cucumber/messages/step_definition.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp b/cpp/src/lib/messages/cucumber/messages/step_definition_pattern.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp rename to cpp/src/lib/messages/cucumber/messages/step_definition_pattern.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp b/cpp/src/lib/messages/cucumber/messages/step_definition_pattern_type.cpp similarity index 96% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp rename to cpp/src/lib/messages/cucumber/messages/step_definition_pattern_type.cpp index 101afeb7..d138abb1 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp +++ b/cpp/src/lib/messages/cucumber/messages/step_definition_pattern_type.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp b/cpp/src/lib/messages/cucumber/messages/step_keyword_type.cpp similarity index 97% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp rename to cpp/src/lib/messages/cucumber/messages/step_keyword_type.cpp index ff13059c..22b066ae 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp +++ b/cpp/src/lib/messages/cucumber/messages/step_keyword_type.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp b/cpp/src/lib/messages/cucumber/messages/step_match_argument.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp rename to cpp/src/lib/messages/cucumber/messages/step_match_argument.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp b/cpp/src/lib/messages/cucumber/messages/step_match_arguments_list.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp rename to cpp/src/lib/messages/cucumber/messages/step_match_arguments_list.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp b/cpp/src/lib/messages/cucumber/messages/table_cell.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp rename to cpp/src/lib/messages/cucumber/messages/table_cell.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp b/cpp/src/lib/messages/cucumber/messages/table_row.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp rename to cpp/src/lib/messages/cucumber/messages/table_row.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp b/cpp/src/lib/messages/cucumber/messages/tag.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp rename to cpp/src/lib/messages/cucumber/messages/tag.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp b/cpp/src/lib/messages/cucumber/messages/test_case.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp rename to cpp/src/lib/messages/cucumber/messages/test_case.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp b/cpp/src/lib/messages/cucumber/messages/test_case_finished.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp rename to cpp/src/lib/messages/cucumber/messages/test_case_finished.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp b/cpp/src/lib/messages/cucumber/messages/test_case_started.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp rename to cpp/src/lib/messages/cucumber/messages/test_case_started.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp b/cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp rename to cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp b/cpp/src/lib/messages/cucumber/messages/test_run_started.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp rename to cpp/src/lib/messages/cucumber/messages/test_run_started.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp b/cpp/src/lib/messages/cucumber/messages/test_step.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp rename to cpp/src/lib/messages/cucumber/messages/test_step.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp b/cpp/src/lib/messages/cucumber/messages/test_step_finished.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp rename to cpp/src/lib/messages/cucumber/messages/test_step_finished.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp b/cpp/src/lib/messages/cucumber/messages/test_step_result.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp rename to cpp/src/lib/messages/cucumber/messages/test_step_result.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp b/cpp/src/lib/messages/cucumber/messages/test_step_result_status.cpp similarity index 97% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp rename to cpp/src/lib/messages/cucumber/messages/test_step_result_status.cpp index f7ae9ccc..4e15fc48 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp +++ b/cpp/src/lib/messages/cucumber/messages/test_step_result_status.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp b/cpp/src/lib/messages/cucumber/messages/test_step_started.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp rename to cpp/src/lib/messages/cucumber/messages/test_step_started.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp b/cpp/src/lib/messages/cucumber/messages/timestamp.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp rename to cpp/src/lib/messages/cucumber/messages/timestamp.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp b/cpp/src/lib/messages/cucumber/messages/undefined_parameter_type.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp rename to cpp/src/lib/messages/cucumber/messages/undefined_parameter_type.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/utils.cpp b/cpp/src/lib/messages/cucumber/messages/utils.cpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/utils.cpp rename to cpp/src/lib/messages/cucumber/messages/utils.cpp diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp b/cpp/src/lib/messages/cucumber/messages/utils.hpp similarity index 100% rename from cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp rename to cpp/src/lib/messages/cucumber/messages/utils.hpp diff --git a/dotnet/Cucumber.Messages.Specs/Cucumber.Messages.Specs.csproj b/dotnet/Cucumber.Messages.Specs/Cucumber.Messages.Specs.csproj index 92b46793..533fa81e 100644 --- a/dotnet/Cucumber.Messages.Specs/Cucumber.Messages.Specs.csproj +++ b/dotnet/Cucumber.Messages.Specs/Cucumber.Messages.Specs.csproj @@ -6,9 +6,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/dotnet/Cucumber.Messages/Cucumber.Messages.csproj b/dotnet/Cucumber.Messages/Cucumber.Messages.csproj index 67d5562b..9cdba44c 100644 --- a/dotnet/Cucumber.Messages/Cucumber.Messages.csproj +++ b/dotnet/Cucumber.Messages/Cucumber.Messages.csproj @@ -9,7 +9,7 @@ - 22.0.0 + 24.0.1 $(VersionNumber)-$(SnapshotSuffix) $(VersionNumber) @@ -32,8 +32,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/dotnet/LICENSE b/dotnet/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/dotnet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/elixir/Dockerfile b/elixir/Dockerfile index aba2a012..7a8a0d51 100644 --- a/elixir/Dockerfile +++ b/elixir/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 ARG ELIXIR_VERSION=1.10 diff --git a/elixir/LICENSE b/elixir/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/elixir/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/elixir/mix.exs b/elixir/mix.exs index 1bb2b329..77b78c9a 100644 --- a/elixir/mix.exs +++ b/elixir/mix.exs @@ -7,7 +7,7 @@ defmodule CucumberMessages.MixProject do def project do [ app: :cucumber_messages, - version: "22.0.0", + version: "24.0.1", name: "CucumberMessages", description: description(), package: package(), @@ -27,7 +27,7 @@ defmodule CucumberMessages.MixProject do [ {:protox, "~> 1.7.0"}, {:jason, "~> 1.2"}, - {:ex_doc, "~> 0.29", only: :dev, runtime: false} + {:ex_doc, "~> 0.31", only: :dev, runtime: false} ] end diff --git a/elixir/mix.lock b/elixir/mix.lock index 2c72c4ab..ae16d16d 100644 --- a/elixir/mix.lock +++ b/elixir/mix.lock @@ -1,11 +1,11 @@ %{ "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"}, - "ex_doc": {:hex, :ex_doc, "0.29.0", "4a1cb903ce746aceef9c1f9ae8a6c12b742a5461e6959b9d3b24d813ffbea146", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "f096adb8bbca677d35d278223361c7792d496b3fc0d0224c9d4bc2f651af5db1"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, + "ex_doc": {:hex, :ex_doc, "0.31.0", "06eb1dfd787445d9cab9a45088405593dd3bb7fe99e097eaa71f37ba80c7a676", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5350cafa6b7f77bdd107aa2199fe277acf29d739aba5aee7e865fc680c62a110"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, - "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.3", "d684f4bac8690e70b06eb52dad65d26de2eefa44cd19d64a8095e1417df7c8fd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "b78dc853d2e670ff6390b605d807263bf606da3c82be37f9d7f68635bd886fc9"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "protox": {:hex, :protox, "1.7.0", "6da3c691ae90ecd3ac8708eca8aea4e9c47d97ebffa29a596ab55f57b8b0fcba", [:mix], [{:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "7da9c62cd288eade7c8ed501a7f05a9bdf712abdc9b6fca5d1e823028ed41478"}, } diff --git a/go/Dockerfile b/go/Dockerfile index 64e1c279..de8f6b93 100644 --- a/go/Dockerfile +++ b/go/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image ARG GO_VERSION=1.19 diff --git a/go/LICENSE b/go/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/go/go.mod b/go/go.mod index 43f98b4f..21e0c7be 100644 --- a/go/go.mod +++ b/go/go.mod @@ -1,8 +1,8 @@ -module github.com/cucumber/messages/go/v22 +module github.com/cucumber/messages/go/v24 require ( - github.com/gofrs/uuid v4.3.1+incompatible - github.com/stretchr/testify v1.8.2 + github.com/gofrs/uuid v4.4.0+incompatible + github.com/stretchr/testify v1.8.4 ) require ( diff --git a/go/go.sum b/go/go.sum index c204888b..f75afcd9 100644 --- a/go/go.sum +++ b/go/go.sum @@ -1,23 +1,14 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= -github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI= github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go/messages.go b/go/messages.go index 1f8c603f..e7dc6169 100644 --- a/go/messages.go +++ b/go/messages.go @@ -37,8 +37,9 @@ type Envelope struct { } type Exception struct { - Type string `json:"type"` - Message string `json:"message,omitempty"` + Type string `json:"type"` + Message string `json:"message,omitempty"` + StackTrace string `json:"stackTrace,omitempty"` } type GherkinDocument struct { diff --git a/java/Dockerfile b/java/Dockerfile index 11f509c9..7110e429 100644 --- a/java/Dockerfile +++ b/java/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image ARG JAVA_VERSION=17 diff --git a/java/LICENSE b/java/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/java/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/java/maven-versions-rules.xml b/java/maven-versions-rules.xml deleted file mode 100644 index 947b2b8b..00000000 --- a/java/maven-versions-rules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - .*pr.* - .*-rc.* - .*-M\d+ - - diff --git a/java/pom.xml b/java/pom.xml index 116c3d03..82b22971 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -8,15 +8,15 @@ 4.1.1 messages - 22.0.1-SNAPSHOT + 24.0.2-SNAPSHOT jar Cucumber Messages JSON schema-based messages for Cucumber's inter-process communication - https://github.com/cucumber/cucumber-messages-java + https://github.com/cucumber/messages io.cucumber.messages - 1680812189 + 1703179200 @@ -31,14 +31,14 @@ org.junit junit-bom - 5.9.3 + 5.10.1 pom import com.fasterxml.jackson jackson-bom - 2.15.2 + 2.16.1 pom import diff --git a/java/scripts/check-jar.sh b/java/scripts/check-jar.sh deleted file mode 100755 index 7bc1ec82..00000000 --- a/java/scripts/check-jar.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# -# Verifies that the jar doesn't have any non-"io.cucumber" classes. This might happen -# if some dependencies are shaded, but some are forgotten. -# -set -uf -o pipefail - -check_jar() { - jar="$1" - module_name=$(xmlstarlet sel -N pom="http://maven.apache.org/POM/4.0.0" -t -m "//pom:project.Automatic-Module-Name" -v . pom.xml) - module_path=$(echo $module_name | sed "s/\./\\\\\//g" | sed "s/-/\\\\\//g") - echo "Checking contents of ${jar} to see if it matches pattern: ${module_path}" - unshaded_classes=$(unzip -l ${jar} | grep -e "\.class" | rev | cut -d' ' -f1 | rev | grep -v "^$module_path") - if [[ "${unshaded_classes}" != "" ]]; then - echo "Some classes in ${jar} are not in the expected package matching pattern ${module_path}. Rename the classes or change the maven-shade-plugin configuration." - echo - echo "${unshaded_classes}" - exit 1 - fi -} - -find . -name "*.jar" | while read jar; do - check_jar "${jar}" -done \ No newline at end of file diff --git a/java/scripts/post-release.sh b/java/scripts/post-release.sh deleted file mode 100755 index a1273033..00000000 --- a/java/scripts/post-release.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# Bumps the patch version and appends -SNAPSHOT -# -set -uf -o pipefail - -# Finding current version in Changelog is way simpler, as there may be multiple nodes in pom.xml -# Also extracting version with maven itself is a bit tedious -if [[ $(cat "../CHANGELOG.md") =~ \[([0-9]+).([0-9]+).([0-9]+)\] ]]; then - MAJOR="${BASH_REMATCH[1]}" - MINOR="${BASH_REMATCH[2]}" - PATCH="${BASH_REMATCH[3]}" - - NEW_VERSION="$MAJOR.$MINOR.$(( PATCH + 1))-SNAPSHOT" - mvn versions:set -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false - echo "Updated version in pom.xml to $NEW_VERSION" -else - echo "Unable to find current version in CHANGELOG, please update pom.xml manually" - echo "Bump the patch version in the `pom.xml` and append `-SNAPSHOT` to it." - exit 1 -fi diff --git a/java/scripts/set_version_ranges.rb b/java/scripts/set_version_ranges.rb deleted file mode 100644 index 82d7748d..00000000 --- a/java/scripts/set_version_ranges.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'nokogiri' - -pom = File.open("pom.xml") { |f| Nokogiri::XML(f) } - -versions = pom.xpath("//xmlns:dependency/xmlns:version[../xmlns:groupId/text() = 'io.cucumber']") -versions.each do |version| - return version unless version.content =~ /^\d+\.\d+\.\d+$/ - major, minor, patch = version.content.split('.').map {|i| i.to_i} - version.content = "[#{major}.#{minor}.#{patch},#{major+1}.0.0)" -end - -File.open("pom.xml", "w:UTF-8") { |f| f.write(pom.to_xml) } diff --git a/java/src/generated/java/io/cucumber/messages/types/Exception.java b/java/src/generated/java/io/cucumber/messages/types/Exception.java index d29a505a..f8396472 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Exception.java +++ b/java/src/generated/java/io/cucumber/messages/types/Exception.java @@ -18,13 +18,16 @@ public final class Exception { private final String type; private final String message; + private final String stackTrace; public Exception( String type, - String message + String message, + String stackTrace ) { this.type = requireNonNull(type, "Exception.type cannot be null"); this.message = message; + this.stackTrace = stackTrace; } /** @@ -41,6 +44,13 @@ public Optional getMessage() { return Optional.ofNullable(message); } + /** + * The stringified stack trace of the exception that caused this result + */ + public Optional getStackTrace() { + return Optional.ofNullable(stackTrace); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -48,14 +58,16 @@ public boolean equals(Object o) { Exception that = (Exception) o; return type.equals(that.type) && - Objects.equals(message, that.message); + Objects.equals(message, that.message) && + Objects.equals(stackTrace, that.stackTrace); } @Override public int hashCode() { return Objects.hash( type, - message + message, + stackTrace ); } @@ -64,6 +76,7 @@ public String toString() { return "Exception{" + "type=" + type + ", message=" + message + + ", stackTrace=" + stackTrace + '}'; } } diff --git a/java/src/main/java/io/cucumber/messages/Convertor.java b/java/src/main/java/io/cucumber/messages/Convertor.java index 021e8fb8..a1677138 100644 --- a/java/src/main/java/io/cucumber/messages/Convertor.java +++ b/java/src/main/java/io/cucumber/messages/Convertor.java @@ -11,7 +11,7 @@ private Convertor(){ } public static Exception toMessage(Throwable t) { - return new Exception(t.getClass().getName(), t.getMessage()); + return new Exception(t.getClass().getName(), t.getMessage(), null); } public static Timestamp toMessage(java.time.Instant instant) { diff --git a/javascript/Dockerfile b/javascript/Dockerfile index d85caf1f..e0e4b442 100644 --- a/javascript/Dockerfile +++ b/javascript/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image ARG JAVASCRIPT_VERSION=18 diff --git a/javascript/LICENSE b/javascript/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/javascript/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/javascript/package-lock.json b/javascript/package-lock.json index 4a3b6307..d25e1528 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -1,27 +1,27 @@ { "name": "@cucumber/messages", - "version": "22.0.0", + "version": "24.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@cucumber/messages", - "version": "22.0.0", + "version": "24.0.1", "license": "MIT", "dependencies": { - "@types/uuid": "9.0.2", + "@types/uuid": "9.0.7", "class-transformer": "0.5.1", - "reflect-metadata": "0.1.13", - "uuid": "9.0.0" + "reflect-metadata": "0.2.1", + "uuid": "9.0.1" }, "devDependencies": { - "@types/mocha": "10.0.1", - "@types/node": "18.16.18", + "@types/mocha": "10.0.6", + "@types/node": "20.10.5", "copyfiles": "2.4.1", "mocha": "10.2.0", "shx": "^0.3.4", - "ts-node": "10.9.1", - "typescript": "5.0.4" + "ts-node": "10.9.2", + "typescript": "5.3.3" } }, "node_modules/@cspotcode/source-map-support": { @@ -86,21 +86,24 @@ "dev": true }, "node_modules/@types/mocha": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", "dev": true }, "node_modules/@types/node": { - "version": "18.16.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.18.tgz", - "integrity": "sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw==", - "dev": true + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/uuid": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.2.tgz", - "integrity": "sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==" + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz", + "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==" }, "node_modules/acorn": { "version": "8.7.1", @@ -1018,9 +1021,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", + "integrity": "sha512-i5lLI6iw9AU3Uu4szRNPPEkomnkjRTaVt9hy/bn5g/oSzekBSMeLZblcjP74AW0vBabqERLLIrz+gR8QYR54Tw==" }, "node_modules/require-directory": { "version": "2.1.1", @@ -1240,9 +1243,9 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -1292,18 +1295,24 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -1320,9 +1329,13 @@ "dev": true }, "node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -1501,21 +1514,24 @@ "dev": true }, "@types/mocha": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", "dev": true }, "@types/node": { - "version": "18.16.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.18.tgz", - "integrity": "sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw==", - "dev": true + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/uuid": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.2.tgz", - "integrity": "sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==" + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz", + "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==" }, "acorn": { "version": "8.7.1", @@ -2198,9 +2214,9 @@ } }, "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", + "integrity": "sha512-i5lLI6iw9AU3Uu4szRNPPEkomnkjRTaVt9hy/bn5g/oSzekBSMeLZblcjP74AW0vBabqERLLIrz+gR8QYR54Tw==" }, "require-directory": { "version": "2.1.1", @@ -2360,9 +2376,9 @@ } }, "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", @@ -2389,9 +2405,15 @@ } }, "typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true + }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, "untildify": { @@ -2407,9 +2429,9 @@ "dev": true }, "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, "v8-compile-cache-lib": { "version": "3.0.1", diff --git a/javascript/package.json b/javascript/package.json index 38ab3646..e2b15d94 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@cucumber/messages", - "version": "22.0.0", + "version": "24.0.1", "description": "JSON schema-based messages for Cucumber's inter-process communication", "type": "module", "main": "dist/cjs/src/index.js", @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/cucumber/messages-javascript.git" + "url": "git://github.com/cucumber/messages.git" }, "author": "Cucumber Limited ", "license": "MIT", @@ -36,24 +36,24 @@ "prepublishOnly": "npm run build && npm run copy-schemas" }, "dependencies": { - "@types/uuid": "9.0.2", + "@types/uuid": "9.0.7", "class-transformer": "0.5.1", - "reflect-metadata": "0.1.13", - "uuid": "9.0.0" + "reflect-metadata": "0.2.1", + "uuid": "9.0.1" }, "devDependencies": { - "@types/mocha": "10.0.1", - "@types/node": "18.16.18", + "@types/mocha": "10.0.6", + "@types/node": "20.10.5", "copyfiles": "2.4.1", "mocha": "10.2.0", "shx": "^0.3.4", - "ts-node": "10.9.1", - "typescript": "5.0.4" + "ts-node": "10.9.2", + "typescript": "5.3.3" }, "bugs": { - "url": "https://github.com/cucumber/messages-javascript/issues" + "url": "https://github.com/cucumber/messages/issues" }, - "homepage": "https://github.com/cucumber/messages-javascript#readme", + "homepage": "https://github.com/cucumber/messages#readme", "directories": { "test": "test" }, diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index 24f6122e..ceec6923 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -87,6 +87,8 @@ export class Exception { type: string = '' message?: string + + stackTrace?: string } export class GherkinDocument { diff --git a/javascript/src/version.ts b/javascript/src/version.ts index f8808672..2cd0c5f4 100644 --- a/javascript/src/version.ts +++ b/javascript/src/version.ts @@ -1,2 +1,2 @@ // This file is automatically generated using npm scripts -export const version = '22.0.0' +export const version = '24.0.1' diff --git a/jsonschema/Dockerfile b/jsonschema/Dockerfile index c668bbb3..bcab83b0 100644 --- a/jsonschema/Dockerfile +++ b/jsonschema/Dockerfile @@ -1,7 +1,7 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 ARG LANGUAGE=ruby -FROM ruby:3.2.2-alpine AS ruby +FROM ruby:3.3.0-alpine AS ruby RUN apk add coreutils @@ -20,7 +20,7 @@ EOF # Todo: can we eliminate this stage with smarter ERB templates? -FROM golang:1.20.5-alpine AS go-codegen +FROM golang:1.21.5-alpine AS go-codegen WORKDIR /build COPY --link --from=go-unformatted /build/ . diff --git a/jsonschema/Exception.json b/jsonschema/Exception.json index a8187b58..b7d9d986 100644 --- a/jsonschema/Exception.json +++ b/jsonschema/Exception.json @@ -14,6 +14,10 @@ "message": { "type": "string", "description": "The message of exception that caused this result. E.g. expected: \"a\" but was: \"b\"" + }, + "stackTrace": { + "type": "string", + "description": "The stringified stack trace of the exception that caused this result" } }, "type": "object" diff --git a/jsonschema/scripts/codegen.rb b/jsonschema/scripts/codegen.rb index 2b0c558c..faf88a1d 100644 --- a/jsonschema/scripts/codegen.rb +++ b/jsonschema/scripts/codegen.rb @@ -296,11 +296,12 @@ def default_value(parent_type_name, property_name, property) end def format_description(raw_description, indent_string: " ") - return '' if raw_description.nil? + return '##' if raw_description.nil? raw_description .split("\n") .map { |description_line| "# #{description_line}" } + .push('##') .join("\n#{indent_string}") end end @@ -435,7 +436,6 @@ def default_enum(enum_type_name, property) end end - clazz = Object.const_get(ARGV[0]) path = ARGV[1] paths = File.file?(path) ? [path] : Dir["#{path}/*.json"] diff --git a/jsonschema/scripts/templates/cpp.enum.hpp.erb b/jsonschema/scripts/templates/cpp.enum.hpp.erb index 3cc4b2e0..ca8210fe 100644 --- a/jsonschema/scripts/templates/cpp.enum.hpp.erb +++ b/jsonschema/scripts/templates/cpp.enum.hpp.erb @@ -23,6 +23,7 @@ operator<<(std::ostream& os, <%= ename %> v); } <%= ename %>.cpp +#include #include #include .hpp> diff --git a/jsonschema/scripts/templates/ruby.enum.rb.erb b/jsonschema/scripts/templates/ruby.enum.rb.erb index 7c55382e..390c55b7 100644 --- a/jsonschema/scripts/templates/ruby.enum.rb.erb +++ b/jsonschema/scripts/templates/ruby.enum.rb.erb @@ -1,9 +1,9 @@ <% @enums.each do |enum| -%> class Cucumber::Messages::<%= enum[:name] %> -<%- enum[:values].each_with_index do |value, index| -%> + <%- enum[:values].each_with_index do |value, index| -%> <%= enum_constant(value) %> = '<%= value %>' -<%- end -%> + <%- end -%> end - +<%= "\n" unless enum == @enums.last -%> <%- end -%> diff --git a/jsonschema/scripts/templates/ruby.rb.erb b/jsonschema/scripts/templates/ruby.rb.erb index 39d3bb38..6147cc0b 100644 --- a/jsonschema/scripts/templates/ruby.rb.erb +++ b/jsonschema/scripts/templates/ruby.rb.erb @@ -6,38 +6,30 @@ require 'cucumber/messages/message' module Cucumber module Messages <%- @schemas.each do |key, schema| %> - ## # Represents the <%= class_name(key) %> message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - <%= format_description(schema['description']) %> - # - + <%= "#\n " if schema['description'] %><%= format_description(schema['description']) %> class <%= class_name(key) %> < ::Cucumber::Messages::Message <%- schema['properties'].each do |property_name, property| -%> - <%- if property['description'] -%> ## <%= format_description(property['description'], indent_string: ' ') %> - <%- end -%> attr_reader :<%= underscore(property_name) %> - <%- end -%> + <%- end -%> def initialize( <%- schema['properties'].each do |property_name, property| -%> - <%= underscore(property_name) -%>: <%= - (schema['required'] || []).index(property_name) ? - default_value(class_name(key), property_name, property) : - 'nil' - -%><%= property_name == schema['properties'].keys.last ? '' : ',' %> + <%- final_key = property_name == schema['properties'].keys.last -%> + <%- individual_value = (schema['required'] || []).index(property_name) ? default_value(class_name(key), property_name, property) : 'nil' -%> + <%= "#{underscore(property_name)}: #{individual_value}" -%><%= final_key ? '' : ',' %> <%- end -%> ) - <%- schema['properties'].each do |property_name, property| -%> + <%- schema['properties'].each do |property_name, _property| -%> @<%= underscore(property_name) %> = <%= underscore(property_name) %> <%- end -%> end end - <%- end %> + <%- end -%> end end diff --git a/messages.md b/messages.md index 685233d5..8183c829 100644 --- a/messages.md +++ b/messages.md @@ -51,6 +51,7 @@ will only have one of its fields set, which indicates the payload of the message | ----- | ---- | ----------- | ----------- | | `type` | string | yes | | | `message` | string | no | | +| `stackTrace` | string | no | | ## GherkinDocument diff --git a/perl/Dockerfile b/perl/Dockerfile index 19992eab..5c2491be 100644 --- a/perl/Dockerfile +++ b/perl/Dockerfile @@ -1,7 +1,7 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image -ARG PERL_VERSION=5.37 +ARG PERL_VERSION=5.39 FROM perl:${PERL_VERSION} AS perl WORKDIR /cucumber diff --git a/perl/VERSION b/perl/VERSION index 1d975bef..1b3e74f8 100644 --- a/perl/VERSION +++ b/perl/VERSION @@ -1 +1 @@ -22.0.0 +24.0.1 diff --git a/perl/dist.ini b/perl/dist.ini index 912ff4f7..01a7ee5a 100644 --- a/perl/dist.ini +++ b/perl/dist.ini @@ -35,7 +35,8 @@ exclude_filename=VERSION [GatherFile] ; explicitly add unversioned files -filename=../CHANGELOG.md +root=../ +filename=CHANGELOG.md [Hook::VersionProvider] . = my $v = `cat ./VERSION`; chomp( $v ); $v; diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 342db43e..5e5d51e8 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -546,6 +546,7 @@ use Scalar::Util qw( blessed ); my %types = ( type => 'string', message => 'string', + stack_trace => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -580,6 +581,17 @@ has message => ); +=head4 stack_trace + +The stringified stack trace of the exception that caused this result + +=cut + +has stack_trace => + (is => 'ro', + ); + + } package Cucumber::Messages::GherkinDocument { diff --git a/perl/t/compatibility-kit/package-lock.json b/perl/t/compatibility-kit/package-lock.json index dbf9a062..52edf1e5 100644 --- a/perl/t/compatibility-kit/package-lock.json +++ b/perl/t/compatibility-kit/package-lock.json @@ -9,21 +9,21 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "@cucumber/compatibility-kit": "^11.0.0" + "@cucumber/compatibility-kit": "^13.0.0" } }, "node_modules/@cucumber/compatibility-kit": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-11.0.0.tgz", - "integrity": "sha512-Rd21XmCrpOkv7y5dMWp8bu2Iyyja3KdQPcZbt0A+m3NB1fOmOqqLX1kEZpQpd0OACqfFpGiqHw+hL813w/2lig==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-13.0.1.tgz", + "integrity": "sha512-s6Nsx6v5iVCIaVXtbKZ2RFmNK/Vu9jeCjvOME5Rn7gpHphNFp4mhX9vmvL2Np7OwKTaaPtpkdJEMjIUS+5JlqQ==", "dev": true } }, "dependencies": { "@cucumber/compatibility-kit": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-11.0.0.tgz", - "integrity": "sha512-Rd21XmCrpOkv7y5dMWp8bu2Iyyja3KdQPcZbt0A+m3NB1fOmOqqLX1kEZpQpd0OACqfFpGiqHw+hL813w/2lig==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-13.0.1.tgz", + "integrity": "sha512-s6Nsx6v5iVCIaVXtbKZ2RFmNK/Vu9jeCjvOME5Rn7gpHphNFp4mhX9vmvL2Np7OwKTaaPtpkdJEMjIUS+5JlqQ==", "dev": true } } diff --git a/perl/t/compatibility-kit/package.json b/perl/t/compatibility-kit/package.json index 24dd4d53..7e0eb463 100644 --- a/perl/t/compatibility-kit/package.json +++ b/perl/t/compatibility-kit/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "devDependencies": { - "@cucumber/compatibility-kit": "^11.0.0" + "@cucumber/compatibility-kit": "^13.0.0" } } diff --git a/php/Dockerfile b/php/Dockerfile index d3ceee5d..3023c1af 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image ARG PHP_VERSION=8.1 diff --git a/php/LICENSE b/php/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/php/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/php/composer.json b/php/composer.json index 8349570d..6c3f589a 100644 --- a/php/composer.json +++ b/php/composer.json @@ -9,8 +9,8 @@ "ext-json": "*" }, "require-dev": { - "vimeo/psalm": "^5.0", - "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^5.5", + "phpunit/phpunit": "^10.3", "psalm/plugin-phpunit": "^0.18.0", "friendsofphp/php-cs-fixer": "^3.5", "ramsey/uuid": "^4.5.0" diff --git a/php/phpunit.xml b/php/phpunit.xml index fd5e5582..bda28d99 100644 --- a/php/phpunit.xml +++ b/php/phpunit.xml @@ -1,26 +1,21 @@ + failOnRisky="true" failOnWarning="true" + cacheDirectory=".phpunit.cache" + beStrictAboutCoverageMetadata="true"> tests - - + + - src + src - + diff --git a/php/src-generated/Exception.php b/php/src-generated/Exception.php index dca44cac..ad21e051 100644 --- a/php/src-generated/Exception.php +++ b/php/src-generated/Exception.php @@ -35,6 +35,11 @@ public function __construct( * The message of exception that caused this result. E.g. expected: "a" but was: "b" */ public readonly ?string $message = null, + + /** + * The stringified stack trace of the exception that caused this result + */ + public readonly ?string $stackTrace = null, ) { } @@ -47,10 +52,12 @@ public static function fromArray(array $arr): self { self::ensureType($arr); self::ensureMessage($arr); + self::ensureStackTrace($arr); return new self( (string) $arr['type'], isset($arr['message']) ? (string) $arr['message'] : null, + isset($arr['stackTrace']) ? (string) $arr['stackTrace'] : null, ); } @@ -76,4 +83,14 @@ private static function ensureMessage(array $arr): void throw new SchemaViolationException('Property \'message\' was array'); } } + + /** + * @psalm-assert array{stackTrace?: string|int|bool} $arr + */ + private static function ensureStackTrace(array $arr): void + { + if (array_key_exists('stackTrace', $arr) && is_array($arr['stackTrace'])) { + throw new SchemaViolationException('Property \'stackTrace\' was array'); + } + } } diff --git a/php/src/JsonEncodingTrait.php b/php/src/JsonEncodingTrait.php index f598f3af..8c48c9ba 100644 --- a/php/src/JsonEncodingTrait.php +++ b/php/src/JsonEncodingTrait.php @@ -42,6 +42,8 @@ public static function fromJson(string $json): self /** * Serialise the message into a JSON string + * + * @psalm-return non-empty-string */ public function asJson(): string { diff --git a/php/tests/AcceptanceTest.php b/php/tests/AcceptanceTest.php index a3ce4ca4..0f70cf20 100644 --- a/php/tests/AcceptanceTest.php +++ b/php/tests/AcceptanceTest.php @@ -1,5 +1,7 @@ asJson(); @@ -34,11 +41,11 @@ public function testAllFileStreamsSurviveDecodingThenEncoding(string $filename): $sourceLine = fgets($sourceHandle); $destLine = fgets($destHandle); - if (!$sourceLine && !$destLine) { - break; + if (empty($sourceLine) || empty($destLine)) { + self::assertEquals($sourceLine, $destLine); + } else { + self::assertJsonStringEqualsJsonString($sourceLine, $destLine); } - - self::assertJsonStringEqualsJsonString($sourceLine, $destLine); } // we exhausted source so dest should also be at end @@ -48,9 +55,9 @@ public function testAllFileStreamsSurviveDecodingThenEncoding(string $filename): /** * @return Generator */ - public function provideJsonLines(): Generator + public static function provideJsonLines(): Generator { - foreach ($this->getSampleFiles() as $filename) { + foreach (AcceptanceTest::getSampleFiles() as $filename) { foreach (file($filename) ?: [] as $lineNumber => $line) { // key is provided for better error messages $key = realpath($filename) . ':' . $lineNumber; @@ -62,18 +69,25 @@ public function provideJsonLines(): Generator /** * @return Generator */ - public function provideNdJsonFilenames(): Generator + public static function provideNdJsonFilenames(): Generator { - foreach ($this->getSampleFiles() as $filename) { + foreach (AcceptanceTest::getSampleFiles() as $filename) { yield $filename => [$filename]; } } /** - * @return list + * @return array */ - private function getSampleFiles(): array + private static function getSampleFiles(): array { - return glob(__DIR__ . '/../../../node_modules/@cucumber/compatibility-kit/features/**/*.ndjson') ?: []; + // Note: This test setup is not ideal. The minimal.feature.ndjson + // will break whenever the schema for a feature file is updated. + // + // It would be better to specifically target known problems. + // However there are currently no known problems (because these + // tests originally tested against the CCK but that caused + // circular dependencies). + return glob(__DIR__ . '/Samples/*.ndjson') ?: []; } } diff --git a/php/tests/Samples/minimal.feature.ndjson b/php/tests/Samples/minimal.feature.ndjson new file mode 100644 index 00000000..da9d4f22 --- /dev/null +++ b/php/tests/Samples/minimal.feature.ndjson @@ -0,0 +1,12 @@ +{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"darwin","version":"22.4.0"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"19.7.0"}}} +{"source":{"data":"Feature: minimal\n \n Cucumber doesn't execute this markdown, but @cucumber/react renders it\n \n * This is\n * a bullet\n * list\n \n Scenario: cukes\n Given I have 42 cukes in my belly\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"samples/minimal/minimal.feature"}} +{"gherkinDocument":{"comments":[],"feature":{"children":[{"scenario":{"description":"","examples":[],"id":"2","keyword":"Scenario","location":{"column":3,"line":9},"name":"cukes","steps":[{"id":"1","keyword":"Given ","keywordType":"Context","location":{"column":5,"line":10},"text":"I have 42 cukes in my belly"}],"tags":[]}}],"description":" Cucumber doesn't execute this markdown, but @cucumber/react renders it\n \n * This is\n * a bullet\n * list","keyword":"Feature","language":"en","location":{"column":1,"line":1},"name":"minimal","tags":[]},"uri":"samples/minimal/minimal.feature"}} +{"pickle":{"astNodeIds":["2"],"id":"4","language":"en","name":"cukes","steps":[{"astNodeIds":["1"],"id":"3","text":"I have 42 cukes in my belly","type":"Context"}],"tags":[],"uri":"samples/minimal/minimal.feature"}} +{"stepDefinition":{"id":"0","pattern":{"source":"I have {int} cukes in my belly","type":"CUCUMBER_EXPRESSION"},"sourceReference":{"location":{"line":4},"uri":"samples/minimal/minimal.feature.ts"}}} +{"testRunStarted":{"timestamp":{"nanos":0,"seconds":0}}} +{"testCase":{"id":"6","pickleId":"4","testSteps":[{"id":"5","pickleStepId":"3","stepDefinitionIds":["0"],"stepMatchArgumentsLists":[{"stepMatchArguments":[{"group":{"children":[],"start":7,"value":"42"},"parameterTypeName":"int"}]}]}]}} +{"testCaseStarted":{"attempt":0,"id":"7","testCaseId":"6","timestamp":{"nanos":1000000,"seconds":0}}} +{"testStepStarted":{"testCaseStartedId":"7","testStepId":"5","timestamp":{"nanos":2000000,"seconds":0}}} +{"testStepFinished":{"testCaseStartedId":"7","testStepId":"5","testStepResult":{"duration":{"nanos":1000000,"seconds":0},"status":"PASSED"},"timestamp":{"nanos":3000000,"seconds":0}}} +{"testCaseFinished":{"testCaseStartedId":"7","timestamp":{"nanos":4000000,"seconds":0},"willBeRetried":false}} +{"testRunFinished":{"success":true,"timestamp":{"nanos":5000000,"seconds":0}}} diff --git a/ruby/.dockerignore b/ruby/.dockerignore index 498909b8..ccf5668e 100644 --- a/ruby/.dockerignore +++ b/ruby/.dockerignore @@ -1,5 +1,3 @@ -scripts -LICENSE README.md Makefile Gemfile.lock diff --git a/ruby/.rubocop.yml b/ruby/.rubocop.yml new file mode 100644 index 00000000..4e944341 --- /dev/null +++ b/ruby/.rubocop.yml @@ -0,0 +1,21 @@ +inherit_from: .rubocop_todo.yml + +require: + - rubocop-rspec + +AllCops: + TargetRubyVersion: 2.5 + NewCops: enable + +Layout/LineLength: + Max: 200 + +Style/Documentation: + Enabled: false + +Style/RegexpLiteral: + EnforcedStyle: slashes + AllowInnerSlashes: true + +RSpec/MessageSpies: + EnforcedStyle: receive diff --git a/ruby/.rubocop_todo.yml b/ruby/.rubocop_todo.yml new file mode 100644 index 00000000..cee0cf2c --- /dev/null +++ b/ruby/.rubocop_todo.yml @@ -0,0 +1,397 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-10-27 15:09:45 UTC using RuboCop version 1.28.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Initial iteration: 22 files inspected, 816 offenses detected, 678 offenses auto-correctable + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: Include. +# Include: **/*.gemspec +Gemspec/RequireMFA: + Exclude: + - 'cucumber-messages.gemspec' + +# Offense count: 29 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowBorderComment, AllowMarginComment. +Layout/EmptyComment: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/cucumber/messages/ndjson_to_message_enumerator.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'Gemfile' + +# Offense count: 55 +# This cop supports safe auto-correction (--auto-correct). +Layout/EmptyLines: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 110 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'lib/cucumber/messages.deserializers.rb' + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Exclude: + - 'lib/cucumber/messages.deserializers.rb' + - 'lib/cucumber/messages.dtos.rb' + - 'lib/cucumber/messages/message/deserialization.rb' + - 'lib/cucumber/messages/message/serialization.rb' + - 'lib/cucumber/messages/message/utils.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'cucumber-messages.gemspec' + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'cucumber-messages.gemspec' + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 338 + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'cucumber-messages.gemspec' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'lib/cucumber/messages/message/serialization.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'spec/cucumber/messages/message/serialization_spec.rb' + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + - 'spec/cucumber/messages/id_generator_spec.rb' + - 'spec/cucumber/messages/message/dummy_messages.rb' + - 'spec/cucumber/messages/version_spec.rb' + +# Offense count: 45 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'lib/cucumber/messages/time_conversion.rb' + +# Offense count: 1 +Lint/IneffectiveAccessModifier: + Exclude: + - 'spec/cucumber/messages/message/dummy_messages.rb' + +# Offense count: 57 +Lint/MissingSuper: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + - 'spec/cucumber/messages/message/dummy_messages.rb' + +# Offense count: 1 +# This cop supports unsafe auto-correction (--auto-correct-all). +Lint/NonDeterministicRequireOrder: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Lint/ToJSON: + Exclude: + - 'lib/cucumber/messages/message/serialization.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods. +Lint/UselessAccessModifier: + Exclude: + - 'spec/cucumber/messages/message/dummy_messages.rb' + +# Offense count: 1 +Lint/UselessAssignment: + Exclude: + - 'lib/cucumber/messages/ndjson_to_message_enumerator.rb' + +# Offense count: 2 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 37 + +# Offense count: 3 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine +Metrics/BlockLength: + Max: 68 + +# Offense count: 1 +# Configuration parameters: IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 8 + +# Offense count: 7 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +Metrics/MethodLength: + Max: 20 + +# Offense count: 11 +# Configuration parameters: CountKeywordArgs, MaxOptionalParameters. +Metrics/ParameterLists: + Max: 17 + +# Offense count: 1 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +RSpec/ContextMethod: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + +# Offense count: 4 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + - 'spec/cucumber/messages/message/serialization_spec.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: SkipBlocks, EnforcedStyle. +# SupportedStyles: described_class, explicit +RSpec/DescribedClass: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + - 'spec/cucumber/messages/time_conversion_spec.rb' + +# Offense count: 2 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 6 + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: CustomTransform, IgnoredWords. +RSpec/ExampleWording: + Exclude: + - 'spec/cucumber/messages/version_spec.rb' + +# Offense count: 1 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: have_received + +# Offense count: 1 +RSpec/MultipleDescribes: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + +# Offense count: 4 +RSpec/MultipleExpectations: + Max: 3 + +# Offense count: 34 +# Configuration parameters: IgnoreSharedExamples. +RSpec/NamedSubject: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + - 'spec/cucumber/messages/message/deserialization_spec.rb' + - 'spec/cucumber/messages/message/serialization_spec.rb' + - 'spec/cucumber/messages/message/utils_spec.rb' + - 'spec/cucumber/messages/version_spec.rb' + +# Offense count: 3 +RSpec/NestedGroups: + Max: 4 + +# Offense count: 202 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + +# Offense count: 7 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + - 'spec/cucumber/messages/message/dummy_messages.rb' + +# Offense count: 1 +# This cop supports unsafe auto-correction (--auto-correct-all). +Style/CollectionCompact: + Exclude: + - 'lib/cucumber/messages/message/serialization.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Style/ColonMethodCall: + Exclude: + - 'spec/cucumber/messages/acceptance_spec.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Style/ExpandPathArguments: + Exclude: + - 'Rakefile' + +# Offense count: 21 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 23 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/cucumber/messages.dtos.rb' + - 'spec/cucumber/messages/message/dummy_messages.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: Strict, AllowedNumbers. +Style/NumericLiterals: + MinDigits: 11 + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +Style/PerlBackrefs: + Exclude: + - 'lib/cucumber/messages/message/utils.rb' + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +Style/RedundantRegexpEscape: + Exclude: + - 'spec/cucumber/messages/id_generator_spec.rb' + +# Offense count: 57 +# This cop supports safe auto-correction (--auto-correct). +Style/RedundantSelf: + Exclude: + - 'lib/cucumber/messages.deserializers.rb' + - 'lib/cucumber/messages/message/serialization.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'lib/cucumber/messages/ndjson_to_message_enumerator.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: RequireEnglish. +# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names + +# Offense count: 22 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'Rakefile' + - 'cucumber-messages.gemspec' + - 'lib/cucumber/messages.rb' + - 'lib/cucumber/messages/message/utils.rb' + - 'spec/cucumber/messages/id_generator_spec.rb' + - 'spec/cucumber/messages/message/deserialization_spec.rb' + - 'spec/cucumber/messages/ndjson_serialization_spec.rb' + +# Offense count: 55 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'lib/cucumber/messages.deserializers.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'cucumber-messages.gemspec' diff --git a/ruby/Dockerfile b/ruby/Dockerfile index ae7faf06..d8eae323 100644 --- a/ruby/Dockerfile +++ b/ruby/Dockerfile @@ -1,4 +1,4 @@ -#syntax=docker/dockerfile:1.4 +#syntax=docker/dockerfile:1.6 # Base image ARG RUBY_VERSION=3.1 diff --git a/ruby/LICENSE b/ruby/LICENSE deleted file mode 100644 index 725ba9f4..00000000 --- a/ruby/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Cucumber Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/ruby/README.md b/ruby/README.md index 1697c08b..a97bb8c0 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -1,2 +1,3 @@ # Cucumber Messages for Ruby (JSON schema) +See main [README](../README.md) diff --git a/ruby/Rakefile b/ruby/Rakefile index 85e0fc70..bb07015f 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'rubygems' require 'bundler' Bundler::GemHelper.install_tasks @@ -12,14 +11,4 @@ end require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) -require_relative 'spec/capture_warnings' -include CaptureWarnings -namespace :spec do - task :warnings do - report_warnings do - Rake::Task['spec'].invoke - end - end -end - -task default: ['spec:warnings'] +task default: :spec diff --git a/ruby/VERSION b/ruby/VERSION index 1d975bef..1b3e74f8 100644 --- a/ruby/VERSION +++ b/ruby/VERSION @@ -1 +1 @@ -22.0.0 +24.0.1 diff --git a/ruby/cucumber-messages.gemspec b/ruby/cucumber-messages.gemspec index 10a4555d..bd11490f 100644 --- a/ruby/cucumber-messages.gemspec +++ b/ruby/cucumber-messages.gemspec @@ -1,39 +1,33 @@ -# -*- encoding: utf-8 -*- - version = File.read(File.expand_path("VERSION", __dir__)).strip Gem::Specification.new do |s| s.name = 'cucumber-messages' s.version = version s.authors = ["Aslak Hellesøy"] - s.description = "Protocol Buffer messages for Cucumber's inter-process communication" + s.description = "JSON schema-based messages for Cucumber's inter-process communication" s.summary = "cucumber-messages-#{s.version}" s.email = 'cukes@googlegroups.com' - s.homepage = "https://github.com/cucumber/messages-ruby#readme" + s.homepage = "https://github.com/cucumber/messages#readme" s.platform = Gem::Platform::RUBY s.license = "MIT" - s.required_ruby_version = ">= 2.3" + s.required_ruby_version = ">= 2.5" + s.required_rubygems_version = ">= 3.0.0" s.metadata = { - 'bug_tracker_uri' => 'https://github.com/cucumber/messages/issues', - 'changelog_uri' => 'https://github.com/cucumber/messages/blob/main/CHANGELOG.md', - 'documentation_uri' => 'https://www.rubydoc.info/github/cucumber/messages', - 'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes', - 'source_code_uri' => 'https://github.com/cucumber/messages', - } + 'bug_tracker_uri' => 'https://github.com/cucumber/messages/issues', + 'changelog_uri' => 'https://github.com/cucumber/messages/blob/main/CHANGELOG.md', + 'documentation_uri' => 'https://www.rubydoc.info/github/cucumber/messages', + 'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes', + 'source_code_uri' => 'https://github.com/cucumber/messages', + } - s.add_development_dependency 'cucumber-compatibility-kit', '~> 11.0', '>= 11.0.0' + s.add_development_dependency 'cucumber-compatibility-kit', '~> 12.0' s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6' - s.add_development_dependency 'rspec', '~> 3.11', '>= 3.11.0' + s.add_development_dependency 'rspec', '~> 3.12' + s.add_development_dependency 'rubocop', '~> 1.28.0' + s.add_development_dependency 'rubocop-rspec', '~> 2.5.0' - s.rubygems_version = ">= 1.6.1" - s.files = Dir[ - 'README.md', - 'LICENSE', - 'VERSION', - 'lib/**/*' - ] - s.test_files = Dir['spec/**/*'] + s.files = Dir['README.md', 'VERSION', 'lib/**/*'] s.rdoc_options = ["--charset=UTF-8"] s.require_path = "lib" end diff --git a/ruby/lib/cucumber/messages.deserializers.rb b/ruby/lib/cucumber/messages.deserializers.rb index 3eacad5e..a5b26a65 100644 --- a/ruby/lib/cucumber/messages.deserializers.rb +++ b/ruby/lib/cucumber/messages.deserializers.rb @@ -104,6 +104,7 @@ def self.from_h(hash) self.new( type: hash[:type], message: hash[:message], + stack_trace: hash[:stackTrace], ) end end diff --git a/ruby/lib/cucumber/messages.dtos.rb b/ruby/lib/cucumber/messages.dtos.rb index 91aded62..5a70d4d6 100644 --- a/ruby/lib/cucumber/messages.dtos.rb +++ b/ruby/lib/cucumber/messages.dtos.rb @@ -6,7 +6,6 @@ module Cucumber module Messages - ## # Represents the Attachment message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -22,16 +21,14 @@ module Messages # # It is not to be used for runtime errors raised/thrown during execution. This # is captured in `TestResult`. - # - + ## class Attachment < ::Cucumber::Messages::Message - ## # * # The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment # is simply the string. If it's `BASE64`, the string should be Base64 decoded to # obtain the attachment. - + ## attr_reader :body ## @@ -44,13 +41,13 @@ class Attachment < ::Cucumber::Messages::Message # - string: IDENTITY # - byte array: BASE64 # - stream: BASE64 - + ## attr_reader :content_encoding ## # * # Suggested file name of the attachment. (Provided by the user as an argument to `attach`) - + ## attr_reader :file_name ## @@ -59,7 +56,7 @@ class Attachment < ::Cucumber::Messages::Message # [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml) # as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain` # and `text/x.cucumber.stacktrace+plain` - + ## attr_reader :media_type attr_reader :source @@ -81,7 +78,7 @@ class Attachment < ::Cucumber::Messages::Message # This will result in a smaller message stream, which can improve performance and # reduce bandwidth of message consumers. It also makes it easier to process and download attachments # separately from reports. - + ## attr_reader :url def initialize( @@ -105,16 +102,13 @@ def initialize( end end - ## # Represents the Duration message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # The structure is pretty close of the Timestamp one. For clarity, a second type # of message is used. - # - + ## class Duration < ::Cucumber::Messages::Message - attr_reader :seconds ## @@ -122,7 +116,7 @@ class Duration < ::Cucumber::Messages::Message # second values with fractions must still have non-negative nanos values # that count forward in time. Must be from 0 to 999,999,999 # inclusive. - + ## attr_reader :nanos def initialize( @@ -134,7 +128,6 @@ def initialize( end end - ## # Represents the Envelope message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -145,10 +138,8 @@ def initialize( # * # All the messages that are passed between different components/processes are Envelope # messages. - # - + ## class Envelope < ::Cucumber::Messages::Message - attr_reader :attachment attr_reader :gherkin_document @@ -222,35 +213,38 @@ def initialize( end end - ## # Represents the Exception message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # A simplified representation of an exception - # - + ## class Exception < ::Cucumber::Messages::Message - ## # The type of the exception that caused this result. E.g. "Error" or "org.opentest4j.AssertionFailedError" - + ## attr_reader :type ## # The message of exception that caused this result. E.g. expected: "a" but was: "b" - + ## attr_reader :message + ## + # The stringified stack trace of the exception that caused this result + ## + attr_reader :stack_trace + def initialize( type: '', - message: nil + message: nil, + stack_trace: nil ) @type = type @message = message + @stack_trace = stack_trace end end - ## # Represents the GherkinDocument message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -261,22 +255,20 @@ def initialize( # # The only consumers of `GherkinDocument` should only be formatters that produce # "rich" output, resembling the original Gherkin document. - # - + ## class GherkinDocument < ::Cucumber::Messages::Message - ## # * # The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) # of the source, typically a file path relative to the root directory - + ## attr_reader :uri attr_reader :feature ## # All the comments in the Gherkin document - + ## attr_reader :comments def initialize( @@ -290,18 +282,13 @@ def initialize( end end - ## # Represents the Background message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Background < ::Cucumber::Messages::Message - ## # The location of the `Background` keyword - + ## attr_reader :location attr_reader :keyword @@ -331,24 +318,21 @@ def initialize( end end - ## # Represents the Comment message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A comment in a Gherkin document - # - + ## class Comment < ::Cucumber::Messages::Message - ## # The location of the comment - + ## attr_reader :location ## # The text of the comment - + ## attr_reader :text def initialize( @@ -360,15 +344,10 @@ def initialize( end end - ## # Represents the DataTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class DataTable < ::Cucumber::Messages::Message - attr_reader :location attr_reader :rows @@ -382,15 +361,10 @@ def initialize( end end - ## # Represents the DocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class DocString < ::Cucumber::Messages::Message - attr_reader :location attr_reader :media_type @@ -412,18 +386,13 @@ def initialize( end end - ## # Represents the Examples message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Examples < ::Cucumber::Messages::Message - ## # The location of the `Examples` keyword - + ## attr_reader :location attr_reader :tags @@ -461,48 +430,43 @@ def initialize( end end - ## # Represents the Feature message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Feature < ::Cucumber::Messages::Message - ## # The location of the `Feature` keyword - + ## attr_reader :location ## # All the tags placed above the `Feature` keyword - + ## attr_reader :tags ## # The [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document - + ## attr_reader :language ## # The text of the `Feature` keyword (in the language specified by `language`) - + ## attr_reader :keyword ## # The name of the feature (the text following the `keyword`) - + ## attr_reader :name ## # The line(s) underneath the line with the `keyword` that are used as description - + ## attr_reader :description ## # Zero or more children - + ## attr_reader :children def initialize( @@ -524,16 +488,13 @@ def initialize( end end - ## # Represents the FeatureChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A child node of a `Feature` node - # - + ## class FeatureChild < ::Cucumber::Messages::Message - attr_reader :rule attr_reader :background @@ -551,23 +512,18 @@ def initialize( end end - ## # Represents the Rule message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Rule < ::Cucumber::Messages::Message - ## # The location of the `Rule` keyword - + ## attr_reader :location ## # All the tags placed above the `Rule` keyword - + ## attr_reader :tags attr_reader :keyword @@ -599,16 +555,13 @@ def initialize( end end - ## # Represents the RuleChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A child node of a `Rule` node - # - + ## class RuleChild < ::Cucumber::Messages::Message - attr_reader :background attr_reader :scenario @@ -622,18 +575,13 @@ def initialize( end end - ## # Represents the Scenario message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Scenario < ::Cucumber::Messages::Message - ## # The location of the `Scenario` keyword - + ## attr_reader :location attr_reader :tags @@ -671,28 +619,25 @@ def initialize( end end - ## # Represents the Step message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # A step - # - + ## class Step < ::Cucumber::Messages::Message - ## # The location of the steps' `keyword` - + ## attr_reader :location ## # The actual keyword as it appeared in the source. - + ## attr_reader :keyword ## # The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then). Other keywords signal Continuation (And and But) from a prior keyword. Please note that all translations which a dialect maps to multiple keywords (`*` is in this category for all dialects), map to 'Unknown'. - + ## attr_reader :keyword_type attr_reader :text @@ -703,7 +648,7 @@ class Step < ::Cucumber::Messages::Message ## # Unique ID to be able to reference the Step from PickleStep - + ## attr_reader :id def initialize( @@ -725,23 +670,20 @@ def initialize( end end - ## # Represents the TableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # A cell in a `TableRow` - # - + ## class TableCell < ::Cucumber::Messages::Message - ## # The location of the cell - + ## attr_reader :location ## # The value of the cell - + ## attr_reader :value def initialize( @@ -753,23 +695,20 @@ def initialize( end end - ## # Represents the TableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # A row in a table - # - + ## class TableRow < ::Cucumber::Messages::Message - ## # The location of the first cell in the row - + ## attr_reader :location ## # Cells in the row - + ## attr_reader :cells attr_reader :id @@ -785,29 +724,26 @@ def initialize( end end - ## # Represents the Tag message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A tag - # - + ## class Tag < ::Cucumber::Messages::Message - ## # Location of the tag - + ## attr_reader :location ## # The name of the tag (including the leading `@`) - + ## attr_reader :name ## # Unique ID to be able to reference the Tag from PickleTag - + ## attr_reader :id def initialize( @@ -821,15 +757,10 @@ def initialize( end end - ## # Represents the Hook message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Hook < ::Cucumber::Messages::Message - attr_reader :id attr_reader :name @@ -851,16 +782,13 @@ def initialize( end end - ## # Represents the Location message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # Points to a line and a column in a text file - # - + ## class Location < ::Cucumber::Messages::Message - attr_reader :line attr_reader :column @@ -874,41 +802,38 @@ def initialize( end end - ## # Represents the Meta message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # This message contains meta information about the environment. Consumers can use # this for various purposes. - # - + ## class Meta < ::Cucumber::Messages::Message - ## # * # The [SEMVER](https://semver.org/) version number of the protocol - + ## attr_reader :protocol_version ## # SpecFlow, Cucumber-JVM, Cucumber.js, Cucumber-Ruby, Behat etc. - + ## attr_reader :implementation ## # Java, Ruby, Node.js etc - + ## attr_reader :runtime ## # Windows, Linux, MacOS etc - + ## attr_reader :os ## # 386, arm, amd64 etc - + ## attr_reader :cpu attr_reader :ci @@ -930,28 +855,25 @@ def initialize( end end - ## # Represents the Ci message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # CI environment - # - + ## class Ci < ::Cucumber::Messages::Message - ## # Name of the CI product, e.g. "Jenkins", "CircleCI" etc. - + ## attr_reader :name ## # Link to the build - + ## attr_reader :url ## # The build number. Some CI servers use non-numeric build numbers, which is why this is a string - + ## attr_reader :build_number attr_reader :git @@ -969,16 +891,13 @@ def initialize( end end - ## # Represents the Git message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # Information about Git, provided by the Build/CI server as environment # variables. - # - + ## class Git < ::Cucumber::Messages::Message - attr_reader :remote attr_reader :revision @@ -1000,23 +919,20 @@ def initialize( end end - ## # Represents the Product message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # Used to describe various properties of Meta - # - + ## class Product < ::Cucumber::Messages::Message - ## # The product name - + ## attr_reader :name ## # The product version - + ## attr_reader :version def initialize( @@ -1028,18 +944,13 @@ def initialize( end end - ## # Represents the ParameterType message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class ParameterType < ::Cucumber::Messages::Message - ## # The name is unique, so we don't need an id. - + ## attr_reader :name attr_reader :regular_expressions @@ -1069,15 +980,10 @@ def initialize( end end - ## # Represents the ParseError message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class ParseError < ::Cucumber::Messages::Message - attr_reader :source attr_reader :message @@ -1091,7 +997,6 @@ def initialize( end end - ## # Represents the Pickle message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -1108,41 +1013,39 @@ def initialize( # with the complex structure of a [GherkinDocument](#io.cucumber.messages.GherkinDocument). # # Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase` - # - + ## class Pickle < ::Cucumber::Messages::Message - ## # * # A unique id for the pickle - + ## attr_reader :id ## # The uri of the source file - + ## attr_reader :uri ## # The name of the pickle - + ## attr_reader :name ## # The language of the pickle - + ## attr_reader :language ## # One or more steps - + ## attr_reader :steps ## # * # One or more tags. If this pickle is constructed from a Gherkin document, # It includes inherited tags from the `Feature` as well. - + ## attr_reader :tags ## @@ -1150,7 +1053,7 @@ class Pickle < ::Cucumber::Messages::Message # Points to the AST node locations of the pickle. The last one represents the unique # id of the pickle. A pickle constructed from `Examples` will have the first # id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. - + ## attr_reader :ast_node_ids def initialize( @@ -1172,15 +1075,10 @@ def initialize( end end - ## # Represents the PickleDocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class PickleDocString < ::Cucumber::Messages::Message - attr_reader :media_type attr_reader :content @@ -1194,34 +1092,31 @@ def initialize( end end - ## # Represents the PickleStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # An executable step - # - + ## class PickleStep < ::Cucumber::Messages::Message - attr_reader :argument ## # References the IDs of the source of the step. For Gherkin, this can be # the ID of a Step, and possibly also the ID of a TableRow - + ## attr_reader :ast_node_ids ## # A unique ID for the PickleStep - + ## attr_reader :id ## # The context in which the step was specified: context (Given), action (When) or outcome (Then). # # Note that the keywords `But` and `And` inherit their meaning from prior steps and the `*` 'keyword' doesn't have specific meaning (hence Unknown) - + ## attr_reader :type attr_reader :text @@ -1241,15 +1136,12 @@ def initialize( end end - ## # Represents the PickleStepArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # An optional argument - # - + ## class PickleStepArgument < ::Cucumber::Messages::Message - attr_reader :doc_string attr_reader :data_table @@ -1263,15 +1155,10 @@ def initialize( end end - ## # Represents the PickleTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class PickleTable < ::Cucumber::Messages::Message - attr_reader :rows def initialize( @@ -1281,15 +1168,10 @@ def initialize( end end - ## # Represents the PickleTableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class PickleTableCell < ::Cucumber::Messages::Message - attr_reader :value def initialize( @@ -1299,15 +1181,10 @@ def initialize( end end - ## # Represents the PickleTableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class PickleTableRow < ::Cucumber::Messages::Message - attr_reader :cells def initialize( @@ -1317,21 +1194,18 @@ def initialize( end end - ## # Represents the PickleTag message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A tag - # - + ## class PickleTag < ::Cucumber::Messages::Message - attr_reader :name ## # Points to the AST node this was created from - + ## attr_reader :ast_node_id def initialize( @@ -1343,7 +1217,6 @@ def initialize( end end - ## # Represents the Source message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -1351,26 +1224,24 @@ def initialize( # # * # A source file, typically a Gherkin document or Java/Ruby/JavaScript source code - # - + ## class Source < ::Cucumber::Messages::Message - ## # * # The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) # of the source, typically a file path relative to the root directory - + ## attr_reader :uri ## # The contents of the file - + ## attr_reader :data ## # The media type of the file. Can be used to specify custom types, such as # text/x.cucumber.gherkin+plain - + ## attr_reader :media_type def initialize( @@ -1384,17 +1255,14 @@ def initialize( end end - ## # Represents the SourceReference message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a # [Location](#io.cucumber.messages.Location) within that file. - # - + ## class SourceReference < ::Cucumber::Messages::Message - attr_reader :uri attr_reader :java_method @@ -1416,15 +1284,10 @@ def initialize( end end - ## # Represents the JavaMethod message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class JavaMethod < ::Cucumber::Messages::Message - attr_reader :class_name attr_reader :method_name @@ -1442,15 +1305,10 @@ def initialize( end end - ## # Represents the JavaStackTraceElement message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class JavaStackTraceElement < ::Cucumber::Messages::Message - attr_reader :class_name attr_reader :file_name @@ -1468,15 +1326,10 @@ def initialize( end end - ## # Represents the StepDefinition message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class StepDefinition < ::Cucumber::Messages::Message - attr_reader :id attr_reader :pattern @@ -1494,15 +1347,10 @@ def initialize( end end - ## # Represents the StepDefinitionPattern message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class StepDefinitionPattern < ::Cucumber::Messages::Message - attr_reader :source attr_reader :type @@ -1516,7 +1364,6 @@ def initialize( end end - ## # Represents the TestCase message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -1524,15 +1371,13 @@ def initialize( # # * # A `TestCase` contains a sequence of `TestStep`s. - # - + ## class TestCase < ::Cucumber::Messages::Message - attr_reader :id ## # The ID of the `Pickle` this `TestCase` is derived from. - + ## attr_reader :pickle_id attr_reader :test_steps @@ -1548,15 +1393,10 @@ def initialize( end end - ## # Represents the Group message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Group < ::Cucumber::Messages::Message - attr_reader :children attr_reader :start @@ -1574,7 +1414,6 @@ def initialize( end end - ## # Represents the StepMatchArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # @@ -1585,15 +1424,13 @@ def initialize( # - Highlight the matched parameter in rich formatters such as the HTML formatter # # This message closely matches the `Argument` class in the `cucumber-expressions` library. - # - + ## class StepMatchArgument < ::Cucumber::Messages::Message - ## # * # Represents the outermost capture group of an argument. This message closely matches the # `Group` class in the `cucumber-expressions` library. - + ## attr_reader :group attr_reader :parameter_type_name @@ -1607,15 +1444,10 @@ def initialize( end end - ## # Represents the StepMatchArgumentsList message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class StepMatchArgumentsList < ::Cucumber::Messages::Message - attr_reader :step_match_arguments def initialize( @@ -1625,39 +1457,36 @@ def initialize( end end - ## # Represents the TestStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. # # * # A `TestStep` is derived from either a `PickleStep` # combined with a `StepDefinition`, or from a `Hook`. - # - + ## class TestStep < ::Cucumber::Messages::Message - ## # Pointer to the `Hook` (if derived from a Hook) - + ## attr_reader :hook_id attr_reader :id ## # Pointer to the `PickleStep` (if derived from a `PickleStep`) - + ## attr_reader :pickle_step_id ## # Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`) - + ## attr_reader :step_definition_ids ## # A list of list of StepMatchArgument (if derived from a `PickleStep`). # Each element represents a matching step definition. A size of 0 means `UNDEFINED`, # and a size of 2+ means `AMBIGUOUS` - + ## attr_reader :step_match_arguments_lists def initialize( @@ -1675,15 +1504,10 @@ def initialize( end end - ## # Represents the TestCaseFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestCaseFinished < ::Cucumber::Messages::Message - attr_reader :test_case_started_id attr_reader :timestamp @@ -1701,34 +1525,29 @@ def initialize( end end - ## # Represents the TestCaseStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestCaseStarted < ::Cucumber::Messages::Message - ## # * # The first attempt should have value 0, and for each retry the value # should increase by 1. - + ## attr_reader :attempt ## # * # Because a `TestCase` can be run multiple times (in case of a retry), # we use this field to group messages relating to the same attempt. - + ## attr_reader :id attr_reader :test_case_id ## # An identifier for the worker process running this test case, if test cases are being run in parallel. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it's not human readable. - + ## attr_reader :worker_id attr_reader :timestamp @@ -1748,33 +1567,28 @@ def initialize( end end - ## # Represents the TestRunFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestRunFinished < ::Cucumber::Messages::Message - ## # An informative message about the test run. Typically additional information about failure, but not necessarily. - + ## attr_reader :message ## # A test run is successful if all steps are either passed or skipped, all before/after hooks passed and no other exceptions where thrown. - + ## attr_reader :success ## # Timestamp when the TestRun is finished - + ## attr_reader :timestamp ## # Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps. - + ## attr_reader :exception def initialize( @@ -1790,15 +1604,10 @@ def initialize( end end - ## # Represents the TestRunStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestRunStarted < ::Cucumber::Messages::Message - attr_reader :timestamp def initialize( @@ -1808,15 +1617,10 @@ def initialize( end end - ## # Represents the TestStepFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestStepFinished < ::Cucumber::Messages::Message - attr_reader :test_case_started_id attr_reader :test_step_id @@ -1838,27 +1642,22 @@ def initialize( end end - ## # Represents the TestStepResult message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestStepResult < ::Cucumber::Messages::Message - attr_reader :duration ## # An arbitrary bit of information that explains this result. This can be a stack trace of anything else. - + ## attr_reader :message attr_reader :status ## # Exception thrown while executing this step, if any. - + ## attr_reader :exception def initialize( @@ -1874,15 +1673,10 @@ def initialize( end end - ## # Represents the TestStepStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class TestStepStarted < ::Cucumber::Messages::Message - attr_reader :test_case_started_id attr_reader :test_step_id @@ -1900,20 +1694,15 @@ def initialize( end end - ## # Represents the Timestamp message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class Timestamp < ::Cucumber::Messages::Message - ## # Represents seconds of UTC time since Unix epoch # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to # 9999-12-31T23:59:59Z inclusive. - + ## attr_reader :seconds ## @@ -1921,7 +1710,7 @@ class Timestamp < ::Cucumber::Messages::Message # second values with fractions must still have non-negative nanos values # that count forward in time. Must be from 0 to 999,999,999 # inclusive. - + ## attr_reader :nanos def initialize( @@ -1933,15 +1722,10 @@ def initialize( end end - ## # Represents the UndefinedParameterType message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. - # - - # - + ## class UndefinedParameterType < ::Cucumber::Messages::Message - attr_reader :expression attr_reader :name @@ -1954,7 +1738,6 @@ def initialize( @name = name end end - end end @@ -1997,4 +1780,3 @@ class Cucumber::Messages::TestStepResultStatus AMBIGUOUS = 'AMBIGUOUS' FAILED = 'FAILED' end - diff --git a/ruby/lib/cucumber/messages/message.rb b/ruby/lib/cucumber/messages/message.rb index e6c1e305..cdb79382 100644 --- a/ruby/lib/cucumber/messages/message.rb +++ b/ruby/lib/cucumber/messages/message.rb @@ -8,4 +8,4 @@ class Message include Cucumber::Messages::Message::Serialization end end -end \ No newline at end of file +end diff --git a/ruby/lib/cucumber/messages/message/deserialization.rb b/ruby/lib/cucumber/messages/message/deserialization.rb index 9b01e579..4a581f72 100644 --- a/ruby/lib/cucumber/messages/message/deserialization.rb +++ b/ruby/lib/cucumber/messages/message/deserialization.rb @@ -12,7 +12,6 @@ def self.included(other) end module ClassMethods - ## # Returns a new Message - or messages into an array - deserialized from the given json document. # CamelCased keys are properly converted to snake_cased attributes in the process @@ -27,8 +26,7 @@ module ClassMethods # # json_string = { uri: 'file:///...', comments: [{text: 'text comment'}, {text: 'another comment'}]}.to_json # Cucumber::Messages::GherkinDocument.from_json(json_string) # => #]> - # - + ## def from_json(json_string) from_h(JSON.parse(json_string, { symbolize_names: true })) end @@ -36,4 +34,4 @@ def from_json(json_string) end end end -end \ No newline at end of file +end diff --git a/ruby/lib/cucumber/messages/message/serialization.rb b/ruby/lib/cucumber/messages/message/serialization.rb index ca08ff05..208dbc37 100644 --- a/ruby/lib/cucumber/messages/message/serialization.rb +++ b/ruby/lib/cucumber/messages/message/serialization.rb @@ -7,7 +7,6 @@ class Message include Cucumber::Messages::Message::Utils module Serialization - ## # Returns a new Hash formed from the message attributes # If +camelize:+ keyword parameter is set to true, then keys will be camelized @@ -21,8 +20,7 @@ module Serialization # # location = Cucumber::Messages::Location.new(line: 2) # Cucumber::Messages::Comment.new(location: location, text: 'comment').to_h # => { location: { line: 2, :column: nil }, text: "comment" } - # - + ## def to_h(camelize: false, reject_nil_values: false) resulting_hash = self.instance_variables.map do |variable_name| h_key = variable_name[1..-1] @@ -53,8 +51,7 @@ def to_h(camelize: false, reject_nil_values: false) # # location = Cucumber::Messages::Location.new(line: 2) # Cucumber::Messages::Comment.new(location: location, text: 'comment').to_json # => '{"location":{"line":2,"column":null},"text":"comment"}' - # - + ## def to_json to_h(camelize: true, reject_nil_values: true).to_json end diff --git a/ruby/lib/cucumber/messages/message/utils.rb b/ruby/lib/cucumber/messages/message/utils.rb index 3091c2c9..341507bb 100644 --- a/ruby/lib/cucumber/messages/message/utils.rb +++ b/ruby/lib/cucumber/messages/message/utils.rb @@ -7,7 +7,6 @@ def self.included(other) end module ClassMethods - ## # Makes an underscored, lowercase form from the expression in the string. # @@ -15,7 +14,7 @@ module ClassMethods # # This is a simplified version of the Ruby on Rails implementation # https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L92 - + ## def underscore(term) return term unless /[A-Z-]/.match?(term) @@ -33,7 +32,7 @@ def underscore(term) # # This is a simplified version of the Ruby on Rails implementation # https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L69 - + ## def camelize(term) camelized = term.to_s camelized.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" } @@ -43,4 +42,4 @@ def camelize(term) end end end -end \ No newline at end of file +end diff --git a/ruby/scripts/update-gemspec b/ruby/scripts/update-gemspec deleted file mode 100755 index d45401fd..00000000 --- a/ruby/scripts/update-gemspec +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# -# Updates the *.gemspec in the current directory to use the latest releases of gems -# -set -uf -o pipefail -IFS=$'\n' - -gemspec=$(find . -maxdepth 1 -type f -name "*.gemspec") -if [ "${gemspec}" = "" ]; then - exit 0 -fi -add_dependency_lines=$(cat ${gemspec} | grep "s.add_[a-z_]*dependency '[^']*'") -if [ $? -ne 0 ]; then - # No add_dependency_lines found - nothing to do - exit 0 -fi - -set -e - -gems=$(echo "${add_dependency_lines}" | tr -s ' ' | cut -d ' ' -f3 | cut -d"'" -f 2) -while read -r gem; do - echo "upgrading ${gem}" - if [ "${gem}" = "bundler" ]; then - cat "${gemspec}" | sed "s/\(s.add_[a-z_]*dependency\) '${gem}'.*/\1 '${gem}', '>= 1.16.2'/" > ${gemspec}.tmp - else - gem_line=$(gem list "${gem}" --remote --all --no-prerelease | grep "^${gem}\s") - latest_patch_version=$(echo "${gem_line}" | cut -d'(' -f2 | cut -d')' -f1 | cut -d',' -f1 | cut -d' ' -f1) - latest_minor_version=$(echo "${latest_patch_version}" | cut -d. -f1,2) - cat "${gemspec}" | sed "s/\(s.add_[a-z_]*dependency\) '${gem}'.*/\1 '${gem}', '~> ${latest_minor_version}', '>= ${latest_patch_version}'/" > ${gemspec}.tmp - fi - mv ${gemspec}.tmp ${gemspec} -done <<< "${gems}" diff --git a/ruby/spec/capture_warnings.rb b/ruby/spec/capture_warnings.rb deleted file mode 100644 index 2315009d..00000000 --- a/ruby/spec/capture_warnings.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true -# With thanks to @myronmarston -# https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb - -module CaptureWarnings - def report_warnings(&block) - current_dir = Dir.pwd - warnings, errors = capture_error(&block).partition { |line| line.include?('warning') } - project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) } - - if errors.any? - puts errors.join("\n") - end - - if other_warnings.any? - puts "#{ other_warnings.count } warnings detected, set VIEW_OTHER_WARNINGS=true to see them." - print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS'] - end - - # Until they fix https://bugs.ruby-lang.org/issues/10661 - if RUBY_VERSION == "2.2.0" - project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ } - end - - if project_warnings.any? - puts "#{ project_warnings.count } warnings detected" - print_warnings('cucumber-expressions', project_warnings) - fail "Please remove all cucumber-expressions warnings." - end - - ensure_system_exit_if_required - end - - def capture_error(&block) - old_stderr = STDERR.clone - pipe_r, pipe_w = IO.pipe - pipe_r.sync = true - error = String.new - reader = Thread.new do - begin - loop do - error << pipe_r.readpartial(1024) - end - rescue EOFError - end - end - STDERR.reopen(pipe_w) - block.call - ensure - capture_system_exit - STDERR.reopen(old_stderr) - pipe_w.close - reader.join - return error.split("\n") - end - - def print_warnings(type, warnings) - puts - puts "-" * 30 + " #{type} warnings: " + "-" * 30 - puts - puts warnings.join("\n") - puts - puts "-" * 75 - puts - end - - def ensure_system_exit_if_required - raise @system_exit if @system_exit - end - - def capture_system_exit - @system_exit = $! - end -end