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: Make diagnose-api-breaking-changes handle git submodules #8192

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aydinomer00
Copy link

@aydinomer00 aydinomer00 commented Dec 30, 2024

This commit improves the diagnose-api-breaking-changes command to properly handle packages with git submodules:

  • Add proper submodule initialization and management
  • Implement comprehensive APIDigester for analyzing API changes
  • Add support for recursive analysis of submodules
  • Add detailed change reporting with categorization (breaking/non-breaking/deprecated)
  • Improve error handling and reporting
  • Add proper documentation

Resolves #8192

Motivation:
When running diagnose-api-breaking-changes against a package with git submodules, the tool does not properly handle submodule initialization and analysis.

Modifications:

  • Added APIDigester class with complete implementation
  • Enhanced Process management and error handling
  • Added submodule discovery and analysis capabilities
  • Implemented detailed reporting mechanisms for API changes
  • Added support for categorizing changes (breaking/non-breaking/deprecated)
  • Improved documentation and error messages

Result:
After this change, the diagnose-api-breaking-changes command will properly handle packages with git submodules by:

  • Correctly initializing submodules
  • Analyzing API changes in both the main package and all submodules
  • Providing detailed reports categorized by change type (breaking/non-breaking/deprecated)

This commit improves the diagnose-api-breaking-changes command to properly handle packages with git submodules:

- Add proper submodule initialization and management
- Implement comprehensive APIDigester for analyzing API changes
- Add support for recursive analysis of submodules
- Add detailed change reporting with categorization (breaking/non-breaking/deprecated)
- Improve error handling and reporting
- Add proper documentation

Resolves #XXX
Copy link
Contributor

@bkhouri bkhouri left a comment

Choose a reason for hiding this comment

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

I did not review the change based on the single blocking comment I have.

Package.swift Outdated
//===----------------------------------------------------------------------===//

import class Foundation.ProcessInfo
// swift-tools-version:5.5
Copy link
Contributor

Choose a reason for hiding this comment

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

Issue (blocking): why did we downgrade the tool version to 5.5?

This commit improves the diagnose-api-breaking-changes command to properly handle packages with git submodules:

- Add proper submodule initialization and management
- Implement comprehensive APIDigester for analyzing API changes
- Add support for recursive analysis of submodules
- Add detailed change reporting with categorization (breaking/non-breaking/deprecated)
- Improve error handling and reporting
- Add proper documentation

Resolves #XXX
Copy link
Author

@aydinomer00 aydinomer00 left a comment

Choose a reason for hiding this comment

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

Problem

The diagnose-api-breaking-changes command currently doesn't properly handle packages with git submodules, making it difficult to track API changes across the entire package hierarchy.

Solution

This PR improves the command to properly handle git submodules by:

  • Adding proper submodule initialization
  • Implementing a comprehensive API analysis system
  • Supporting recursive analysis of submodules
  • Providing detailed change reporting

Key Changes

  1. DiagnoseAPIBreakingChanges.swift:

    • Added proper submodule initialization
    • Improved workspace handling
    • Added detailed change reporting
  2. APIDigester.swift:

    • Implemented comprehensive API analysis
    • Added support for baseline comparison
    • Added detailed symbol parsing
    • Improved error handling

Copy link
Contributor

@bkhouri bkhouri left a comment

Choose a reason for hiding this comment

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

There are too many delta in the Package.swift. Is the PR source branch based on an older commit?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is seems odd this fix would require a significant change in the Packages.swift file. Are these changes necessary? Are the features/functionality for removing the previous content still supported still supported?

If the answer to the second question is "no", we need to update this Packages.swift to only include changes required to fix the specific issue.

@aydinomer00
Copy link
Author

@bkhouri Understood, thank you for your feedback. I'll take a closer look again when I have some free time. I appreciate your patience in the meantime.

Copy link
Contributor

@plemarquand plemarquand left a comment

Choose a reason for hiding this comment

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

It looks like this is a reimplementation of the existing diagnose-api-breaking-changes command.

I'd recommend looking at this existing command and identifying how it could be modified to support submodules correctly instead of adding a new and conflicting implementation.

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.

3 participants