kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Why isn't there any copy made of the framework into ${PROJECT_DIR} #33

Closed pier-oliviert closed 12 years ago

pier-oliviert commented 12 years ago

I have made that change so I have a fixed place that I can symlink to in my workspace, before making a pull request, I was wondering if there was rationale for not having a fixed emplacement inside ${PROJECT_DIR} to copy the .framework and .embeddedframework?

kstenerud commented 12 years ago

Basically it is in keeping with the Xcode style of putting all generated content into DerivedData rather than the project directory (which is what Xcode used to do before).

Technically you're supposed to right-click on the framework in your "Products" group and select "Show in Finder". I'm not convinced that this is a good way to do things, but it is the Apple way.

pier-oliviert commented 12 years ago

I'd agree but it can become a real pain if you want to symlink different local framework that you are developing simultaneously on the same workspace.

Since the derived data are temporary folders every now and then I have to reimport the frameworks.

If you believe that it should stay that way, I think I'll fork your project to keep track of my personal changes

kstenerud commented 12 years ago

One thing you could do is add an extra "run script" build phase to the end of your framework project to copy ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework into ${PROJECT_DIR}

pier-oliviert commented 12 years ago

that's what I did, but I don't want to do that for every new project I'm about to create.

kstenerud commented 12 years ago

You can modify the project template itself and add that step to the end of the last "ShellScript" directive:

                <key>ShellScript</key>
                <string>set -e

set +u
...

# Replace other platform's framework with a copy of this one (so that both have the same universal binary)

echo "Copy from $UFW_SDK_PLATFORM to $UFW_OTHER_PLATFORM"

echo rm -rf "${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}"
rm -rf "${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}"
echo cp -a "${BUILD_DIR}/${CONFIGURATION}-${UFW_SDK_PLATFORM}" "${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}"
cp -a "${BUILD_DIR}/${CONFIGURATION}-${UFW_SDK_PLATFORM}" "${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}"

# Modified stuff starts here:
# Save a copy to the project directory as well

rm -rf "${PROJECT_DIR}/${PRODUCT_NAME}.framework"
rm -rf "${PROJECT_DIR}/${PRODUCT_NAME}.embeddedframework"
cp -a "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework" "${PROJECT_DIR}"
cp -a "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework" "${PROJECT_DIR}"

</string>
            </dict>
        </array>
    </dict>
</array>

Save it in your Xcode templates folder, restart Xcode, and then any new project you make will copy the finished frameworks to the project directory.

pier-oliviert commented 12 years ago

Yeah that's exactly what I had in mind when I said I was going to fork your project if you don't want to commit it to master. I just want to have a place outside my computer that I can access if something happens (Like backup).

I guess I'll close this issue then. Thank you!