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

fix: Allow compilation with code coverage enabled for XCode/SPM projects #398

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

lalunamel
Copy link
Contributor

@lalunamel lalunamel commented Apr 25, 2022

Summary

When building Amplitude as a Swift Package Manager dependency
for an XCode project with code coverage enabled
(https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/07-code_coverage.html),
the build fails.

It fails with an error

Undefined symbols for architecture x86_64:
"___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in Amplitude.o

You can resolve this error by passing the -fprofile-instr-generate flag
to clang (https://clang.llvm.org/docs/SourceBasedCodeCoverage.html).

Unfortunately, this flag must be passed to the Amplitude dependency directly
(rather than being applied to the project that relies on Amplitude, e.g.)

That is what this PR does.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@lalunamel lalunamel changed the title Compile with code coverage enabled fix: Allow compilation with code coverage enabled for XCode/SPM projects Apr 25, 2022
When building Amplitude as a Swift Package Manager dependency
for an XCode project with code coverage enabled
(https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/07-code_coverage.html),
the build fails.

It fails with an error
```
Undefined symbols for architecture x86_64:
"___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in Amplitude.o
```

You can resolve this error by passing the `-fprofile-instr-generate` flag
to clang (https://clang.llvm.org/docs/SourceBasedCodeCoverage.html).

Unfortunately, this flag must be passed to the Amplitude dependency directly
(rather than being applied to the project that relies on Amplitude, e.g.)

That is what this commit does.
@qingzhuozhen qingzhuozhen merged commit 55ee555 into amplitude:main Apr 28, 2022
@github-actions
Copy link

🎉 This PR is included in version 8.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

liuyang1520 added a commit that referenced this pull request Jun 21, 2022
liuyang1520 added a commit that referenced this pull request Jun 21, 2022
github-actions bot pushed a commit that referenced this pull request Jun 21, 2022
## [8.10.2](v8.10.1...v8.10.2) (2022-06-21)

### Reverts

* Revert "Compile with code coverage enabled (#398)" (#402) ([bd00ae5](bd00ae5)), closes [#398](#398) [#402](#402)
junjie added a commit to junjie/Amplitude-iOS that referenced this pull request Sep 6, 2022
…entify-object

* commit 'f07749967fb8e628f9f2c743fab2ba6600574d85':
  chore(release): 8.12.0 [skip ci]
  feat: expose more function signature for logEvent (amplitude#409)
  chore: use the reusable workflow to create jira issue (amplitude#408)
  chore(release): 8.11.1 [skip ci]
  fix: turn requiringSecureCoding on, adjust the available version (amplitude#407)
  chore(release): 8.11.0 [skip ci]
  fix: deprecation fix (amplitude#404)
  feat: add EU SSL pinning cert, extent it to support multiple domains (amplitude#403)
  chore(release): 8.10.2 [skip ci]
  Revert "Compile with code coverage enabled (amplitude#398)" (amplitude#402)
  chore(release): 8.10.1 [skip ci]
  fix: wrong carrier info with deprecated method (amplitude#400)
  Compile with code coverage enabled (amplitude#398)
  chore(release): 8.10.0 [skip ci]
  feat: Add versionId to tracking plan data (amplitude#392)
  chore(release): 8.9.0 [skip ci]
  fix: fix release action
  Update Podfile.lock
  feat: Add support on Swift Package Manager for WatchOS (amplitude#381)
  docs: add Ampli SDK reference (amplitude#385)

# Conflicts:
#	Sources/Amplitude/AMPURLSession.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants