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

Refactor project and add support for SPM #250

Merged
merged 8 commits into from
Sep 15, 2020
Merged

Refactor project and add support for SPM #250

merged 8 commits into from
Sep 15, 2020

Conversation

frederoni
Copy link
Contributor

Refactored the project to address the following issues

  • Added support for Swift Package Manager
  • Restructured folders to simplify SPM setup
  • Folded MapboxMobileEventsTests.xcodeproj into MapboxMobileEvents.xcodeproj for a more convenient development workflow using only one project file
  • Removed all shared schemes except MapboxMobileEvents to avoid confusion and speed up Carthage builds by a factor of 3x
  • Removed the static libMapboxMobileEvents scheme since it's no longer being used by gl-native
  • Removed the name header script since we are no longer dual-linking
  • Added codecov to CircleCI setup so Bitrise is no longer required

The SPM setup is running all XCTests
MapboxMobileEvents.xcodeproj is running all Cedar and XCTests

cc @alfwatt @nagineni @mr1sunshine

@frederoni frederoni force-pushed the fred/spm branch 8 times, most recently from 9a1e7e9 to 1b2e366 Compare September 14, 2020 15:57
@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2020

Codecov Report

Merging #250 into master will decrease coverage by 0.18%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #250      +/-   ##
==========================================
- Coverage   88.45%   88.27%   -0.19%     
==========================================
  Files          79       78       -1     
  Lines        5448     5414      -34     
==========================================
- Hits         4819     4779      -40     
- Misses        629      635       +6     

@@ -42,3 +46,10 @@ jobs:
command: |
if [ "<< parameters.xcode >>" = "12.0.0" ]; then export XCODE_XCCONFIG_FILE=~/project/xcode-12-fix.xcconfig; fi
Tests/Integration/test_carthage.sh
- when:
condition:
equal: [ "11.7.0", << parameters.xcode >> ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any problem with XCode 12 code coverage?

Copy link
Contributor Author

@frederoni frederoni Sep 15, 2020

Choose a reason for hiding this comment

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

Not that I know of but since Xcode 12 is still in beta and we run the same tests as with Xcode 11, I figured merging multiple reports would be excessive at this point.

@@ -21,7 +21,7 @@ Pod::Spec.new do |s|

# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.ios.deployment_target = "8.0"
s.ios.deployment_target = "9.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should have bump of minimum deployment target in the separate PR/commit?

Package.swift Outdated
let package = Package(
name: "MapboxMobileEvents",
platforms: [
.iOS(.v10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it matter which version of iOS we set here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good catch. Lowered to v9.

@@ -95,6 +95,7 @@ - (void) test004_ShortUpdateInterval {
XCTAssertNil(configError);
}

#if !SWIFT_PACKAGE
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the problem with that test? Worth adding a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Support for resources was added in Swift 5.3 but we currently only require 5.2. 5.2 is included in Xcode 11 and 5.3 in 12.

@@ -83,7 +83,8 @@ -(void)test002_checkCOMHashCount {
NSArray *comHashes = NSUserDefaults.mme_configuration.mme_certificatePinningConfig[@"events.mapbox.com"];
XCTAssert(comHashes.count == 4);
}


#if !SWIFT_PACKAGE
Copy link
Contributor

Choose a reason for hiding this comment

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

the same: should we add a comment on why we are commenting out?

@@ -75,6 +75,7 @@ - (void)testPausesWithWhenInUseAuthAndBackgrounded {
XCTAssert(self.eventsManager.paused == YES);
}

#if !SWIFT_PACKAGE
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here?

Copy link
Contributor

@mr1sunshine mr1sunshine left a comment

Choose a reason for hiding this comment

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

LGTM with a couple of comments about why we are disabling tests.

command: |
# xcodebuild will try to use the Package manifest if it cannot find a project
mkdir temp && mv MapboxMobileEvents.xcodeproj temp
xcodebuild -scheme MapboxMobileEvents test -destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to specify the platform value through the build parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, as a follow-up because then it should also propagate to CocoaPods and Carthage tests.

@frederoni frederoni merged commit bd78e9f into master Sep 15, 2020
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.

4 participants