-
Notifications
You must be signed in to change notification settings - Fork 821
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
Scheme config variants wrong assignment for similar config names #976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @stefanomondino. Sorry for the delay on the review.
I think I can see a potential breaking change here if someone had a config name of Production debug
for example, as the replacement you're using is case sensitive. Some people also don't put debug
or release
in their configs, and might have Appstore
for example. This would be good test cases too.
Perhaps another approach would be to see if the whole word is in the config? Splitting by spaces, and then checking if that contains the variant?
Could you also please add a changelog entry?
Hey @yonaskolb, Thanks for the review (and for the huge amount of time you're saving me with this project <3 ) I'm not quite sure what you mean here, please correct me if I'm wrong. Am I missing something? |
Config(name: "Test Release", type: .release), | ||
Config(name: "Production Release", type: .release), | ||
Config(name: "PREPROD Release", type: .release), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean if you were to change this to Prepod release
I think you'd get a crash as the config can't be found with the variant name
Glad you’re getting some good use out of it! 😀
|
…ecific variant and config type chore: updated changelog
Hey @yonaskolb I've pushed some changes as requested (extension over collection of |
Config(name: "Test Release", type: .release), | ||
Config(name: "Production Release", type: .release), | ||
Config(name: "PreProd Release", type: .release), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will fail the tests, and I'm sure it's not uncommon to have that lowercase
Config(name: "PreProd Release", type: .release), | |
Config(name: "PreProd release", type: .release), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yonaskolb took me a while to get the point, then it totally made sense!
Should be fixed now as you originally suggested: whitespace tokenization and lowercase compare
Config(name: "Test Release", type: .release), | ||
Config(name: "Production Release", type: .release), | ||
Config(name: "PreProd Release", type: .release), | ||
Config(name: "Prod Release", type: .release), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make 2 of these use lowercase debug
and release
so it tests what we talked about? Maybe PreProd debug
and PrePod release
Co-authored-by: Yonas Kolb <[email protected]>
Co-authored-by: Yonas Kolb <[email protected]>
- duplicated test for config variant name (uppercase/lowercase)
@@ -49,6 +49,9 @@ | |||
|
|||
[Commits](https://github.com/yonaskolb/XcodeGen/compare/2.18.0...2.19.0) | |||
|
|||
#### Fixed | |||
- Lookup scheme config variants by whole words, fixing incorrect assignment in names that contain subtrings of each other (eg PreProd and Prod) [#976](https://github.com/yonaskolb/XcodeGen/pull/976) @stefanomondino |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move this on master
This fixes #975
To determine proper match between a config and a config variant, we should strip away the
Release
/Debug
word from config name and check if the remaining part (trimmed out of whitespaces) is equal to the variant name.Also, while investigating this and implementing proper tests, I found out a bug in usual tests with a mismatch between a
Prod
config variant and relatedDebug Production
andRelease Production
, which is an error as per documentation. Tests were working only becauseDebug Production
containsProd
, but it was just a coincidence.This is why the
TestProject.swift
file was changed.