LicensePlist
LicensePlist copied to clipboard
Unclear if SPM is supported
I am now using Swift Package Manager (SPM) instead of Cocoapods to add dependencies and would like to know if this library supports generating licences plist based on the SPM dependencies that I use.
I think that this library supports SPM based on going through the issues, but this is not mentioned at all in the README.md.
It would be great if the README.md could be updated with clear instructions in how to use this library with SPM. Only Cocoapods and Carthage are currently mentioned at the moment.
While the README is not perfect about it, it is supported. See https://github.com/mono0926/LicensePlist#--package-path
@mathaeus Can you give a brief how it can be used with SPM?
@marci0907
What you need is the --package-path
I use such a script to wrap the call to the license-plist
binary with all the parameters:
#!/bin/sh
GIT_ROOT_DIR=$(git rev-parse --show-toplevel)
${GIT_ROOT_DIR}/scripts/license_acknowledgements/license-plist --config-path ${GIT_ROOT_DIR}/scripts/license_acknowledgements/license_plist.yml --output-path ${GIT_ROOT_DIR}/path/to/Settings.bundle --prefix Acknowledgements --single-page --package-path ${GIT_ROOT_DIR}/path/to/xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
and the config file (license_plist.yml
) looks like this (to exclude internal packages to show up in the output):
exclude:
- myInternalPackage
@mathaeus But that is my issue. I'm trying to integrate licence-plist to the app via SPM (so not to a Package.swift) and I don't have the binary itself, but only the checked out repo (maybe I have missed sth).
The original issue is talking about using licence-plist
to generate the licenses output file based on your SPM dependencies, not how to integrate licence-plist
itself via SPM.
But to answer your question: I haven't tried adding licence-plist
itself to the project as an SPM dependency, but it looks like it should be straight-forward, given that there is a Package.swift
in the root of this repo which references the executable binary. So you would add it like any other Swift Package via the UI in the project I assume.
EDIT: I've also never tried calling a binary that is added via SPM to the Xcode project myself, but since licence-plist
is not a dependency for the app to work I integrated it differently, i.e. just downloaded the binary and put it into a dedicated folder.
I replaced Podfile
file to SPM.
version 3.11.0
I selected license-plist
unable to resolve product type 'com.apple.product-type.tool' for platform 'iphoneos'
It apprared.
Which should I choose?

I selected LicensePlistCore
.
LicensePlist are no longer supported?
@sugitatestblue as I mentioned above, this issue is about running LicensePlist
on your SPM dependencies, NOT to install it via SPM.
@mathaeus
I see.
So, LicensePlist
doesn't recommend for installing via SPM, does it?
@sugitatestblue kind of, yes.
In my opinion SPM doesn't offer the same "flexibility" as cocoapods when it comes to installing dependencies that work on the project alongside the dependencies that are needed to run the project. I therefore went for the solution of directly downloading the binary. Of course, the downside of that is that it's not versioned, so you need to keep track of the version yourself if you choose to do it like that.
@mathaeus
I have a question. I am integrating Swift Packages through Xcode and thus, does not have Package.swift file.
In this case, can I still use option --package-path to generate License list?
Thank you in advance.
@jooeungen the example I gave above is also showing how it looks for SPM via Xcode
Note: The --package-path
is pointing to the Package.resolved
file within your Xcode project, not to a Package.swift
file.
--package-path ${GIT_ROOT_DIR}/path/to/xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved