yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ResourcesTag do not work

pengzishang opened this issue · comments

commented

There is a font file named "Songti.otf" under the path "GuruClub/Resources/Songti.otf"
I need to add a ResourcesTag to it
I tried like those :

    sources:
      - path: GuruClub/Resources/
        excludes:
            - "Songti.otf"
      - path: GuruClub/Resources/Songti.otf
        resourceTags: ["example", "movie"]

or

    sources:
      - path: GuruClub/Resources/Songti.otf
        buildPhase: resources
        resourceTags:
          - example
          - movie

or

    sources:
      - path: GuruClub/Resources/Songti.otf
        resourceTags: [movie]

none of them working, it there any mistake or typo in my code?

I suppose GuruClub is the name of your project and not a directory inside. What worked for me is

     sources:
      - path: Resources/file.type
        buildPhase: resources
        resourceTags:
          - example
          - movie
commented

sadly, I tried a code like yours

  GuruClub:
    type: application
    platform: iOS
    sources:
      - GuruClub
      - GuruClubFoundationBundle/Localizable
      - path: Resources/Songti.otf
        buildPhase: resources
        resourceTags:
          - example
          - movie

it shows me a prompt
Spec validation error: Target "GuruClub" has a missing source directory "/Users/deshglh/Projects/guruclub/Resources/Songti.otf"

after I checked the path,
Songti.otf 's path is guruclub/GuruClub/Resources/Songti.otf, so I Tried

targets:
  GuruClub:
    type: application
    platform: iOS
    sources:
      - GuruClub
      - GuruClubFoundationBundle/Localizable
      - path: GuruClub/Resources/Songti.otf
        buildPhase: resources
        resourceTags:
          - example
          - movie

however, it also did not work.

I suppose GuruClub is the name of your project and not a directory inside. What worked for me is

     sources:
      - path: Resources/file.type
        buildPhase: resources
        resourceTags:
          - example
          - movie

Try setting the resourceTags in the first source. Source paths are processed in order and then reused. Does that work?

      - path: GuruClub/Resources/Songti.otf
        buildPhase: resources
        resourceTags:
          - example
          - movie
      - GuruClub

Try setting the resourceTags in the first source. Source paths are processed in order and then reused. Does that work?

      - path: GuruClub/Resources/Songti.otf
        buildPhase: resources
        resourceTags:
          - example
          - movie
      - GuruClub

Looks like I had a similar problem and this advice helped me.