vtourraine / AcknowList

Acknowledgements screen displaying a list of licenses, for example from CocoaPods and Swift Package Manager dependencies.
MIT License
784 stars 59 forks source link

Ability to run as a script, without adding to the target #118

Closed richardtop closed 7 months ago

richardtop commented 7 months ago

I'm interested in using this product as a script, i.e. just to launch it from the command line and to get the output document with all of the licenses concatenated somewhere.

This way I'd be able to use the AcknowList without bundling it into the application.

So, to summarize, it would be good to split the library into two pieces:

Then, if someone wants to display the list in the app, he'll have to use both of the components and if someone wants just to generate the list, the first component will be able to do the job.

vtourraine commented 7 months ago

Hello Richard, and thanks for reaching out.

That’s an intriguing idea. Could you give us a bit more context to understand what you’re trying to do?

“Generating the list” is arguably already done by CocoaPods and SPM. AcknowList simply adds its own model to load and merge the 2, but the list manipulation is really minimal. So I’m not sure what logic you’d like to extract. Of course, any library could be split into smaller components, but we want to keep things easy-to-understand and easy-to-use too.

richardtop commented 7 months ago

What we'd like to do is to get a txt file with the concatenated list of a few specific dependencies used in the target. For example, I'm installing the following dependencies: https://github.com/richardtop/CalendarKit https://github.com/realm/realm-swift

So it should take these two files: https://github.com/richardtop/CalendarKit/blob/master/LICENSE.md https://github.com/realm/realm-swift/blob/master/LICENSE

And concatenate them as a part of the build script and then output a single txt file containing all of the content of the selected resources.

vtourraine commented 7 months ago

OK but if it’s just to concatenate 2 text files, I’m not sure why you need AcknowList. You can just use a custom build script in Xcode. (Apologies if I’m misunderstanding your reply.)

richardtop commented 7 months ago

Just curious if this package can automatically go thru every dependency and extract the License.MD or similar files and do the concatenation... Or is it simply not built for this specific purpose?

vtourraine commented 7 months ago

When you say “go thru every dependency”, are you talking about Swift Packages (SPM) or CocoaPods ?

richardtop commented 7 months ago

SPM in my case.

vtourraine commented 7 months ago

OK, so the thing is that SPM doesn’t track licences. You could use the GitHub API to automate fetching the licences based on the package repo URLs (https://docs.github.com/en/rest/licenses/licenses#get-the-license-for-a-repository). But unless you have lots of dependencies, you’d probably be better getting them manually.

Feel free to fork AcknowList and take the parts that could help you, but it seems to me like it’s not quite the right tool for this job.

richardtop commented 7 months ago

Clear, so another problem is that I'm not using GitHub... To me it seems now that the AcknowList is a completely different project, orthogonal to what I'm trying to achieve... ?

vtourraine commented 7 months ago

If the packages are not on GitHub, you’ll need another way to find the licenses.

AcknowList’s goal is to display the list of dependencies within an app. With CocoaPods, you always get the licenses. With SPM, you need extra work, otherwise it just opens the repo URL.

richardtop commented 7 months ago

Yeah, clear, then this is definitely not for my use-case. Thanks a lot of clarifying, and for this great project!