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

Add Swift Package comparator #74

Merged
merged 1 commit into from
Jan 16, 2021

Conversation

kwridan
Copy link
Contributor

@kwridan kwridan commented Dec 28, 2020

Issue number of the reported bug or feature request: #24

Describe your changes

  • Added a new comparator to check for Swift Package differences
  • Additionally, the linked dependencies comparator has been updated to accomodate package products references

Testing performed

  • Ran swift run xcdiff -v within Fixtures/ios_project_with_swift_packages
  • Verified the results include Swift Package comparison results

Screenshot 2020-12-28 at 13 03 04

Comment on lines +39 to +41
• ComposableArchitecture package reference
◦ version = .upToNextMajorVersion(0.9.0)
◦ version = .upToNextMinorVersion(0.9.0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is potentially some redundancy here as the same information can be seen within SWIFT_PACKAGES section. The reason I opted for adding it is to cater for the scenario where a package product doesn't have a source package specified (e.g. like the Swifter example below) and that can only be highlighted here as it's a difference at the linked dependency level.

Comment on lines +84 to +87
def substitute_project_paths(arg):
dirname = os.path.dirname(sys.argv[0])
fixtures_path = os.path.join(dirname, "../Fixtures")
return re.sub("{(.*)}", "{}/\\1/Project.xcodeproj".format(fixtures_path), arg)
Copy link
Contributor Author

@kwridan kwridan Dec 28, 2020

Choose a reason for hiding this comment

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

this should allow us to add new fixtures without needing to modify the python script each time

@codecov
Copy link

codecov bot commented Dec 28, 2020

Codecov Report

Merging #74 (d28897b) into main (d0994b7) will decrease coverage by 0.08%.
The diff coverage is 94.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
- Coverage   96.21%   96.13%   -0.09%     
==========================================
  Files          45       47       +2     
  Lines        1718     1809      +91     
==========================================
+ Hits         1653     1739      +86     
- Misses         65       70       +5     
Impacted Files Coverage Δ
...es/XCDiffCore/Library/Collections+Extensions.swift 100.00% <ø> (ø)
...e/Library/Descriptors/SwiftPackageDescriptor.swift 89.47% <89.47%> (ø)
...Core/Comparator/LinkedDependenciesComparator.swift 91.66% <91.66%> (-0.34%) ⬇️
Sources/XCDiffCore/Library/TargetsHelper.swift 92.98% <93.75%> (+0.12%) ⬆️
...CDiffCore/Comparator/SwiftPackagesComparator.swift 96.42% <96.42%> (ø)
Sources/XCDiffCore/ComparatorType.swift 100.00% <100.00%> (ø)
Sources/XCDiffCore/Library/PBX+Extensions.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0994b7...d28897b. Read the comment docs.

@kwridan kwridan linked an issue Dec 28, 2020 that may be closed by this pull request
@kwridan
Copy link
Contributor Author

kwridan commented Jan 6, 2021

Merging #74 (f23a52e) into main (c8c28f4) will decrease coverage by 0.25%.

Can we relax codcov :) ? failing the PR for <1% coverage decrease maybe a bit overkill :(

@marciniwanicki
Copy link
Contributor

:-) sure, feel free to update the threshold or add a simple UT for XCRemoteSwiftPackageReference.VersionRequirement to add few %s. Both options are 👍

marciniwanicki
marciniwanicki previously approved these changes Jan 7, 2021
Copy link
Contributor

@marciniwanicki marciniwanicki left a comment

Choose a reason for hiding this comment

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

The comparator is great 👍

import XCTest

final class SwiftPackageDescriptorTests: XCTestCase {
// swiftlint:disable line_length
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can re-enable the rule in the end of the tests (// swiftlint:enable line_length), or break the lines?

- Added a new comparator to check for Swift Package differences
- Additionally, the linked dependencies comparator has been updated to accomodate package products references

Test Plan

- Run `swift run xcdiff -v` within `Fixtures/ios_project_with_swift_packages`
- Verify the results include Swift Package comparison results

Signed-off-by: Kassem Wridan <kwridan@bloomberg.net>
@kwridan kwridan marked this pull request as ready for review January 16, 2021 10:06
@kwridan kwridan merged commit 7a1e8a9 into bloomberg:main Jan 16, 2021
@kwridan kwridan deleted the feature/swift-packages branch January 16, 2021 13:20
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.

Add Swift Package comparator
2 participants