johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Fixing build failure for folder name with '&' character in it. #163

Closed Biinngg closed 7 years ago

Biinngg commented 7 years ago

Learnt compile will fail if the source file is in a folder which name contains '&'.

johnno1962 commented 7 years ago

Does this work? I don’t remember this being so easy to fix!

Biinngg commented 7 years ago

Yes. It works on our project. This is my log after fixing:

buidRoot: /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build

logDir: /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Logs/Build



Learnt compile:     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/biliu/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/biliu/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=9.3 -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/TestInjection-generated-files.hmap -I/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/TestInjection-own-target-headers.hmap -I/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/TestInjection-all-target-headers.hmap -iquote /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/TestInjection-project-headers.hmap -I/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Products/Debug-iphonesimulator/include -I/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/DerivedSources/x86_64 -I/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/DerivedSources -F/Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/Objects-normal/x86_64/ViewController.d --serialize-diagnostics /Users/biliu/Library/Developer/Xcode/DerivedData/TestInjection-fkapsynnhwgyqxhjgudneobclojt/Build/Intermediates/TestInjection.build/Debug-iphonesimulator/TestInjection.build/Objects-normal/x86_64/ViewController.dia -c /Users/biliu/Desktop/TestInjection/TestInjection/View\&Controller/ViewController.m -o iOSInjectionProject/x86_64/injecting_class.o



real    0m0.372s

user    0m0.029s

sys 0m0.277s


......

Bundle loaded successfully.

/Users/biliu/Desktop/TestInjection/TestInjection/View\&Controller/ViewController.m is the source file path.

johnno1962 commented 7 years ago

I’ve have tested this end with Xcode 8 and I have a Swift project that doesn’t work. I’ll look into this when Xcode 8 GM comes out and retest but for now I’d rather not merge this in just now. Cheers.