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

Include target attributes in the attributes comparator #86

Merged

Conversation

kwridan
Copy link
Contributor

@kwridan kwridan commented Jun 30, 2021

Resolves #62

Overview

  • Target attributes are now included in the comparison results of the attributes comparator
  • Each target will now have a dedicated comparison result

e.g.

❌ ATTRIBUTES > "MyTarget" target

⚠️  Only in second (1):

  • LastSwiftMigration = 1110
  • Target attributes may contain references to other targets, to ensure a semantic comparison is performed a target lookup is performed on attributes and resolved to their names if necessary
  • A typical example is when setting a target application for a UI test target which sets the TestTargetID attribute
TargetAttributes = {
    3704EABFFE3515E47749586D = {
        CreatedOnToolsVersion = 12.5;
        TestTargetID = 76EC5DF0EEA681734B20EC5C; /* <--- Reference to another target */
    };
    76EC5DF0EEA681734B20EC5C = {
        CreatedOnToolsVersion = 12.4;
    };
};
  • An additional fixture was added to contain projects with UI test targets which have target applications set. The underlying raw references are not identical, but are semantically equivalent (MyAppUITests > MyApp)

Test Plan

  • Run xcdiff on the fixtures
cd Fixtures
swift run xcdiff -g attributes -v
  • Verify target attributes are now included in the results
  • Run xcdiff on the new ui test fixtures
cd Fixtures/ios_project_with_ui_tests
swift run xcdiff -g attributes -v
  • Verify the TestTargetID attribute is not flagged as a difference

Resolves bloomberg#62

- Target attributes are now included in the comparison results of the attributes comparator

Test Plan:

- Run xcdiff on the fixtures

```sh
swift run xcdiff -p1 Fixtures/Project1.xcodeproj -p2 Fixtures/Project2.xcodeproj -g attributes -v
```

- Verify target attributes are now included in the results

Signed-off-by: Kassem Wridan <kwridan@bloomberg.net>
@codecov
Copy link

codecov bot commented Jun 30, 2021

Codecov Report

Merging #86 (59c430b) into main (6701699) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
+ Coverage   96.13%   96.22%   +0.09%     
==========================================
  Files          47       47              
  Lines        1809     1853      +44     
==========================================
+ Hits         1739     1783      +44     
  Misses         70       70              
Impacted Files Coverage Δ
...s/XCDiffCore/Comparator/AttributesComparator.swift 100.00% <100.00%> (ø)
Sources/XCDiffCore/Library/TargetsHelper.swift 94.07% <100.00%> (+1.09%) ⬆️

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 6701699...59c430b. Read the comment docs.

Signed-off-by: Kassem Wridan <kwridan@bloomberg.net>
Signed-off-by: Kassem Wridan <kwridan@bloomberg.net>
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.

Nice work 👍

@kwridan kwridan merged commit fbaf3dd into bloomberg:main Jul 7, 2021
@kwridan kwridan deleted the feature/target-attributes-comparator branch July 7, 2021 07:19
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 project and target attributes comparator
2 participants