Skip to content

Handle major.minor for SPM #1546

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

RomanPodymov
Copy link
Contributor

@RomanPodymov RomanPodymov commented May 10, 2025

Hello.
Thank you for XcodeGen.
Fixed #1545
To fix it, I added custom invalidItemBehaviour for SPM packages decoder. Now if package version was detected as 6.0 (number), then invalidItemBehaviour converts it to "6.0" (string).

@RomanPodymov RomanPodymov marked this pull request as draft May 10, 2025 09:15
@RomanPodymov RomanPodymov marked this pull request as ready for review May 10, 2025 12:02
@@ -193,7 +193,19 @@ extension Project {
attributes = jsonDictionary.json(atKeyPath: "attributes") ?? [:]
include = jsonDictionary.json(atKeyPath: "include") ?? []
if jsonDictionary["packages"] != nil {
packages = try jsonDictionary.json(atKeyPath: "packages", invalidItemBehaviour: .fail)
packages = try jsonDictionary.json(atKeyPath: "packages", invalidItemBehaviour: .custom({ error in
Copy link
Owner

Choose a reason for hiding this comment

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

Unless I'm missing something, the fix could live directly in SwiftPackage.VersionRequirement(jsonDictionary: JSONDictionary)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @yonaskolb
It's possible since I'm not very familiar with the project)

@yonaskolb
Copy link
Owner

This isn't strictly a bug in XcodeGen but rather in how YAML handles number literals. Doesn't mean it's not worth supporting numbers as well though

RomanPodymov and others added 6 commits July 17, 2025 16:37
* Update CI equipments and drop Xcode 15 support (yonaskolb#1548)

* Add validation to ensure that settings.configs values are dictionaries, in order to prevent misuse (yonaskolb#1547)

* Add validation to ensure settings.configs values are dictionaries to prevent misuse

* Add tests for invalid settings.configs value formats

* Replaced with filter and split into a function

* Rename invalidConfigsFormat to invalidConfigsMappingFormat

* Add comments to explain invalid  fixture

* Rename test fixture

* Update CHANGELOG.md

* Correct grammer

* Use KeyPath instead of closure

* Rename validateMappingStyleInConfig to extractValidConfigs

* Add a document comment for extractValidConfigs(from:)

* Use old testing api and remove EquatableErrorBox

* Rename test case to use "mapping" instead of "dictionary"

* Add ValidSettingsExtractor to encapsulate the logic for converting a dictionary to Settings

* Add settings validation for both Target and AggregateTarget

* Add tests for invalid settings.configs in Target and AggregateTarget

* Add document comments for ValidSettingsExtractor

* Rename ValidSettingsExtractor to BuildSettingsExtractor

* Add settings validation for settingGroups

* Add tests for settingGroups

* Rename extract to parse

* Refactor

* Update Tests/ProjectSpecTests/InvalidConfigsFormatTests.swift

---------

Co-authored-by: Yonas Kolb <[email protected]>

* Synced folders (yonaskolb#1541)

* update xcodeproj to 8.27.7

* add syncedFolder source type

* drop xcode 15 support

* Rely on fileReference instead of adding new synchronizedRootGroup (yonaskolb#1557)

* fix: don't include untracked children in cache

---------

Co-authored-by: Kirill Yakimovich <[email protected]>

* Use USER env var instead of LOGNAME (yonaskolb#1559)

During user switch with su/sudo in system LOGNAME may not be initialised, but USER env var is always exist.

* Address Sanitizer options in run/test schemes (yonaskolb#1550)

* Expose address sanitizer flags in run and test BuildActions in Schemes

* Update testJSONEncodable to test the new fields

* Also test the asan setting values for run scheme

* Update changelog

---------

Co-authored-by: Yonas Kolb <[email protected]>

* Update to 2.44.0

# Conflicts:
#	CHANGELOG.md

---------

Co-authored-by: Kohki Miki <[email protected]>
Co-authored-by: Ryu <[email protected]>
Co-authored-by: Yonas Kolb <[email protected]>
Co-authored-by: Kirill Yakimovich <[email protected]>
Co-authored-by: Kanstantsin Shautsou <[email protected]>
Co-authored-by: Himanshu Kumar <[email protected]>
@RomanPodymov
Copy link
Contributor Author

This isn't strictly a bug in XcodeGen but rather in how YAML handles number literals. Doesn't mean it's not worth supporting numbers as well though

Hello @yonaskolb
Moved solution to SwiftPackage.VersionRequiremen.init(jsonDictionary: JSONDictionary)

@RomanPodymov RomanPodymov requested a review from yonaskolb July 17, 2025 17:23
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.

Handle major.minor SPM packages versions
2 participants