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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive path issues #260

Closed
iamtomcat opened this issue Mar 1, 2018 · 20 comments
Closed

Recursive path issues #260

iamtomcat opened this issue Mar 1, 2018 · 20 comments
Labels

Comments

@iamtomcat
Copy link

iamtomcat commented Mar 1, 2018

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

@yonaskolb
Copy link
Owner

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

@iamtomcat
Copy link
Author

iamtomcat commented Mar 1, 2018

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
    

@iamtomcat
Copy link
Author

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

@iamtomcat
Copy link
Author

iamtomcat commented Mar 5, 2018

@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

@iamtomcat
Copy link
Author

Just closing this figured out some work arounds.

@yonaskolb yonaskolb reopened this May 25, 2018
@yonaskolb
Copy link
Owner

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

@Alex293
Copy link

Alex293 commented May 26, 2018

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

@iamtomcat
Copy link
Author

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

@Alex293
Copy link

Alex293 commented Jun 1, 2018

@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
    ?

@yonaskolb
Copy link
Owner

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

@yonaskolb yonaskolb added the bug label Jun 3, 2018
@vgorloff
Copy link
Contributor

vgorloff commented Jul 4, 2018

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

s180704_0835141

@rpassis
Copy link
Contributor

rpassis commented Nov 3, 2018

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!

@yonaskolb
Copy link
Owner

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

options:
  createIntermediateGroups: true

@rpassis
Copy link
Contributor

rpassis commented Nov 3, 2018

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]"

@yonaskolb
Copy link
Owner

Great! It's bit of a workaround I know.
Another future solution might something like this #187

@Alex293
Copy link

Alex293 commented Dec 22, 2018

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

@giginet
Copy link
Collaborator

giginet commented Oct 22, 2019

This issue has been fixed by #681.

It will be shipped on next release (perhaps 2.10.0)

@yonaskolb
Copy link
Owner

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

@LiewJunTung
Copy link

LiewJunTung commented Nov 1, 2019

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

@LiewJunTung
Copy link

@yonaskolb @giginet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants