I'm using the command line to build all the targets in my project.
I have 3 targets in my project but the build file(.app) is getting created for one target.
Below is script
CONFIG="Ad Hoc"
SDK="iphoneos"
xcodebuild -alltargets -sdk "$SDK" -configuration "$CONFIG"
xcodebuild -project projectname.xcodeproj -alltargets
Related
i have many projects embedded in single main project, i am trying to automate the build process. but issue is that i cant make build using command line.
Clean project
xcodebuild clean -project TestingCommandLine.xcodeproj -configuration Debug -alltargets
Make Archive
xcodebuild archive -project TestingCommandLine.xcodeproj -scheme "TestingCommandLine" -configuration Debug -archivePath myApp.xcarchive
Build IPA
xcodebuild -exportArchive -archivePath myApp.xcarchive -exportPath myApp.ipa -exportOptionsPlist exportOptions.plist
the same process works with simple project which does not have any dependencies.
The following build commands failed:
Ld watchos/Watch\ Extension.appex/iskanWatch\ Extension normal armv7k
(1 failure)
This is the actual failure error comes when i try to build.
Any help will be appreciated.
I have a project that uses cocoa pods.
I couldn't set the PRODUCT_NAME in xcodebuild it always leads to compile time error.
/usr/bin/xcodebuild
-scheme $Scheme -workspace $WorkSpaceOfProject
-configuration Debug clean build CONFIGURATION_BUILD_DIR=$PathToApp "CODE_SIGN_IDENTITY=$CodeSigningIdentity"
"PRODUCT_BUNDLE_IDENTIFIER=$BundleIdentifier"
"PROVISIONING_PROFILE=$ProvisioningProfileIdentity" "PRODUCT_NAME
=$Appname"
unknown:0: error: underlying Objective-C module 'Appname' not found
If I remove the PRODUCT_NAME from the above script, then it compiles successfully but unfortunately I have to set the app name via script
I tried setting -xcconfig as somebody suggested , it also didn't work out.
How can I change the app name through script but at the same time compile the app with cocoa pods?
If I compile it using the project file instead of workspace it executes without any problem. Here is the script:
/usr/bin/xcodebuild -target $Target -project $ProjectFilePathAbsolute
-configuration Debug clean build CONFIGURATION_BUILD_DIR=$PathToApp "CODE_SIGN_IDENTITY=$CodeSigningIdentity" "PRODUCT_NAME =$Appname"
"PRODUCT_BUNDLE_IDENTIFIER=$BundleIdentifier"
"PROVISIONING_PROFILE=$ProvisioningProfileIdentity"
But I have to compile with workspace because I am using cocoapods.
Any suggestions are highly welcome.
I solved the above issue by using PlistBuddy and in the xcodebuild command I didn't use PRODUCT_NAME
Here is the script that I used
/usr/libexec/PlistBuddy -c "Set :CFBundleName test" info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName test" info.plist
/usr/bin/xcodebuild -scheme $Scheme -workspace $WorkSpaceOfProject
-configuration Debug clean build CONFIGURATION_BUILD_DIR=$PathToApp "CODE_SIGN_IDENTITY=$CodeSigningIdentity"
"PRODUCT_BUNDLE_IDENTIFIER=$BundleIdentifier"
"PROVISIONING_PROFILE=$ProvisioningProfileIdentity" "PRODUCT_NAME
=$Appname"
My Makefile is as the following and it gives error as make:
No targets specified and no makefile found. Stop.
XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
PROJECT_ROOT=/Users/AshrafMac/Desktop/iOSSDK/
PROJECT=$(PROJECT_ROOT)/InfColorPicker.xcodeproj
TARGET=/Users/AshrafMac/Desktop/iOSSDK/
all: libInfColorPickerSDK.a
libInfColorPicker-i386.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(TARGET).a $#
libInfColorPicker-armv7.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build
-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $#
libInfColorPickerSDK.a: libInfColorPicker-i386.a libInfColorPicker-armv7.a
xcrun -sdk iphoneos lipo -create -output $# $^
clean:
-rm -f *.a *.dll
Unable to create ios static library .a file using make command.
xcodebuild -project 'MyProject.xcodeproj' -configuration 'Release'
-sdk 'iphoneos9.3' clean build ARCHS='armv7 armv7s' IPHONEOS_DEPLOYMENT_TARGET='5.0' TARGET_BUILD_DIR='./build-arm'
BUILT_PRODUCTS_DIR='./build-arm'
xcodebuild -project 'MyProject.xcodeproj' -configuration 'Release'
-sdk 'iphoneos9.3' clean build ARCHS='arm64' IPHONEOS_DEPLOYMENT_TARGET='6.0' TARGET_BUILD_DIR='./build-arm64'
BUILT_PRODUCTS_DIR='./build-arm64'
xcodebuild -project 'MyProject.xcodeproj' -configuration 'Release'
-sdk 'iphonesimulator9.3' clean build ARCHS='i386' IPHONEOS_DEPLOYMENT_TARGET='5.0' TARGET_BUILD_DIR='./build-i386'
BUILT_PRODUCTS_DIR='./build-i386'
xcodebuild -project 'MyProject.xcodeproj' -configuration 'Release'
-sdk 'iphonesimulator9.3' clean build ARCHS='x86_64' VALID_ARCHS='x86_64' IPHONEOS_DEPLOYMENT_TARGET='6.0'
TARGET_BUILD_DIR='./build-x86_64' BUILT_PRODUCTS_DIR='./build-x86_64'
lipo -create './build-arm/MyProject.a'
'./build-arm64/MyProject.a' './build-i386/MyProject.a'
'./build-x86_64/MyProject.a' -output 'Mylibrary.a'
EXECUTE the above code in TERMINAL.
In the above code MyProject.xcodeproj should be replaced with your Xcode project name and iphoneos9.3 should be replaced by maximum supported deployment target by your Xcode (For Example I am using Xcode 7.3.1 and maximum supported deployment by it is 9.3 see in: YourProject >> target >>> General Tab)
I managed to get static libraries working and its all fine. Now that I have moved onto the proper library I want to create Im having issues. Im using cocoapods to import other files and it creates a workspace. Now the script I have for compiling no longer works and my assumption is because I am working in a framework now. I have been googling for hours trying to get an answer but all the things I have found only relate to turning a single project into a library
My questions are:
1) Is it possible to combine a workspace into one single library?
2) should I be trying to create a framework instead?
3) Is it just my script that isnt right?
XCODEBUILD_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin
XCODEBUILD=$XCODEBUILD_PATH/xcodebuild
$XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphoneos" - configuration "Release" clean build
$XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphonesimulator" - configuration "Release" clean build
lipo -create -output "build/libT5Pusher.a" "build/Release-iphoneos/libT5Pusher.a" "build/Release-iphonesimulator/libT5Pusher.a"
also tried this
XCODEBUILD_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin
XCODEBUILD=$XCODEBUILD_PATH/xcodebuild
$XCODEBUILD -workspace T5Pusher.xcworkspace -scheme "T5Pusher" -sdk "iphoneos" - configuration "Release" clean build
$XCODEBUILD -workspace T5Pusher.xcworkspace -scheme "T5Pusher" -sdk "iphonesimulator" - configuration "Release" clean build
lipo -create -output "build/libT5Pusher.a" "build/Release-iphoneos/libT5Pusher.a" "build/Release-iphonesimulator/libT5Pusher.a"
The errors I get are
** BUILD FAILED **
The following build commands failed:
Libtool build/PusherTest.build/Release-iphoneos/PusherTest.build/Objects- normal/armv7/libPusherTest.a normal armv7
Libtool build/PusherTest.build/Release-iphoneos/PusherTest.build/Objects-normal/armv7s/libPusherTest.a normal armv7s
(2 failures)
lipo: can't open input file: build/Release-iphoneos/libPusherTest.a (No such file or directory)
Showing first 200 notices only
and for the second, the build succeeds but the library (.a) files are never created so it cannot combine them
I have found the solution. You have to use the command:
pod install --no-integrate
when installing the pod. This will not create a workspace and allow the use of the script
XCODEBUILD_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin
XCODEBUILD=$XCODEBUILD_PATH/xcodebuild
$XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphoneos" - configuration "Release" clean build
$XCODEBUILD -project T5Pusher.xcodeproj -target "T5Pusher" -sdk "iphonesimulator" - configuration "Release" clean build
lipo -create -output "build/libT5Pusher.a" "build/Release-iphoneos/libT5Pusher.a" "build/Release-iphonesimulator/libT5Pusher.a"
Then to set the config file for pods:
-Go to project editor -> info -> configuration
-Set the target to use pods.xconfig file for debug and release
I was having the same issue myself and found that if I specified the output directories and then told lipo to look there then it worked while still letting me use the workspace. The may be different in Xcode 5 but when I use it as a custom build phase then it works without specifying the output directories and I only have to direct lipo to ${BUILD_DIR} to find the generated files.
$XCODEBUILD -project T5Pusher.xcodeproj \
-target "T5Pusher" \
-sdk "iphoneos" \
-configuration "Release"
OBJROOT=${env_variable_to_some_directory}/Obj.root \
SYMROOT=${env_variable_to_some_directory}/Sym.root \
DSTROOT=${env_variable_to_some_directory}/Dst.root \
clean build
I am trying to build Xcode project from command line, using iphonesimulator as SDK. Here is the command line:
xcodebuild -scheme SchemeName -configuration Debug -sdk iphonesimulator PLATFORM_NAME=iphonesimulator clean build
However, when I add a post-build action in Xcode like:
echo "PLATFORM_NAME: ${PLATFORM_NAME}"
it always outputs "PLATFORM_NAME: iphoneos" and not iphonesimulator.
Is this a bug, or there is something wrong in my build configuration? Thanks