https://github.com/sebj/swiftpm-xcode-project-licenses
Generate a single .json file with the licenses for all Swift Package Manager dependencies of an Xcode project
https://github.com/sebj/swiftpm-xcode-project-licenses
license python swift xcode
Last synced: 14 days ago
JSON representation
Generate a single .json file with the licenses for all Swift Package Manager dependencies of an Xcode project
- Host: GitHub
- URL: https://github.com/sebj/swiftpm-xcode-project-licenses
- Owner: sebj
- License: unlicense
- Created: 2020-02-20T14:54:52.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-21T08:38:49.000Z (over 3 years ago)
- Last Synced: 2025-03-26T12:11:53.359Z (about 1 month ago)
- Topics: license, python, swift, xcode
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
**Generate a single `.json` file with the licenses of all Swift Package Manager dependencies of an Xcode project**
* Python 3
* Swift Package Manager dependencies only
* Tested with Xcode 13.0## Usage Example
As part of an Xcode target's 'Run Script' build phase:
`$SRCROOT/generate-licenses.py --build-dir $BUILD_DIR --output-file $SRCROOT/licenses.json`
### Additional Params
- Use `-p $PROJECT_DIR/ProjectName.xcodeproj` to load the version and url info from `Package.resolved` in the project
- Use `-w $PROJECT_DIR/WorkspaceName.xcworkspace` to load the version and url info from `Package.resolved` file in the workspace
### Notes
- If both the project (`-p`) and workspace (`-w`) arguments are specified, then the workspace (`-w`) will be ignored
## Output Format
- `libraryName` is the name of the repo and `name` is the name of the SPM Package as defined as defined in the dependency's `Package.swift`
- `text` field will be missing if a dependency does not provide a license file at the root of the repo
```json
{
"licenses": [
{
"libraryName": "",
"text": "",
"name": "",
"version": "",
"url": ""
},
{
...
}
]
}
```