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

Unclear if SPM is supported #151

Open
pepejeria opened this issue Apr 9, 2021 · 14 comments
Open

Unclear if SPM is supported #151

pepejeria opened this issue Apr 9, 2021 · 14 comments

Comments

@pepejeria
Copy link

pepejeria commented Apr 9, 2021

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.

@mathaeus
Copy link

While the README is not perfect about it, it is supported. See https://github.com/mono0926/LicensePlist#--package-path

@marci0907
Copy link

@mathaeus Can you give a brief how it can be used with SPM?

@mathaeus
Copy link

mathaeus commented Apr 13, 2022

@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 

@marci0907
Copy link

@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).

@mathaeus
Copy link

mathaeus commented Apr 13, 2022

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.

@sugitatestblue
Copy link
Contributor

sugitatestblue commented Jul 4, 2022

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.

@sugitatestblue
Copy link
Contributor

スクリーンショット 2022-07-04 17 22 16
Which should I choose?

@sugitatestblue
Copy link
Contributor

sugitatestblue commented Jul 5, 2022

スクリーンショット 2022-07-05 14 34 42

Cannot find 'Process' in scope

I selected LicensePlistCore.

@sugitatestblue
Copy link
Contributor

LicensePlist are no longer supported?

@mathaeus
Copy link

mathaeus commented Jul 6, 2022

@sugitatestblue as I mentioned above, this issue is about running LicensePlist on your SPM dependencies, NOT to install it via SPM.

@sugitatestblue
Copy link
Contributor

@mathaeus
I see.
So, LicensePlist doesn't recommend for installing via SPM, does it?

@mathaeus
Copy link

mathaeus commented Jul 7, 2022

@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.

@jooeungen
Copy link

@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.

@mathaeus
Copy link

@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

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

5 participants