Use xcodebuild to package Apple Platform apps
To package your Apple Platform applications the quickest way, you can use xcodebuild
in your terminal.
Before you begin:
-
You have installed the Command Line Tools for Xcode.
-
You have installed or updated gen-ir.
To complete this task:
-
Open your terminal, and then change directory to your project.
-
Run the following command:
xcodebuild clean
-
If you have an Xcode Workspace, run the following command:
noteYou must change the invocation of
xcodebuild
to match your project. You should at least replaceMyApp
andMyScheme
.xcodebuild archive \
-workspace MyApp.xcworkspace \
-scheme MyScheme \
-destination generic/platform=iOS \
-configuration Debug \
-archivePath MyApp.xcarchive \
DEBUG_INFORMATION_FORMAT=dwarf-with-dsym \
ENABLE_BITCODE=NO \
> MyApp.log.txtOr, if you have an Xcode project, run:
xcodebuild archive \
-project MyApp.xcodeproj \
-scheme MyScheme \
-destination generic/platform=iOS \
-configuration Debug \
-archivePath MyApp.xcarchive \
DEBUG_INFORMATION_FORMAT=dwarf-with-dsym \
ENABLE_BITCODE=NO \
> MyApp.log.txtOptionally, you can use
-archivePath
to set a different output location for the archive, and you can use> MyApp.log.txt
to set a different output location for the build log of the archive. -
Run
gen-ir
with your build log and the archive path in the following command. EnsureMyApp.log.txt
points to the exported build log, and thatMyApp.xcarchive/
is the newly-createdxcarchive
.Xcode workspace:
gen-ir MyApp.log.txt MyApp.xcarchive/
Xcode project:
gen-ir MyApp.log.txt MyApp.xcarchive/
-
To create a new ZIP archive:
a. Place the
xcarchive
at the root of the directory you want to archive. Thexcarchive
must be at the root of the ZIP archive.b. Ensure the directory does not contain any other subfolders or additional paths, so that they are not included in the ZIP archive.
c. Run:
zip -r MyApp.zip MyApp.xcarchive
-
To determine if the archive contains additional paths, run:
zipinfo MyApp.zip
-
In the output, ensure your
xcarchive
is the only folder at the root of the ZIP file:❯ zipinfo MyApp.zip
Archive: MyApp.zip
Zip file size: 1519917 bytes, number of entries: 78
drwxr-xr-x 3.0 unx 0 bx stor 23-Dec-13 16:37 MyApp.xcarchive/
drwxr-xr-x 3.0 unx 0 bx stor 23-Dec-13 16:36 MyApp.xcarchive/Products/
drwxr-xr-x 3.0 unx 0 bx stor 23-Dec-13 16:36 MyApp.xcarchive/Products/Applications/
drwxr-xr-x 3.0 unx 0 bx stor 23-Dec-13 16:36 MyApp.xcarchive/Products/Applications/MyApp.app/
... -
Upload your Apple Platform application to the Veracode Platform for analysis. See how to submit an application for analysis.
-
Optionally, to upload your archives with Veracode Software Composition Analysis:
a. Add the
Podfile.lock
file to the root of a different archive folder. The ZIP archive must be separate from the one that contains the.xcarchive
folder, as shown in the following command:zip MyApp-Podfile.zip Podfile.lock
b. Upload
MyApp-Podfile.zip
to the same scan as theMyApp.zip
that you previously uploaded.