Skip to content

ios: fix podspec for v0.2.0 support#577

Merged
rebello95 merged 5 commits intomasterfrom
fix-podspec
Nov 8, 2019
Merged

ios: fix podspec for v0.2.0 support#577
rebello95 merged 5 commits intomasterfrom
fix-podspec

Conversation

@rebello95
Copy link
Contributor

@rebello95 rebello95 commented Nov 5, 2019

Makes several updates to our podspec in order to fix CocoaPods integration with v0.2.0:

  • Link resolv.9 and c++ which is being done with Bazel today
  • Link SystemConfiguration which is being done with Bazel today
  • Specify Swift version and platform version
  • Specify source_files with an empty .swift file in order to ensure that Swift libraries are linked when building (i.e., swiftFoundation)

Important notes:
Releasing new versions of the pod requires the following manual changes:

  • Unzipping envoy_ios_framework.zip
  • Renaming the directory to envoy_ios_cocoapods
  • Creating an empty file at envoy_ios_cocoapods/Envoy.framework/Swift/Empty.swift. This forces CocoaPods to link Swift libraries as necessary. We worked around this in Bazel similarly in the past here
  • Copying the repo's LICENSE file and placing it at envoy_ios_cocoapods/LICENSE
  • Re-zipping envoy_ios_cocoapods and uploading envoy_ios_cocoapods.zip

In the future, we should see if this can be simplified or at the very least add a script that uploads this artifact with each commit to master just like we do with other artifacts. This is being tracked in #578.

Note: There is a similar problem reported in CocoaPods that requires this empty Swift file workaround: CocoaPods/CocoaPods#8649.

I tested this PR by using this podspec for building an app against Envoy Mobile with CocoaPods. This spec is currently published as v0.2.0.

Signed-off-by: Michael Rebello me@michaelrebello.com

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
@rebello95 rebello95 changed the title ios: update podspec ios: fix podspec for v0.2.0 support Nov 5, 2019
Signed-off-by: Michael Rebello <me@michaelrebello.com>
@rebello95 rebello95 marked this pull request as ready for review November 5, 2019 01:50
@rebello95 rebello95 requested a review from keith November 5, 2019 01:50
s.frameworks = 'SystemConfiguration'
s.source = { :http => "https://github.com/lyft/envoy-mobile/releases/download/v#{s.version}/envoy_ios_cocoapods.zip" }
s.vendored_frameworks = 'envoy_ios_cocoapods/Envoy.framework'
s.source_files = 'envoy_ios_cocoapods/Envoy.framework/Headers/*.h', 'envoy_ios_cocoapods/Envoy.framework/Swift/*.swift'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need source files since you're vendoring a framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this the framework fails pod spec lint because it's missing libSwiftFoundation, among other Swift libraries. I added some more explanations to the PR description - without this and manually adding a .swift file, the pod doesn't compile. Totally open to better ways to do this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a corresponding CocoaPods issue about this? Seems weird that no one else would have this case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from what I could tell, but I'm happy to file one. Assuming it's only an issue for mixed Objective-C/Swift libraries?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CP likely doesn't check that either way, but maybe you adding the swift_version was what broke it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting out swift_version and source_files yields the following errors:

   Testing with `xcodebuild`. 
 -> EnvoyMobile (0.2.0)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftFoundation'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftDarwin'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftCore'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftDispatch'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
    - NOTE  | xcodebuild:  ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
    - NOTE  | xcodebuild:  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind taking another look whenever you get a chance @keith?

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
@rebello95 rebello95 requested a review from keith November 5, 2019 06:00
Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a fine workaround, but it would be nice to open an issue upstream about it

@rebello95
Copy link
Contributor Author

Yep, agree. Looks like CocoaPods/CocoaPods#8649 is actually this problem and their workaround was also to include a .swift file. I'll link that issue in this commit

@rebello95 rebello95 merged commit aa16f8d into master Nov 8, 2019
@rebello95 rebello95 deleted the fix-podspec branch November 8, 2019 01:34
rebello95 added a commit that referenced this pull request Jan 7, 2020
Adds a job (run on merges to master) to upload an artifact that can be consumed by CocoaPods. This process requires the following steps (outlined in #577):

- Unzipping `envoy_ios_framework.zip`
- Renaming the directory to `envoy_ios_cocoapods`
- Creating an empty file at `envoy_ios_cocoapods/Envoy.framework/Swift/Empty.swift`. This forces CocoaPods to link Swift libraries as necessary. We worked around this in Bazel similarly in the past [here](94ada57#diff-6dc94efb18b54c46a32898ba3a5a0756R15)
- Copying the repo's `LICENSE` file and placing it at `envoy_ios_cocoapods/LICENSE`
- Re-zipping `envoy_ios_cocoapods` and uploading `envoy_ios_cocoapods.zip`

Tested and validated that the artifact was successfully uploaded in [this job](https://github.com/lyft/envoy-mobile/pull/621/checks?check_run_id=376906484).

Resolves #578.
jpsim pushed a commit to envoyproxy/envoy that referenced this pull request Nov 28, 2022
Adds a job (run on merges to master) to upload an artifact that can be consumed by CocoaPods. This process requires the following steps (outlined in envoyproxy/envoy-mobile#577):

- Unzipping `envoy_ios_framework.zip`
- Renaming the directory to `envoy_ios_cocoapods`
- Creating an empty file at `envoy_ios_cocoapods/Envoy.framework/Swift/Empty.swift`. This forces CocoaPods to link Swift libraries as necessary. We worked around this in Bazel similarly in the past [here](envoyproxy/envoy-mobile@b8216e4#diff-6dc94efb18b54c46a32898ba3a5a0756R15)
- Copying the repo's `LICENSE` file and placing it at `envoy_ios_cocoapods/LICENSE`
- Re-zipping `envoy_ios_cocoapods` and uploading `envoy_ios_cocoapods.zip`

Tested and validated that the artifact was successfully uploaded in [this job](https://github.com/lyft/envoy-mobile/pull/621/checks?check_run_id=376906484).

Resolves envoyproxy/envoy-mobile#578.

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this pull request Nov 29, 2022
Adds a job (run on merges to master) to upload an artifact that can be consumed by CocoaPods. This process requires the following steps (outlined in envoyproxy/envoy-mobile#577):

- Unzipping `envoy_ios_framework.zip`
- Renaming the directory to `envoy_ios_cocoapods`
- Creating an empty file at `envoy_ios_cocoapods/Envoy.framework/Swift/Empty.swift`. This forces CocoaPods to link Swift libraries as necessary. We worked around this in Bazel similarly in the past [here](envoyproxy/envoy-mobile@b8216e4#diff-6dc94efb18b54c46a32898ba3a5a0756R15)
- Copying the repo's `LICENSE` file and placing it at `envoy_ios_cocoapods/LICENSE`
- Re-zipping `envoy_ios_cocoapods` and uploading `envoy_ios_cocoapods.zip`

Tested and validated that the artifact was successfully uploaded in [this job](https://github.com/lyft/envoy-mobile/pull/621/checks?check_run_id=376906484).

Resolves envoyproxy/envoy-mobile#578.

Signed-off-by: JP Simard <jp@jpsim.com>
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

Successfully merging this pull request may close these issues.

2 participants