Xcodegen: Recursive path issues

Created on 2 Mar 2018  路  20Comments  路  Source: yonaskolb/XcodeGen

When I move to the parent directory and then try and use other folder outside of the current directory, everything is picked up fine, however all the folders are not included inside of the named directory or the last folder.

I'm getting around this by using a symlink to pull the folders in correctly.

Should also note this happens when using a full path as well.

Using a symlink:
screen shot 2018-03-01 at 3 21 21 pm

Without symlink and using a parent path: ../otherfolder/sources
screen shot 2018-03-01 at 3 22 27 pm

bug

All 20 comments

Hi @iamtomcat
Do you have an example spec, showing how you use source paths.
Are you using fileGroups or options. createIntermediateGroups?

Here is my spec. No I'm not using filegroups. Maybe that is what I'm missing in this case?

I've got a couple different paths under there.

name: Generated
options:
  deploymentTarget: 
    iOS: "8.0"
  bundleIdPrefix: com.paywith
  usesTabs: false
  indentWidth: 4
  tabWidth: 4
configs:
  Debug: debug
  Release: release
targets:
  PayWithSDKCoreFramework:
    type: framework
    platform: iOS
    settings:
      INFOPLIST_FILE: /Users/tclark/projects/PayWithSDKCore/PayWithSDKCoreFramework/Info.plist
    sources: 
      - path: /Users/tclark/projects/PayWithSDKCore/Sources
        name: CheeseTown
      - path: ../PayWithSDKCore/PayWithSDKCore
  PayWithSDK:
    type: library.static
    platform: iOS
  PayWithSDKFramework:
    type: framework
    platform: iOS
  PayWithSDKMallRewards:
    type: framework
    platform: iOS
    #com.paywith.PayWithSDKMallRewards
    settings:
      INFOPLIST_FILE: "PayWithSDKMallRewards/Info.plist"
      GCC_PREPROCESSOR_DEFINITIONS: ["$(inherited)", "IS_NEW=1"]
    dependencies:
      - carthage: AirshipKit
      - target: PayWithSDKCoreFramework
    sources: 
      - Sources/Shared
      - path: PayWithSDKMallRewards
        excludes: # Add these to the project level manually till https://github.com/yonaskolb/XcodeGen/pull/252 is implemented
        - "QRCodeReaderViewController/*.[mh]"
  PayWithSDKFrameworkTests:
    type: bundle.unit-test
    platform: iOS
  PayWithSDKUniversal:
    type: tool 
    platform: iOS
    postbuildScripts:
      - path: Scripts/BuildFramework_Old.sh
  OCLint:
    type: tool
    platform: iOS
    postbuildScripts:
      - path: Scripts/OCLint.sh

Also is it possible to glob files together under one group?

@yonaskolb This might be related to this issue. I found that if a folder doesn't have any files in it then any folder inside of it gets pulled out into it's own group instead of being included in the overall group.

PayWithSDKMallRewards:
    type: framework
    platform: iOS
    scheme:
      testTargets:
        - PayWithSDKMallRewardsTests
    settings:
      INFOPLIST_FILE: "PayWithSDKMallRewards/Info.plist"
      GCC_PREPROCESSOR_DEFINITIONS: ["$(inherited)", "IS_NEW=1"]
    dependencies:
      - carthage: AirshipKit
      - target: PayWithSDKCoreFramework
    sources: 
      - path: Sources
        excludes: 
        - "Shared/Categories/project/*.[mh]"
      - path: Sources/Shared/Categories
        headerVisibility: project
      - path: PayWithSDKMallRewards
        excludes:
        - "QRCodeReaderViewController/project/*.[mh]"
      - path: PayWithSDKMallRewards/QRCodeReaderViewController
        headerVisibility: project

Just closing this figured out some work arounds.

Hi @iamtomcat, I鈥檓 reopening this as these are still valid issues. Sorry I haven鈥檛 gotten around to them yet, this fell under the radar.
Are you able to post an update about your learnings, and your workarounds?

I have the same issue :(

@iamtomcat I don't have any workaround for now but let me now if I can do anything to help you find out what's going on. I have a starter project but it is in a private repo. I can add you if required.

Configuration is minimal for now, but the is a filestucture:
root/Source/Application code for application
root/Source/Domain code for my framework1
root/Source/Data code for my framework2
root/Tools/XCodeGen/project.yml
name: ProjectName options: bundleIdPrefix: com.bundleIdPrefix createIntermediateGroups: false/true usesTabs: true targets: Application: type: application platform: iOS deploymentTarget: "10.0" sources: - path: ../../Sources/Application name: Application dependencies: - target: Domain Domain: type: framework platform: iOS deploymentTarget: "10.0" sources: - path: ../../Sources/Domain name: Domain dependencies: - target: Data Data: type: framework platform: iOS deploymentTarget: "10.0" sources: - path: ../../Sources/Data name: Data
root/Tools/XCodeGen/Scripts/build.sh -> invoke Xcodegen :
cd $(dirname $0) xcodegen --spec ../project.yml --project ../../..
root -> Generated project.xproj should goes here

It find all the files but place all folders at the root level in Xcode, tried with createIntermediateGroups on/off

So what I do is kind of double up on a folder.

At the moment it's able to tell what has been included or not with original path and it should glob the rest up. Not the most ideal for being explicit.

- path: /path/to/stuff
- path: /path/to
  - visibility: project

@yonaskolb I'm trying to move things around to understand what I can do.
Juste to be sure all the paths in project.yml are supposed to be relative to location of :

  • project.yml
  • where xcodegen is run
  • the project argument of xcodegen
    ?

All paths in the project.yml are designed to be relative to that file.
It looks like there may be issues when the project is not in the same directory as project.yml

Here is what I have on my side when including sources outside of project dir .)

s180704_0835141

I think I may have hit the same/similar issue here.

For a given configuration

  Shared:    
    type: framework
    platform: iOS
    dependencies:
      - carthage: RxSwift
    sources:      
      - path: Shared/Support
        name: Shared
        headerVisibility: project
      - path: Shared

I'm getting folders generated as:

MyProject
    |_ Shared
    |_ Shared

What I am looking for

MyProject
    |_ Shared
           |_ Support

Where the support folder contains header files with project visibility.

If I remove name: Shared I get the correct folder structure but all headers are set to public

Am I doing something wrong?

Thanks!

I see. Thanks for the info @rpassis.
What happens if you set createIntermediateGroups?

options:
  createIntermediateGroups: true

Thanks @yonaskolb that solves it!

FWIW here's what I used

name: MyProj
options: 
  createIntermediateGroups: true
targets:
  Shared:    
    type: framework
    platform: iOS
    dependencies:
      - carthage: RxSwift
    sources:            
      - path: Shared/Support
        headerVisibility: project        
      - path: Shared
        excludes: 
        - "Support/*.[mh]"

Great! It's bit of a workaround I know.
Another future solution might something like this https://github.com/yonaskolb/XcodeGen/pull/187

I'm back on a project using XcodeGen. The issue is still here :
With this folder arch :
Project/project.yml
Project/SomeFolder/SomeSource
in Xcode I get SomeFolder/SomeSource

now if I move to:
Project/Tools/project.yml
Project/SomeFolder/SomeSource
XCodeGen says that path aren't correct

so I move paths adding ../ in project.yml
XCodeGen says it's ok but in Xcode all folders are a the same level

This issue has been fixed by #681.

It will be shipped on next release (perhaps 2.10.0)

2.10.0 has been released. Closing this for now. Please open again if anyone has any more issues with this

Can confirm it works if the folder is inside the directory with the project.yml file. However, it won't work if I use relative paths.

Screenshot 2019-11-01 at 2 44 06 PM
Screenshot 2019-11-01 at 2 43 44 PM
Screenshot 2019-11-01 at 2 43 29 PM

@yonaskolb @giginet

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thecb4 picture thecb4  路  3Comments

mrtsamma picture mrtsamma  路  3Comments

ImLaufderZeit picture ImLaufderZeit  路  5Comments

yonaskolb picture yonaskolb  路  3Comments

ismetanin picture ismetanin  路  3Comments