CocoaPods / CocoaPods/Xcodeproj

Unexpected result of parsing xcconfig files

Open
#859 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

For example, the `OTHER_LDFLAGS` in the xcconfig file looks like below:

```
...
OTHER_LDFLAGS=$(inherited) -ObjC -filelist $(PODS_ROOT)/Pods-MyApp.xcconfig.LinkFile.list -l"IGListKit" -l"Whatever"
...
```

And after parsing xcconfig using `Xcodeproj::Config`, the items of `OTHER_LDFLAGS` are out of order.

(Maybe we shouldn't use `Set` and `sort` here:https://github.com/CocoaPods/Xcodeproj/blob/master/lib/xcodeproj/config.rb#L124)

```
XCCONFIG = Xcodeproj::Config.new("path/to/myapp.xcconfig")
other_linker_flags = XCCONFIG.other_linker_flags
simple = other_linker_flags[:simple]
puts "simple", simple
puts "OTHER_LDFLAGS", XCCONFIG.to_hash["OTHER_LDFLAGS"]
```

> simple
#
OTHER_LDFLAGS
**$(PODS_ROOT)/Pods-MyApp.xcconfig.LinkFile.list** $(inherited) -ObjC -filelist -l"IGListKit" -l"Whatever"

Expected:
> $(inherited) -ObjC -filelist **$(PODS_ROOT)/Pods-MyApp.xcconfig.LinkFile.list** $(inherited) -ObjC -filelist -l"IGListKit" -l"Whatever" -l"IGListKit" -l"Whatever"

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at lib/xcodeproj/config.rb#L124 and reproduce the reported Xcodeproj::Config parsing with the sample OTHER_LDFLAGS value. Check how the simple flags are collected and how to_hash formats them. Done means the parsed flags and serialized value preserve the order from the xcconfig input, including linker flags.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.