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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize GoogleService-Info.plist target membership #1423

Open
amirRTA opened this issue Dec 6, 2023 · 3 comments
Open

Customize GoogleService-Info.plist target membership #1423

amirRTA opened this issue Dec 6, 2023 · 3 comments

Comments

@amirRTA
Copy link

amirRTA commented Dec 6, 2023

Hello,
I have used XcodeGen the Great 馃 in our application and it works flawlessly unless there is one little issue with GoogleService-Info.plist files.
I have three GoogleService-Info.plist files, each related to a separate application environment (develop, stage, and production) and I have to use them in a single Xcode target. Following is the MyApp structure.

targets:
  MyApp:
    type: application
    platform: iOS
    sources:
      - path: MyApp
      - path: MyApp/Resources/GoogleService-Infos/DEV/GoogleService-Info.plist
        buildPhase: none
      - path: MyApp/Resources/GoogleService-Infos/INT/GoogleService-Info.plist
        buildPhase: none
      - path: MyApp/Resources/GoogleService-Infos/PROD/GoogleService-Info.plist
        buildPhase: none
Screen Shot 2023-12-06 at 09 37 01 Screen Shot 2023-12-06 at 13 11 21

I added a script in the build phases to select the proper Info.plist file and then copy it inside my app's bundle directory. In this case, I have to set an unselected target membership on them and don't need to have them on copy bundle sources inside build phases.

I tried to set buildphases: none for them but it didn't work. This note inside the project spec > buildPhase already mentioned it I guess Note that Info.plist files will never be added to any build phases, no matter what this setting is..

      - path: Source/Resources/GoogleService-Infos/INT/GoogleService-Info.plist
        buildPhase: none

I'm using the 2.38.0 version of XcodeGen.
I'm encountering the opposite case of #1045 please help me THX. 馃檹

@amirRTA amirRTA changed the title Custom **Info.plists target membership is checked Customize GoogleService-Info.plist target membership Dec 9, 2023
@alessdiimperio
Copy link

alessdiimperio commented Dec 15, 2023

i have a similar use case but have 3 targets

ApplicationProd
ApplicationStage
ApplicationDebug

in the file structure i have

YourApp//Configurations/Debug <- which has all debug specifig files
YourApp/Configurations/Stage <- which has all stage specifig files
YourApp/Configurations/Production <- which has all prod specifig files

under sources

on the production target you'd do like this..
sources:
- path: YourApp
excludes:
- Configurations/Debug/**
- Configurations/Stage/**

and mimick for the others similarly
thats how i solved it atleast

@alessdiimperio
Copy link

alessdiimperio commented Dec 15, 2023

another solution could be to use the createIntermediateGroups on the sources and then have different configurations

@amirRTA
Copy link
Author

amirRTA commented Dec 30, 2023

another solution could be to use the createIntermediateGroups on the sources and then have different configurations

      - path: MyApp/Resources
        excludes:
          - "GoogleService-Infos"
          - "GoogleService-Infos/**"
          - "GoogleService-Infos/**/*.*"
      - path: MyApp/Resources/GoogleService-Infos/DEV
        type: folder
        buildPhase: none
      - path: MyApp/Resources/GoogleService-Infos/INT
        type: folder
        buildPhase: none
      - path: MyApp/Resources/GoogleService-Infos/PROD
        type: folder
        buildPhase: none

I managed to solve it by defining those path types as folder (as @alessdiimperio mentioned, createIntermediateGroups option). Please notice that the build phase option none will not apply to 'info.plist' files but it will work on folder type.

Screen Shot 2023-12-30 at 11 00 51

This is what it looks like after it. It's an intermediate group referenced directly from disk with no target membership. This worked for me.

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

No branches or pull requests

2 participants