Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Package license generation #28

Open
fgeistert opened this issue Jan 10, 2024 · 0 comments
Open

Swift Package license generation #28

fgeistert opened this issue Jan 10, 2024 · 0 comments

Comments

@fgeistert
Copy link
Contributor

fgeistert commented Jan 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant