LicensePlist icon indicating copy to clipboard operation
LicensePlist copied to clipboard

Unclear if SPM is supported

Open pepejeria opened this issue 3 years ago • 15 comments

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.

pepejeria avatar Apr 09 '21 07:04 pepejeria

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

mathaeus avatar Jul 22 '21 14:07 mathaeus

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

marci0907 avatar Apr 13 '22 14:04 marci0907

@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 avatar Apr 13 '22 14:04 mathaeus

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

marci0907 avatar Apr 13 '22 15:04 marci0907

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.

mathaeus avatar Apr 13 '22 15:04 mathaeus

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 avatar Jul 04 '22 08:07 sugitatestblue

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

sugitatestblue avatar Jul 05 '22 05:07 sugitatestblue

スクリーンショット 2022-07-05 14 34 42 Cannot find 'Process' in scope

I selected LicensePlistCore.

sugitatestblue avatar Jul 05 '22 05:07 sugitatestblue

LicensePlist are no longer supported?

sugitatestblue avatar Jul 06 '22 04:07 sugitatestblue

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

mathaeus avatar Jul 06 '22 07:07 mathaeus

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

sugitatestblue avatar Jul 07 '22 01:07 sugitatestblue

@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 avatar Jul 07 '22 07:07 mathaeus

@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 avatar Apr 06 '23 02:04 jooeungen

@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

mathaeus avatar Apr 13 '23 13:04 mathaeus