Sourcery: Unable to reference files above the project root using `../` in the paths
Context
We’ve got an Xcode project that consists of multiple sub-projects + some common code base that sits at the root level of the meta-projects. We open the MetaProject.workspace file in Xcode and then select the sub-project’s scheme to run/build. Sourcery ends up running from one of the child projects and reference files above it in the directory path. Prior to 0.6.0 we could just use ../
in the sources or templates path to reference those locations but that no longer works.
MetaProject
│ MetaProject.xcworkspace
└───SourceryTemplates
└───CommonCode
└───MySubProject
│ │ MySubProject.xcworkspace
│ └───GeneratedStubs
└───AnotherSubProject
│ │ AnotherSubProject.xcworkspace
│ └───GeneratedStubs
Environment
Xcode 8.3.3 Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Issue
After updating to 0.6.1 or 0.7.x we can no longer reference files above the root as the ../
appear to be ignored. We’ve tried this using both the YAML definition file and Bash shell commands with no luck.
YAML definition
sources:
- MySubProject
- ../CommonCode
templates:
- ../SourceryTemplates/
output:
MySubProject/GeneratedStubs
args:
app: MySubProject
imports:
- PromiseKit
- CoreLocation
Bash shell definition
"$PODS_ROOT/Sourcery/bin/sourcery" --sources "$SRCROOT/../CommonCode" --templates "$SRCROOT/../SourceryTemplates/" --output "$SRCROOT/MySubProject/GeneratedStubs" --args app=MyProject,imports=PromiseKit,imports=CoreLocation
"$PODS_ROOT/Sourcery/bin/sourcery" --sources "$SRCROOT/MySubProject" --templates "$SRCROOT/../SourceryTemplates/" --output "$SRCROOT/MySubProject/GeneratedStubs" --args app=MyProject,imports=PromiseKit,imports=CoreLocation
Results
We see the following failure in Xcode when we try to run the MySubProject
error: '/Users/MrC/Documents/dev/MetaProject/MySubProject/CommonCode' does not exist or is not readable.
error: '/Users/MrC/Documents/dev/MetaProject/MySubProject/SourceryTemplates' does not exist or is not readable.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 15
I too have problems relating to not being able to use paths in parents folder in my Config file. Any update?
it works because
SRCROOT
is an absolute path in this case@csykes thanks for reporting it, we’ll take a look into the issue soon 😄