326
326
327
327
# ********** Archive ****************************
328
328
329
+ # Drop and recreate the LAMBDA_BUILD_DIR (defaults to `.build/lambda`)
329
330
prepareLambdaDir () {
330
331
rm -rf " ${LAMBDA_BUILD_DIR} "
331
332
mkdir -p " ${LAMBDA_BUILD_DIR} "
332
333
}
333
334
335
+ # Clone copy the file passed in Argument $1 into the LAMBDA_BUILD_DIR (defaults
336
+ # to `.build/lambda`)
334
337
embedInZip () {
335
338
# a - preserve attributes
336
339
# c - clone
337
340
# H - follow symbolic links
338
341
cp -acH " $1 " " ${LAMBDA_BUILD_DIR} /"
339
342
}
343
+ # This embeds a subdirectory contains within the product directory in the
344
+ # Zip directory. For example Sources/MacroApp/public.
340
345
embedSourcesDirInZip () {
341
346
if [[ -d " ${SPM_PACKAGE_SOURCE_DIR} /Sources/${PRODUCT_NAME} /$1 " ]]; then
342
347
if [[ " x${verbose} " = " xyes" ]]; then
@@ -351,6 +356,9 @@ embedSourcesDirInZip() {
351
356
fi
352
357
}
353
358
359
+ # This copies dylibs required by the built product (in .build/x86_64.../release)
360
+ # to the zip.
361
+ # It uses `objdump` to discover the required libs.
354
362
copySharedLibraryDependencies () {
355
363
XTOOLCHAIN_SDK=$( jq -r " .sdk" ${SPM_DESTINATION_FILE} )
356
364
USED_LIBS=$( objdump -p ${SPM_BUILD_DIR} /${TARGET} /${SPM_BUILD_CONFIG} /${PRODUCT_NAME} \
@@ -396,18 +404,25 @@ copySharedLibraryDependencies() {
396
404
done
397
405
}
398
406
407
+ # This just copies the executable product into the LAMBDA_BUILD_DIR
399
408
copyBuildProduct () {
400
409
cp -ac " ${SPM_EXECUTABLE_BUILD_PRODUCT} " \
401
410
" ${LAMBDA_BUILD_DIR} /${LAMBDA_EXECUTABLE_NAME} "
402
411
}
403
412
413
+ # This copies Macro-like product resource directories into the zip. Those live
414
+ # alongside the source files, for example Sources/MacroApp/public (and /view).
415
+ # Note: do not mix up w/ SPM resource directories, which work differently.
404
416
copyProductResources () {
405
417
# make configurable somehow
418
+ # defaults to: views public
406
419
for dir in ${LAMBDA_SOURCE_RELATIVE_RESOURCEDIRS} ; do
407
420
embedSourcesDirInZip $dir
408
421
done
409
422
}
410
423
424
+ # This zips the LAMBDA_BUILD_DIR (.build/lambda) into a zipfile for
425
+ # distribution.
411
426
zipBuildDir () {
412
427
# X - exclude extended attributes
413
428
# 9 - higher compression
0 commit comments