XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Settings relative path behavior inconsistency

Open rpassis opened this issue 6 years ago • 3 comments

When using settings with included specs, the default relative path behavior is not respected (which is understandable since xcodegen doesn't know that the value is a path) but is there a way to perhaps get a reference to the current project.yml path so we can use that to interpolate with settings paths?

For example if I have a root spec that includes a framework spec:

include:
  - Framework/project.yml

And inside my Framework/project.yml I have settings that specify a path

settings:
    INFOPLIST_FILE: Resources/Info.plist

This works perfectly when generating the framework spec but when the root spec is generated, the path to the Info.plist file resolves to Root/Resources/Info.plist instead of Root/Framework/Resources/Info.plist

I tried $(SRCROOT) and $(PROJECT_DIR) in my Framework spec but both resolve to the root project spec.

I was able to use INFOPLIST_FILE:REPLACE: on the root spec successfully but wondered if there was a better way.

rpassis avatar Jul 31 '19 14:07 rpassis

What do you suggest? Maybe something like:

settings:
    INFOPLIST_FILE: ${file_directory}/Resources/Info.plist

And file_directory would get set on included files the parent of the file. That or a file which you can then use /.. ${file}/../Resources/Info.plist

yonaskolb avatar Jan 04 '20 13:01 yonaskolb

Maybe the $project_file_path option is more versatile and could also be used for other use cases we haven’t thought of? I’m happy either way!

Let me know what you think and I’ll be more than happy to help out with a PR if you need some help!

rpassis avatar Jan 04 '20 17:01 rpassis

sad, that neither

${file}

nor

${file_directory}

were ever implemented, could have needed them right now ;-)

Lutzifer avatar May 17 '24 08:05 Lutzifer