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 CI for Swift Package Manager #33

Merged
merged 39 commits into from
Apr 12, 2024
Merged

Fix CI for Swift Package Manager #33

merged 39 commits into from
Apr 12, 2024

Conversation

Patrick-Kladek
Copy link
Contributor

@Patrick-Kladek Patrick-Kladek commented Apr 4, 2024

Creating a PR here in hopes the CI will run.

This PR was done to finalize the work from #24. As the original Author is not responding we continue the official discussion here.

@Patrick-Kladek Patrick-Kladek changed the title Fix CI for Swift Package Manager #1 Fix CI for Swift Package Manager Apr 4, 2024
Copy link
Contributor

@StephanPartzsch StephanPartzsch left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the work :)

MapboxNavigation/Dictionary.swift Outdated Show resolved Hide resolved
MapboxCoreNavigationTests/Heading.swift Outdated Show resolved Hide resolved
MapboxNavigation/Constants.swift Outdated Show resolved Hide resolved
MapboxNavigation/CarPlayNavigationViewController.swift Outdated Show resolved Hide resolved
MapboxCoreNavigationTests/MD5Tests.swift Outdated Show resolved Hide resolved
@Patrick-Kladek
Copy link
Contributor Author

@StephanPartzsch thank you for the review.

I've noticed a lot of code style issues and wanted to ask if you use a code formatter? I started using SwiftFormat, configured it to reformat on commit automatically and it worked flawlessly for over 2 months now.

Would you accept this change, if I add it? I would let it configure itself from the current code style at first, and then tweak the settings if needed.

@StephanPartzsch
Copy link
Contributor

@Patrick-Kladek

At the moment there is no formatter configuration in the codebase, but it is a good idea to add one. This helps us having a consistent code style.
Please use the indention level as it is used in the majority of files of this codebase.

@Patrick-Kladek
Copy link
Contributor Author

I've also noticed there is a .swiftlint file in the repo, however, we are currently not using it.

As adding these tools will introduce a huge amount of changes, I'll create a new PR from this branch, add SwiftFormat, also enable SwiftLint, and fix all the errors/warnings found by the tools. Once we can ensure a consistent code style we can go ahead and finalize this PR.

@boldtrn
Copy link
Collaborator

boldtrn commented Apr 11, 2024

Yes I agree, let's do reformatting of the whole codebase in a separate PR. IMHO anything that we can automate and follows more or less the default XCode formatting is fine by me. Let's do one big reformatting PR and push this through to avoid too many conflicts.

@StephanPartzsch
Copy link
Contributor

Having two separate PR is fine.
We can finalize this one and add SwiftLint and swiftformat in a later PR as it will change the indention issues of this PR anyways. Or you can do it by hand for now @Patrick-Kladek . The number of issues wasn't that huge ;)

@Patrick-Kladek
Copy link
Contributor Author

@StephanPartzsch I guess with identiation style you meant to use spaces instead of tabs. I've fixed all issues you pointed out, please review again. In the meantime, I'll continue on the code formatting PR so issues like this are a thing of the past.

@Patrick-Kladek
Copy link
Contributor Author

Hi everyone, I've prepared another PR https://github.com/Patrick-Kladek/maplibre-navigation-ios/pull/2 to ensure consistent code style by auto formatting. Can you please take a first look at the style so we can discuss styling there further.

I'm not able to create a PR in repository as its base branch is in my Repo, I can only do that after this PR is merged.

@StephanPartzsch
Copy link
Contributor

LGTM

@Patrick-Kladek Patrick-Kladek marked this pull request as ready for review April 11, 2024 18:40
@Patrick-Kladek
Copy link
Contributor Author

@boldtrn can you please review it as well and merge it

@boldtrn
Copy link
Collaborator

boldtrn commented Apr 12, 2024

I think it is very unfortunate that we are loosing the examples with this change, maybe we can setup a second repo with the examples or something like this as a followup?

@@ -197,7 +197,7 @@ public class CarPlayNavigationViewController: UIViewController, MLNMapViewDelega
let location = notification.userInfo![RouteControllerNotificationUserInfoKey.locationKey] as! CLLocation

// Update the user puck
let camera = MLNMapCamera(lookingAtCenter: location.coordinate, fromDistance: 120, pitch: 60, heading: location.course)
let camera = MLNMapCamera(lookingAtCenter: location.coordinate, acrossDistance: 120, pitch: 60, heading: location.course)
Copy link
Collaborator

Choose a reason for hiding this comment

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

While I don't mind this change, it is a bit weird, that this is here. Is this intentional? Why is this changed? This seems to be unrelated to SPM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the warning I got and thats why I changed it:

'init(lookingAtCenter:fromDistance:pitch:heading:)' is deprecated: Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:.

Bildschirmfoto 2024-04-12 um 13 31 01

arrow.lineWidth = NSExpression(forMLNInterpolating: .zoomLevelVariable,
curveType: .linear,
parameters: nil,
stops: NSExpression(forConstantValue: MLNRouteLineWidthByZoomLevel.multiplied(by: 0.7)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah ok, this is about #6?

If it works, I am fine with it, but in general I think we should try to limit PRs to one issue/topic as this is hidden between the SPM changes.

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 this is related to the errors logged to console. I don't feel comfortable releasing an app to our customers when I see errors. I could verify after the changes these errors are not printed anymore and navigation seems to work fine

Copy link
Collaborator

@boldtrn boldtrn left a comment

Choose a reason for hiding this comment

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

Thanks a lot for working on this PR and the effort that went into it, also from @MaartenZonneveld 👍

I am not a fan of the hidden changes here and there. It's nothing major and if you made sure they work, I am fine with merging this as it is. I guess there might be some other issues hidden that we only find in integration testing later on, so let's merge this and fix stuff that might be wrong further down the line.

@boldtrn boldtrn mentioned this pull request Apr 12, 2024
@Patrick-Kladek
Copy link
Contributor Author

I am not a fan of the hidden changes here and there.

I rather fix small issues right away instead of opening up a discussion, and then spending 90% of time managing a one line change, that then drags on for days.

Retroactively speaking this could be the wrong approach here, so thanks for catching that. I'll try to limit the scope of my changes per PR from now on.

Do you want me to revert the NSExpression change and submit it in a new PR?

@boldtrn
Copy link
Collaborator

boldtrn commented Apr 12, 2024

Retroactively speaking this could be the wrong approach here, so thanks for catching that. I'll try to limit the scope of my changes per PR from now on.

Fixing a few small bugs in PR is fine I guess, but fixing a small bug in 300 file change PR that is about something specific, doesn't feel right. If something breaks I tend to look at the commit history and look at the commits that sound related first.

Do you want me to revert the NSExpression change and submit it in a new PR?

Just for the future, if you verified that it works as expected, let's go ahead 👍

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