SlatherOrg / slather

Generate test coverage reports for Xcode projects & hook it into CI.
MIT License
1.55k stars 236 forks source link

Is it possible to use it without project configuration (`xcodeproj`)? #515

Open josecelano opened 2 years ago

josecelano commented 2 years ago

I'm trying to generate a coverage report for a Swift Package.

I'm currently generating the report with a command like this:

xcodebuild test \
    -scheme BokenEngine \
    -destination "platform=iOS Simulator,name=iPhone 11" \
    -enableCodeCoverage=YES \
    -derivedDataPath=.DeriveData
ld -r \
    -o ./CombinedObject.o .DeriveData/Build/Intermediates.noindex/BokenEngine.build/Debug-iphonesimulator/BokenEngine.build/Objects-normal/arm64/*.o
xcrun llvm-cov report \
    --format=text \
    --instr-profile=".DeriveData/Build/ProfileData/860AB2C1-6615-42E7-93A8-9067DF75E7BA/Coverage.profdata" \
    --object="./CombinedObject.o"

I tried to use Slather but I get this error:

% slather coverage -s --scheme BokenEngine --build-directory ".DerivedData" --binary-file "./CombinedObject.o"
Slathering...
/Users/josecelano/.rvm/gems/ruby-3.0.0/gems/slather-2.7.2/lib/slather/command/coverage_command.rb:110:in `project': Must provide an xcodeproj either via the 'slather [SUBCOMMAND] [PROJECT].xcodeproj' command or through .slather.yml (StandardError)
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/slather-2.7.2/lib/slather/command/coverage_command.rb:67:in `setup_build_directory'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/slather-2.7.2/lib/slather/command/coverage_command.rb:44:in `execute'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:140:in `run'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/gems/slather-2.7.2/bin/slather:17:in `<top (required)>'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/bin/slather:23:in `load'
    from /Users/josecelano/.rvm/gems/ruby-3.0.0/bin/slather:23:in `<main>'

Would it be possible to use Slather without any project configuration?

By the way, I was looking for a GitHub Action to run Slather but I have not found it.

colejd commented 2 years ago

I think this is a duplicate of #466. I'd love to see support for this added, myself.