Cargo support for multiple license files?


#1

Cargo supports the license-file key in Cargo.toml. However, it only supports one license file. Might it be worth allowing that key to accept an array of files as well? I’m working on a project right now where different parts of the code are covered by different licenses.


#2

Cargo follows SPDX 2.1, which allows specifying multiple licenses.

https://spdx.org/spdx-specification-21-web-version

Ctrl-F “Representing Multiple Licenses”


#3

Nevermind. You’re referring to license-file, not license.


#4

For now, I’d suggest combining them into one license file, describing which parts of the code use which license.

It doesn’t seem unreasonable to allow an array, but I would suggest renaming it to license-files and making it mutually-exclusive with license-file, to avoid parsing incompatibilities with existing code that expects license-file to contain one file.


#5

OK, sounds good. Posted an issue here.