Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

[Swift] Implement support for llvm-cov json exporter #431

@valeriomazzeo

Description

@valeriomazzeo

swift package generate-xcodeproj is deprecated and will soon be removed.

This means that the preferred way to generate code coverage for projects that only supports Swift SPM going forward, will be to use:

swift test --enable-code-coverage

The above command generates a codecov directory with a *.profdata file and a JSON with the code coverage information in the following format https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-cov/CoverageExporterJson.cpp.

Although codecov-bash could use *.profdata to build a txt report. It fails because it expects *.xctests file to be available in the same directory as *.profdata; this is the case when using Xcode but not when using swift tests - in the latter *.xctests files are in the directory one level above.

codecov-bash could be modified to find the proper input files when using SPM and generate the txt coverage file as usual. Although, it's a redundant operation since the code coverage file has already been exported in JSON; it would make more sense then to just allow codecov-bash to find and parse this file directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions