Skip to content

Add Swift Native Version Range Support and Associated Unit Tests - #155

Closed
PlayerIUnknown wants to merge 1 commit into
aboutcode-org:mainfrom
PlayerIUnknown:univers_aux
Closed

Add Swift Native Version Range Support and Associated Unit Tests#155
PlayerIUnknown wants to merge 1 commit into
aboutcode-org:mainfrom
PlayerIUnknown:univers_aux

Conversation

@PlayerIUnknown

Copy link
Copy Markdown

Overview

This pull request introduces support for Swift's native version ranges within the Univers project. Swift utilizes semantic versioning, and this update enables the handling of Swift package manager's specific version range declarations effectively. The update includes parsing logic for Swift version ranges and corresponding unit tests to ensure functionality adheres to Swift's versioning specifications.

Details

Swift's package manager allows specifying dependencies with various version range formats. This implementation supports the following native Swift version range specifications:

  • Exact Version: Specified using exact: "X.Y.Z", where the dependency must match an exact version.
  • From Version: Specified using from: "X.Y.Z", indicating a minimum version up to the next major version but not including.
  • Range with Upper Bound:
    • Exclusive Upper Bound: Using "X.Y.Z"..<"A.B.C" to specify a range including the lower bound but excluding the upper bound.
    • Inclusive Upper Bound: Using "X.Y.Z"..."A.B.C" to specify a range including both the lower and upper bounds.

Changes Made

  • SwiftVersionRange Class: A new class to parse and handle Swift version ranges, integrated into the Univers versioning system.
  • Unit Tests: Tests are added in tests/test_swift_versions.py to verify parsing and handling of all supported version range specifications.

Example Usage

The SwiftVersionRange can be instantiated with a Swift version range string:

vr = SwiftVersionRange('from: "1.2.3"')

This will parse and prepare constraints that ensure compatibility checks against provided Swift package versions.

Testing

Unit tests cover:

  • Exact version match
  • Version ranges starting from a specific version up to but not including the next major version
  • Exclusive and inclusive upper bounds in version ranges

Impact

This update allows developers using the Univers project to integrate Swift packages more seamlessly, adhering to Swift's native versioning schemes. It enhances the versatility of the Univers version range handling and ensures better cross-platform package management compatibility.

Signed-off-by: PlayerIUnknown <playerunknownasap@protonmail.com>
@PlayerIUnknown
PlayerIUnknown deleted the univers_aux branch March 27, 2025 19:25
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.

1 participant