iOS code analysis command-line syntax
The command-line syntax to translate iOS code using Xcodebuild is:
sourceanalyzer -b <build_id> xcodebuild [<compiler_options>]
where <compiler_options> are the supported options that are passed to the Xcode compiler. You must include the build option with any <compiler_options>. The OpenText SAST Xcodebuild integration does not support the output format of alternate build commands such as xcodebuild archive.
Xcodebuild compiles the source code when you run this command.
To exclude files from the analysis, use the -exclude option (see Translation Options). All source files that match the exclude specification are not translated, even if they are included in the Xcode build. The following is an example:
sourceanalyzer -b MyProject -exclude "**/TestFile.swift" xcodebuild clean build
If your application uses any property list files (for example, <file>.plist), translate these files with a separate sourceanalyzer command. Use the same build ID that you used to translate the project files. The following is an example:
sourceanalyzer -b MyProject <path_to_plist_files>
If your project uses CocoaPods, include -workspace to build the project. For example:
sourceanalyzer -b DemoAppSwift xcodebuild clean build -workspace DemoAppSwift.xcworkspace -scheme DemoAppSwift -sdk iphonesimulator
After the translation is complete, you can perform the analysis phase and save the results in an FPRÂ file, as shown in the following example:
sourceanalyzer -b DemoAppSwift -scan -f MyResults.fpr