objc-codegenutils icon indicating copy to clipboard operation
objc-codegenutils copied to clipboard

Xcode plugin support

Open luosky opened this issue 11 years ago • 5 comments

These code generation utils are great. Any chance these can be install as an Xcode plugin so that they can be used directly in Xcode?

luosky avatar Mar 01 '14 10:03 luosky

Maybe. If you make the tools project a dependency of your project and build them on demand, it keeps your codebase more portable and doesn't make assumptions about the development environment of others working on the project.

puls avatar Mar 05 '14 01:03 puls

Could anybody please chime in how to properly invoke the objc-* scripts when objc-codegenutils are added as Xcode subproject? I'd be happy then to add it to the README. I have been able to hack around to write down custom Run Script phase that refreshes all generated header files by invoking the freshly compiled objc-* binaries. It works for regular build and archive build and although it works I'm not sure this is the cleanest way to do it... Here is the code...

https://gist.github.com/mman/9410268

mman avatar Mar 07 '14 12:03 mman

The test app in the repository shows you how.

puls avatar Mar 07 '14 20:03 puls

Yep, the test app shows a nice RunScript that works well when the main app target is for the Mac but fails when the main target is for iOS, the env variables do not work for the "Archive" command after that...

I think this has something to do with the fact that env variables and directory structure created for the objc-codegenutils subproject when in archive mode for the Mac do not match that of archive for the iOS... please see the images attached... the tools are actually archived to /usr/local/bin under DSTROOT and invoked from somewhere else... screenshot 2014-03-10 11 54 36 screenshot 2014-03-10 11 54 13

mman avatar Mar 10 '14 10:03 mman

The issue appears to be that Xcode always archives the subproject targets using the "Release" configuration regardless what the main project configuration is... thus changing the Run Script to the code below makes it work (note... just hardcoding the TOOL_PATH path to "Release")...

DERIVED_SOURCES="$SRCROOT/DerivedSources"
TOOL_PATH=$BUILD_ROOT/Release
$TOOL_PATH/objc-assetgen -f "$SRCROOT" -o "$DERIVED_SOURCES"
$TOOL_PATH/objc-colordump -f "$SRCROOT" -o "$DERIVED_SOURCES"
$TOOL_PATH/objc-identifierconstants -f "$SRCROOT" -o "$DERIVED_SOURCES"

mman avatar Mar 10 '14 11:03 mman