Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SlatherOrg/slather
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.4.5
Choose a base ref
...
head repository: SlatherOrg/slather
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 1,726 additions and 202 deletions.
  1. +23 −6 .gitignore
  2. +4 −2 .travis.yml
  3. +193 −0 CHANGELOG.md
  4. +53 −3 README.md
  5. BIN README_Images/test_scheme.png
  6. +1 −1 assets/list.min.js
  7. +2 −1 assets/slather.css
  8. +1 −1 lib/cocoapods_plugin.rb
  9. +15 −14 lib/slather.rb
  10. +15 −1 lib/slather/command/coverage_command.rb
  11. +6 −0 lib/slather/command/setup_command.rb
  12. +16 −11 lib/slather/coverage_file.rb
  13. +9 −0 lib/slather/coverage_info.rb
  14. +1 −1 lib/slather/coverage_service/cobertura_xml_output.rb
  15. +129 −5 lib/slather/coverage_service/coveralls.rb
  16. +62 −6 lib/slather/coverage_service/html_output.rb
  17. +61 −0 lib/slather/coverage_service/sonarqube_xml_output.rb
  18. +75 −22 lib/slather/profdata_coverage_file.rb
  19. +174 −52 lib/slather/project.rb
  20. +1 −1 lib/slather/version.rb
  21. +16 −16 slather.gemspec
  22. +19 −0 spec/fixtures/FixtureFramework/FixtureFramework.h
  23. +7 −0 spec/fixtures/FixtureFramework/FlashExperiment.swift
  24. +24 −0 spec/fixtures/FixtureFramework/Info.plist
  25. +34 −0 spec/fixtures/FixtureFrameworkTests/FixtureFrameworkTests.swift
  26. +9 −0 spec/fixtures/FixtureFrameworkTests/FlashExperimentTests.swift
  27. +22 −0 spec/fixtures/FixtureFrameworkTests/Info.plist
  28. +158 −38 spec/fixtures/cobertura.xml
  29. +222 −0 spec/fixtures/fixtures.xcodeproj/project.pbxproj
  30. +21 −5 spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixtures.xcscheme
  31. +8 −0 spec/fixtures/fixtures.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  32. +93 −0 spec/fixtures/sonarqube-generic-coverage.xml
  33. +1 −1 spec/slather/cocoapods_plugin_spec.rb
  34. +1 −1 spec/slather/coverage_service/cobertura_xml_spec.rb
  35. +29 −0 spec/slather/coverage_service/coveralls_spec.rb
  36. +9 −1 spec/slather/coverage_service/hardcover_spec.rb
  37. +2 −2 spec/slather/coverage_service/html_output_spec.rb
  38. +1 −1 spec/slather/coverage_service/json_spec.rb
  39. +1 −1 spec/slather/coverage_service/llvm_cov_spec.rb
  40. +46 −0 spec/slather/coverage_service/sonarqube_xml_spec.rb
  41. +37 −0 spec/slather/profdata_coverage_spec.rb
  42. +124 −9 spec/slather/project_spec.rb
  43. +1 −0 spec/spec_helper.rb
29 changes: 23 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -20,6 +20,13 @@ tmp
*.o
*.a
mkmf.log
.vendor
.ruby-version
cobertura.xml
.gutter.json
html
*.gcda
*.gcno

# Xcode
#
@@ -39,11 +46,21 @@ DerivedData
*.ipa
*.xcuserstate
*.DS_Store
cobertura.xml
.gutter.json
html
*.gcda
*.gcno

# VSCode IDE
.vscode/
.rdbgrc*

# python
.venv/

# JetBrains IDE
.idea/
.idea/

# Test output
report.llcov
report.json

# VSCode
.vscode
.rdbgrc*
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
language: objective-c
script: bundle exec rake
osx_image: xcode9.2
osx_image: xcode12.2

cache: bundler

before_install:
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
- gem install bundler --no-ri --no-rdoc
- gem install bundler -v "~> 2.0" --no-document

install:
- bundle install --without=documentation
193 changes: 193 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,198 @@
# CHANGELOG

## v2.8.5

* Update xcodeproj to 1.27.1 to support Xcode 16 folder references
[authiatr](https://github.com/authiatr)
[#574](https://github.com/SlatherOrg/slather/pull/574)

## v2.8.4

* Don't crash when 0% coverage is causing empty JSON
[jarrodlombardo-EventBase](https://github.com/jarrodlombardo-EventBase)
[#570](https://github.com/SlatherOrg/slather/pull/570)

* Xcode 16 compatibility (as of beta 5)
[ksuther](https://github.com/ksuther)
[#568](https://github.com/SlatherOrg/slather/pull/568)

## v2.8.3

* Fix coverage_file.source_file_pathname
[alfredofernandes](https://github.com/alfredofernandes)
[#565](https://github.com/SlatherOrg/slather/pull/565)

* update cobertura DTD to a working URL.
[jarrodlombardo-EventBase](https://github.com/jarrodlombardo-EventBase)
[#564](https://github.com/SlatherOrg/slather/pull/564)

## v2.8.2

* coverage_info.include_files? needs a default true return value for when source_files is empty.
[jarrodlombardo-EventBase](https://github.com/jarrodlombardo-EventBase)
[#563](https://github.com/SlatherOrg/slather/pull/563)

## v2.8.1

* cobertura.sourceforge.net should use https instead of http
[jarrodlombardo-EventBase](https://github.com/jarrodlombardo-EventBase)
[#559](https://github.com/SlatherOrg/slather/pull/559)

* Handle include globs
[dnedrow](https://github.com/dnedrow)
[#553](https://github.com/SlatherOrg/slather/pull/553)

## v2.8.0

* Add `--ymlfile` option to override `.slather.yml`
[jarrodlombardo-EventBase](https://github.com/jarrodlombardo-EventBase)
[#550](https://github.com/SlatherOrg/slather/pull/550)

* Update list.js
[AndriiZakhliupanyi](https://github.com/AndriiZakhliupanyi)
[#546](https://github.com/SlatherOrg/slather/pull/546)

## v2.7.5

* Add `--cdn-assets` flag
[sushant-here](https://github.com/sushant-here)
[#537](https://github.com/SlatherOrg/slather/pull/537)

* Update nokogiri version

## v2.7.4

* Support Ruby 3.2.0
[crazymanish](https://github.com/crazymanish)
[#532](https://github.com/SlatherOrg/slather/pull/532)

## v2.7.3

* Support Coveralls parallel runs
[paulz](https://github.com/paulz)
[#523](https://github.com/SlatherOrg/slather/pull/523)

* Update nokogiri version
[anil291987](https://github.com/anil291987)
[#518](https://github.com/SlatherOrg/slather/pull/518)
[#524](https://github.com/SlatherOrg/slather/pull/524)

## v2.7.2

* Update xcodeproj version
[adamyanalunas](https://github.com/adamyanalunas)
[#502](https://github.com/SlatherOrg/slather/pull/502)

* Update nokogiri version
[jwelton](https://github.com/jwelton)
[#503](https://github.com/SlatherOrg/slather/pull/503)

* Support alternate CI systems in coveralls output
[fermoyadrop](https://github.com/fermoyadrop)
[#504](https://github.com/SlatherOrg/slather/pull/504)

* Add Bitrise support to coveralls output
[fermoyadrop](https://github.com/fermoyadrop)
[#504](https://github.com/SlatherOrg/slather/pull/505)

## v2.7.1

* Support generating coverage for framework targets
[onato](https://github.com/onato)
[#482](https://github.com/SlatherOrg/slather/pull/482)

* Show number of lines in HTML report
[SiemianHS](https://github.com/SiemianHS)
[#494](https://github.com/SlatherOrg/slather/pull/494)

* Fixed issues with HTML report generation
[fchiba](https://github.com/fchiba)
[#483](https://github.com/SlatherOrg/slather/pull/483)
[#484](https://github.com/SlatherOrg/slather/pull/484)

* Don't fail if a source file doesn't exist
[chillpop](https://github.com/chillpop)
[#492](https://github.com/SlatherOrg/slather/pull/492)

## v2.7.0

* Add Branch Coverage data for ProfData coverage files
[hborawski](https://github.com/hborawski)
[#477](https://github.com/SlatherOrg/slather/pull/477)

* Fixed 'Argument list too long' when running 'xcrun llvm-cov'
[samuelsainz](https://github.com/samuelsainz)
[#476](https://github.com/SlatherOrg/slather/pull/476)

## v2.6.1

* Update nokogiri to 1.11
[ashin-omg](https://github.com/ashin-omg)
[#473](https://github.com/SlatherOrg/slather/pull/473)

## v2.6.0

* Added GitHub actions support
[martin-key](https://github.com/martin-key), [troyfontaine](https://github.com/troyfontaine)
[#468](https://github.com/SlatherOrg/slather/pull/468)

## v2.5.0

* Fixed activesupport and cocoapods dependencies
[daneov](https://github.com/daneov)
[#456](https://github.com/SlatherOrg/slather/pull/467)

* Fixed typo in documentation
[descorp](https://github.com/descorp)
[#456](https://github.com/SlatherOrg/slather/pull/463)

## v2.4.9

* Added support for Sonarqube output
[adellibovi](https://github.com/adellibovi)
[#456](https://github.com/SlatherOrg/slather/pull/456)

## v2.4.8

* Optimize performance for many binaries
[cltnschlosser](https://github.com/cltnschlosser)
[#455](https://github.com/SlatherOrg/slather/pull/455)

* Don't generate line 0 in profdata_coverage_file.rb from line with error
[tthbalazs](https://github.com/tthbalazs)
[#449](https://github.com/SlatherOrg/slather/pull/449)

* coveralls dependency update
[GRiMe2D](https://github.com/GRiMe2D)
[#448](https://github.com/SlatherOrg/slather/pull/448)

## v2.4.7

* Update dependencies
[dnedrow](https://github.com/dnedrow)

* Fixed errors when llvm-cov argument length exceeds ARG_MAX
[weibel](https://github.com/weibel)
[#414](https://github.com/SlatherOrg/slather/pull/414)

* Show "No coverage directory found." instead of "implicit conversion nil into String"
[phimage](https://github.com/phimage)
[#381](https://github.com/SlatherOrg/slather/pull/381) [#341](https://github.com/SlatherOrg/slather/issues/341)

## v2.4.6

* Fix .dSYM and .swiftmodule files filtering in find_binary_files()
[krin-san](https://github.com/krin-san)
[#368](https://github.com/SlatherOrg/slather/pull/368)

* Fixed loading coverage for a single source file
[blackm00n](https://github.com/blackm00n)
[#377](https://github.com/SlatherOrg/slather/pull/377) [#398](https://github.com/SlatherOrg/slather/pull/398)

* Fixed truncated file list in HTML export
[miroslavkovac](https://github.com/miroslavkovac)
[#402](https://github.com/SlatherOrg/slather/pull/402) [#261](https://github.com/SlatherOrg/slather/issues/261)

## v2.4.5

* Support for specifying a specific binary architecture
56 changes: 53 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -67,14 +67,41 @@ If your configuration produces a universal binary you need to specify a specific
$ slather coverage -s --arch x86_64 --scheme YourXcodeSchemeName --configuration YourBuildConfigurationName path/to/project.xcodeproj
```

### For multiple modules

If you want to run some modules, but not all (like modules created by CocoaPods) you can do it like this:

```sh
$ slather coverage --binary-basename module1 --binary-basename module2 path/to/project.xcodeproj
```
You can also add it to the `.slather.yml` file as an array:
```yml
binary_basename:
- module1
- module2
```
### Setup for Xcode 5 and 6
Run this command to enable the `Generate Test Coverage` and `Instrument Program Flow` flags for your project:

```sh
$ slather setup path/to/project.xcodeproj
```
## General Usage Notes
### Commandline Arguments Win
When using both a config file (`.slather.yml`) and providing arguments via the commandline,
the arguments will take precedence over the matching setting in the config file.

### `ignore` always wins over `source-files`
When defining both files that should be ignored (`--ignore`, ignore) and source files to include (`--source-files`, source_files),
the ignore list is checked first. If the file being scanned matches a glob in the ignore list, it will not be included. In this case, the
source_file list is not checked.

If the file being scanned is not in the ignore list, and source_file has been defined, the source_file list is
checked. If the source file matches a glob, it will be included.

## CI Integration
### Usage with Codecov

Login to [Codecov](https://codecov.io/) (no need to activate a repository, this happens automatically). Right now, `slather` supports Codecov via **all** supported CI providers [listed here](https://github.com/codecov/codecov-bash#ci-providers).
@@ -120,13 +147,14 @@ test:

### Usage with Coveralls

Login to [Coveralls](https://coveralls.io/) and enable your repository. Right now, `slather` supports Coveralls via [Travis CI](https://travis-ci.org) and [CircleCI](https://circleci.com).
Login to [Coveralls](https://coveralls.io/) and enable your repository. Right now, `slather` supports Coveralls via [Travis CI](https://travis-ci.org), [CircleCI](https://circleci.com), [Jenkins](https://www.jenkins.io/), [Teamcity](https://www.jetbrains.com/teamcity/), [Buildkite](https://buildkite.com/), and [Bitrise](https://bitrise.io/).

Make a `.slather.yml` file:
Make a `.slather.yml` file and specify the CI Service you're using:

```yml
# .slather.yml
ci_service: circleci | travis_ci | travis_pro | jenkins | buildkite | teamcity
coverage_service: coveralls
xcodeproj: path/to/project.xcodeproj
scheme: YourXcodeSchemeName
@@ -135,7 +163,7 @@ ignore:
- ProjectTestsGroup/*
```

And then in your `.travis.yml` or `circle.yml`, call `slather` after a successful build:
And then in your `.travis.yml` or `circle.yml` or `github-action.yml`, call `slather` after a successful build:

```yml
# .travis.yml
@@ -154,6 +182,25 @@ test:
```

```yml
# github-action.yml
myjob:
steps:
- run: |
bundle config path vendor/bundle
bundle install --without=documentation --jobs 4 --retry 3
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch
- run: bundle exec slather
env:
GIT_BRANCH: ${{ steps.get_branch.outputs.branch }}
CI_PULL_REQUEST: ${{ github.event.number }}
COVERAGE_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

#### Usage with Travis CI Pro

To use Coveralls with Travis CI Pro (for private repos), add following lines along with other settings to `.slather.yml`:
@@ -200,6 +247,8 @@ $ slather coverage --html --scheme YourXcodeSchemeName path/to/project.xcodeproj

This will make a directory named `html` in your root directory (unless `--output-directory` is specified) and will generate all the reports as static html pages inside the directory. It will print out the report's path by default, but you can also specify `--show` flag to open it in your browser automatically.

By default, the generated HTML will reference locally hosted assets (js, css). You can specify the `--cdn-assets` to specify that you prefer for the generated HTML to use externally hosted assets. This can be useful if publishing the HTML file as a build artifact.

### TeamCity Reporting

To report the coverage statistics to TeamCity:
@@ -251,3 +300,4 @@ Please make sure to follow our general coding style and add test coverage for ne
* [@jhersh](https://github.com/jhersh), CircleCI support.
* [@tarbrain](https://github.com/tarbrain), Cobertura support and bugfixing.
* [@ikhsan](https://github.com/ikhsan), html support.
* [@martin-key](https://github.com/martin-key) and [@troyfontaine](https://github.com/troyfontaine), Github Actions support.
Binary file modified README_Images/test_scheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading