Export all localizations on the command line in Xcode - ios

I have 26 languages successfully localized and tested. I am able to successfully export all 26 localizations with option: "Editor" -> "Export for Localization...", then selecting all of them.
However, when I use the following xcodebuild command, it exports my default language "en", and nothing else.
xcodebuild -exportLocalizations -localizationPath TempLocalizationExport
How do I export all twenty-six Localizations rather than just "en"?
There are no command line errors outputted from the command.
I've seached everywhere for official xcodebuild commandline command documentation on developer.apple.com, and I can't find a verbose and helpful source that addresses additional -exportLocalizations options and standard behavior.

According to the docs:
To export localizations, enter this command in Terminal, replacing the
dirpath and projectname arguments:
xcodebuild -exportLocalizations -localizationPath <dirpath> -project <projectname> [[-exportLanguage <targetlanguage>]]
The exported XLIFF files are placed in dirpath. Optionally, use the
exportLanguage argument to export other localizations.
UPDATE:
The OP discovered that multiple languages can be exported by repeating the -exportLanguage argument. For example, this command exports two languages:
xcodebuild -exportLocalizations -localizationPath TempLocalizationExport -exportLanguage es -exportLanguage ru

Seems xcodebuild doesn't support auto export all localizations at this time.
But we can do it through Xcode interface.
Also it's possible auto select all localizations with a script. Read knownRegions section in project.pbxproj, loop to argument format.

Related

Dyldinfo commamd not found

mac os 10.13.4
I write the command 'dyldinfo' in shell, but is wroing
-bash: dyldinfo: command not found
hope you help me
On recent versions of macOS you can run the tool with xcrun dyldinfo (as long as you have Xcode installed)
First, make sure you have either Xcode or Command Line Tools installed.
If you have one of those, you can find dyldinfo in /Library/Developer/CommandLineTools/usr/bin.
So, to run it, type this into your bash:
/Library/Developer/CommandLineTools/usr/bin/dyldinfo
You can check the dyldinfo path using following command:
$ xcrun --sdk dyldinfo
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dyldinfo
Showing that the command dyldinfo is under the path:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dyldinfo, which means commands like dyldinfo belong to Toolchains of Xcode. Therefore, 'dyldinfo' cannot be used as a separate shell command. Instead, you must invoke it by using xcrun <sdk>.
$ xcrun dyldinfo
Usage: dyldinfo [-arch <arch>] <options> <mach-o file>
-dylibs print dependent dylibs
-dr print dependent dylibs and show any recorded DR info
-rebase print addresses dyld will adjust if file not loaded at preferred address
-bind print addresses dyld will set based on symbolic lookups
-weak_bind print symbols which dyld must coalesce
-lazy_bind print addresses dyld will lazily set on first use
-export print addresses of all symbols this file exports
-opcodes print opcodes used to generate the rebase and binding information
-function_starts print table of function start addresses
-export_dot print a GraphViz .dot file of the exported symbols trie
-data_in_code print any data-in-code information

Xcode 8 and exportPath

Starting with Xcode 8, my TeamCity builds no longer create an Artifact with the proper name. Here is my command line to export archive:
xcodebuild -project "${XCODE_PROJECT}" -exportArchive \
-archivePath "${ARTIFACT_DIR}${ARTIFACT_NAME}.xcarchive" \
-exportPath "${ARTIFACT_DIR}${ARTIFACT_NAME}.ipa" \
-exportOptionsPlist ./export-appstore.plist
If ARTIFACT_DIR and ARTIFACT_NAME result in "/builds/myApp-1.0.1.ipa", for example, xcodebuild will actually create "/builds/myApp-1.0.1.ipa/myApp.ipa".
The "man" documentation for '-exportPath' says "Specifies the destination for the exported product, including the name of the exported file". But clearly it's assuming the file name from the Xcode project and using the entire parameter just for the path.
Is this a known bug that will be fixed, or did they remove functionality with this latest version of Xcode?

(C++ Builder) DWARF debug info in separate file?

Is there a way to instruct C++ Builder's linker to output DWARF debug information (64-bit C++ apps) in standalone file rather than inject it directly into executable? I.e. the option similar to "Place debug information in separate TDS file" (which does not work for DWARF debug format).
If there is no such option - is there a way to strip info from already compiled executable?
To place debug info in separate file follow below steps
// Build
$ clang -O2 -g -o hello.full hello.c
// Package hello.stripped is run as "hello" in production environment
$ strip -o hello.stripped hello.full
// Extract debug info to separate file
$ objcopy --only-keep-debug hello.full hello.debug
// Create a section which contains a reference to debug file
$ objcopy --strip-debug --add-gnu-debuglink=hello.debug hello.full hello
// Debug - GDB automatically reads hello.debug
$ gdb hello
. . .
Reading symbols from ./hello...
Reading symbols from /homes/syrajendra/hello.debug...done.
(gdb)
// Core from hello.stripped
$ gdb --core core-file --exec hello
Assuming you are on a platform with GNU Binutils you can use objcopy to extract the DWARF information to a separate file as a post-compilation step. If you like you can then use strip to remove the debugging information from the executable binary.

xcodebuild target name with Umlaut

I am trying to build an iOS App using Jenkins via the xcodebuild command.
The problem is that xcodebuild does not detect the target with the German Umlaut ü.
$ /usr/bin/xcodebuild -target AppNameWithUmlautü -configuration Debug clean build
gives me following error:
xcodebuild: error: The project 'AppNameWithUmlautü.xcodeproj' does not contain a target named 'AppNameWithUmlautü'.
I checked the existence of the target using following command:
xcodebuild -list
Information about project "AppNameWithUmlautü":
Targets:
AppNameWithUmlautü
AppNameWithOutUmlaut
Build Configurations:
Debug
Release
Ad Hoc
If no build configuration is specified and -scheme is not passed then "Release" is used. This project contains no schemes.
The target without Umlaut works.
Xcode uses the "decomposite" UTF-8 representation for Umlauts in the target name: "ü" is represented as 75 CC 88. 75 is "u", and CC 88 is the UTF-8 sequence for the "COMBINING DIAERESIS".
The shell, on the other hand, uses the "composite" UTF-8 representation C3 BC for "ü".
So the target that you give on the command line does not match the target name in the Xcode project (and one could argue that this is a bug in Xcode).
I have no knowledge about Jenkins, but if you somehow can use the output of the xcodebuild -list command to get the decomposite UTF-8 target name and copy that into your Makefile, shell script or whatever you have, then this should help.

xcodebuild command line ignoring GCC_PREPROCESSOR_DEFINITIONS

I'm trying to launch xcodebuild with different preprocessing macros.
I've tried :
xcodebuild -scheme myscheme \
-configuration "Archive" \
-sdk "iphoneos5.1"
archive \
CONFIGURATION_BUILD_DIR=../build \
GCC_PREPROCESSOR_DEFINITIONS=ADHOC
but i got a compilation error due to the fact the preprocessor was not used:
I couldn't see it with the -D flag of the compilation command
But it is displayed at the beginning of the script
Build settings from command line:
CONFIGURATION_BUILD_DIR = ../build
GCC_PREPROCESSOR_DEFINITIONS = ADHOC
SDKROOT = iphoneos5.1
The code at the origin of the compilation error is:
#ifdef ADHOC
NSUInteger toto = 0;
#endif
but i get a use of undeclared identifier error for toto
ps : if i do define Preprocessor Macros in Xcode, then these values are used, mine are overridden, and archiving is done. But I do want to make several builds based on different preprocessor definitions (which sounds a better idea than creating new build configurations or schemes to me)
I have to use double quote and remove the $value.
I had,
GCC_PREPROCESSOR_DEFINITIONS='$value ${e}',
which did not work, but
GCC_PREPROCESSOR_DEFINITIONS="${e}"
works.
Where, e is variable inside a loop,
environments=("TEST1" "TEST2" "TEST3" "TEST4" "TEST5" "PROD")
for e in "${environments[#]}"
do
....... commands
done
If I use
GCC_PREPROCESSOR_DEFINITIONS='$value ${e}'
Then I have to use like,
GCC_PREPROCESSOR_DEFINITIONS='$value ADHOC=1'
This worked in one of build script.

Resources