ios-starter
ios-starter copied to clipboard
Swift Package license generation
Currently, we use LicensePlist to automatically generate licenses. However, we only consider dependencies inside the Xcode project and dependencies from each Swift Package are ignored. This is a problem, especially with the the SPM-based modularization of the project.
To fix this, the following snippet can be used:
export PATH="$PATH:/opt/homebrew/bin"
if which /usr/libexec/PlistBuddy >/dev/null; then
version="$MARKETING_VERSION"
build="$CURRENT_PROJECT_VERSION"
/usr/libexec/PlistBuddy "$SRCROOT/$PRODUCT_NAME/SupportingFiles/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:2:DefaultValue $version ($build)"
else
echo "warning: PlistBuddy not found"
fi
if which license-plist >/dev/null; then
base_command="license-plist --output-path $PRODUCT_NAME/SupportingFiles/Settings.bundle --config-path $PRODUCT_NAME/SupportingFiles/license_plist.yml --package-path $PROJECT_FILE_PATH/project.xcworkspace/xcshareddata/swiftpm/Package.swift --suppress-opening-directory --package-paths"
# Find all Package.swift files in Modules/ directory and append them to the command
for package in $PROJECT_DIR/Modules/*/Package.swift; do
base_command+=" $package"
done
eval $base_command
else
echo "warning: license-plist not installed, download from https://github.com/mono0926/LicensePlist"
fi
Note: only the execution of the license-plist was changed, the top part stays the same.