Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 9 No product binary found #347

Closed
SvenMuc opened this issue Oct 8, 2017 · 9 comments
Closed

Xcode 9 No product binary found #347

SvenMuc opened this issue Oct 8, 2017 · 9 comments

Comments

@SvenMuc
Copy link

SvenMuc commented Oct 8, 2017

I'm using Xcode 9 and want to build and test my app by a terminal script in order to setup a local GitLab CI.

xcodebuild
xcodebuild test -project TargetShooter.xcodeproj -scheme TargetShooterTests_Debug -destination 'platform=iOS SImulator,name=iPhone 6s,OS=11.0' -enableCodeCoverage YES | xcpretty -c -s

Everything runs as expected. I'm using the same scheme for the Xcode Server to gather code coverage which works perfectly.

    ...
    ✓ testVarianceArrayDouble10Numbers (0.001 seconds)
    ✓ testVarianceArrayDouble10ZeroNumbers (0.001 seconds)
    ✓ testVarianceArrayDoubleNil (0.001 seconds)
    ✓ testVarianceArrayInt10EqualNumbers (0.001 seconds)
    ✓ testVarianceArrayInt10Numbers (0.001 seconds)
    ✓ testVarianceArrayInt10ZeroNumbers (0.001 seconds)
    ✓ testVarianceArrayIntNil (0.001 seconds)


	 Executed 175 tests, with 0 failures (0 unexpected) in 0.185 (0.311) seconds

Slather
slather coverage -s --scheme TargetShooterTests_Debug --verbose TargetShooter.xcodeproj

I always receive the following error:

Slathering...
No product binary found in /Users/Sven/Library/Developer/Xcode/DerivedData/TargetShooter-adwuwhyvmfikgjbvoxptvzsxseii/Build/Intermediates.noindex/../ProfileData/EA4291D2-59CD-4458-B911-A5268B7DFBBE.

	Are you sure your project is generating coverage? Make sure you enable code coverage in the Test section of your Xcode scheme.
	Did you specify your Xcode scheme? (--scheme or 'scheme' in .slather.yml)
	If you're using a workspace, did you specify it? (--workspace or 'workspace' in .slather.yml)
	If you use a different Xcode configuration, did you specify it? (--configuration or 'configuration' in .slather.yml)

/usr/local/lib/ruby/gems/2.4.0/gems/slather-2.4.3/lib/slather/project.rb:481:in `find_binary_files': No product binary found in /Users/Sven/Library/Developer/Xcode/DerivedData/TargetShooter-adwuwhyvmfikgjbvoxptvzsxseii/Build/Intermediates.noindex/../ProfileData/EA4291D2-59CD-4458-B911-A5268B7DFBBE. (StandardError)
	from /usr/local/lib/ruby/gems/2.4.0/gems/slather-2.4.3/lib/slather/project.rb:367:in `configure_binary_file'
	from /usr/local/lib/ruby/gems/2.4.0/gems/slather-2.4.3/lib/slather/project.rb:251:in `configure'
	from /usr/local/lib/ruby/gems/2.4.0/gems/slather-2.4.3/lib/slather/command/coverage_command.rb:54:in `execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/clamp-0.6.5/lib/clamp/subcommand/execution.rb:11:in `execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/slather-2.4.3/bin/slather:17:in `<top (required)>'
	from /usr/local/bin/slather:23:in `load'
	from /usr/local/bin/slather:23:in `<main>'

Any ideas what's going wrong?

@mikelupo
Copy link

mikelupo commented Oct 8, 2017 via email

@SvenMuc
Copy link
Author

SvenMuc commented Oct 8, 2017

And how do I identify the correct binary file path?
Sorry, I'm not so familiar with this.

@SvenMuc
Copy link
Author

SvenMuc commented Oct 8, 2017

By specifying the binary base name I receive the following error.

slather coverage -s --scheme TargetShooterTests_Debug --verbose --configuration Debug --binary-basename TargetShooter TargetShooter.xcodeproj/

Slathering...

Processing coverage file: /Users/Sven/Library/Developer/Xcode/DerivedData/TargetShooter-adwuwhyvmfikgjbvoxptvzsxseii/Build/ProfileData/EA4291D2-59CD-4458-B911-A5268B7DFBBE/Coverage.profdata
Against binary files:
	/Users/Sven/Library/Developer/Xcode/DerivedData/TargetShooter-adwuwhyvmfikgjbvoxptvzsxseii/Build/Products/Debug-iphoneos/TargetShooter.app/TargetShooter

error: /Users/Sven/Library/Developer/Xcode/DerivedData/TargetShooter-adwuwhyvmfikgjbvoxptvzsxseii/Build/Products/Debug-iphoneos/TargetShooter.app/TargetShooter: Failed to load coverage: No coverage data found
Test Coverage: NaN%
Slathered

@moveitonover
Copy link

@SvenMuc I'm getting the same error without passing the binary-basename, running --verbose I can see that the .profdata and the binary file can be found, but no coverage data found in the binary search path.

@vijayviswas
Copy link

@SvenMuc I have same issue and resolved it by specifying --build-directory which is your path to derivedData folder

@esyd1pi0
Copy link

@vijayviswas Can you please post the full command that is working for you? This is not working for me at the moment.

@SvenMuc
Copy link
Author

SvenMuc commented Oct 14, 2017

@esyd1pi0 I'm using the following commands. Works at least for me.

Xcode

XCODE_PROJECT:  "project_name.xcodeproj"
BINARY_BASENAME: "app_name"
BUILD_DIR: "build"

xcodebuild test -project $XCODE_PROJECT -scheme TargetShooterTests_Debug -destination 'platform=iOS Simulator,name=iPhone 6s,OS=11.0' -derivedDataPath $BUILD_DIR -enableCodeCoverage YES | xcpretty -s -c

Slather

slather coverage -s --scheme TargetShooterTests_Debug --binary-basename $BINARY_BASENAME --build-directory $BUILD_DIR $XCODE_PROJECT

@albertodebortoli
Copy link

Unfortunately none of these solutions work for me. Tried --build-directory with all the possible combinations of level of the derived data path. Have to say that I'm on Xcode 9.0. Still encountering the error @SvenMuc originally reported.

@SvenMuc
Copy link
Author

SvenMuc commented Oct 17, 2017

@albertodebortoli That's strange. I'm using Xcode 9.0 too. I just used --build-directory build. That's finally solved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants