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

Include the LICENSE in every crate #842

Merged
merged 1 commit into from
Jul 23, 2020
Merged

Conversation

cuviper
Copy link
Contributor

@cuviper cuviper commented Jul 23, 2020

Motivation

The MIT license states:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

Solution

Therefore the LICENSE files should be present in each crate directory,
so they are included with cargo publish.

The MIT license states:

> The above copyright notice and this permission notice
> shall be included in all copies or substantial portions
> of the Software.

Therefore the LICENSE files should be present in each crate directory,
so they are included with `cargo publish`.
@cuviper cuviper requested review from hawkw, jtescher, yaahc and a team as code owners July 23, 2020 16:20
@cuviper
Copy link
Contributor Author

cuviper commented Jul 23, 2020

Currently, the LICENSE is only present in the workspace root and in tracing-core/.

Another option is to symlink the same file from the root to each directory, which does get dereferenced when publishing from unix hosts, but I think this has problems from Windows.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me --- thanks for noticing and fixing this!

Another option is to symlink the same file from the root to each directory, which does get dereferenced when publishing from unix hosts, but I think this has problems from Windows.

I think just duplicating it is fine — I don't think any tracing crate has been published from a Windows machine yet, but I'd rather not have to worry about it later if someone does end up publishing from Windows.

Do you happen to know if using the Cargo.toml license-file field with a relative path like

license-file = "../LICENSE"

would result in the actual license file being included into every published crate? If so, that might be a slightly nicer option, but I'm not sure how Cargo handles this.

@cuviper
Copy link
Contributor Author

cuviper commented Jul 23, 2020

Do you happen to know if using the Cargo.toml license-file field with a relative path like

license-file = "../LICENSE"

would result in the actual license file being included into every published crate? If so, that might be a slightly nicer option, but I'm not sure how Cargo handles this.

Ah, it looks like that is a feature since Cargo 1.43:

The license-file file is automatically included during publish, even if it is not explicitly listed in the include list or is in a location outside of the root of the package. #7905

You get a warning if you have both fields:

warning: only one of `license` or `license-file` is necessary

But crates.io calls it "non-standard" if you only have the file, like here on pretty-git-prompt. I'm not sure what it displays if you have both...

edit: looks like "non-standard" only comes up when there's no license field:
https://github.com/rust-lang/crates.io/blob/a251368963d55ff12ecb65249cfe96950deb867b/src/models/version.rs#L252

@hawkw
Copy link
Member

hawkw commented Jul 23, 2020

Okay, thanks for looking into that. For now, I think just duplicating the license text is the best approach. I'm going to go ahead and merge this.

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

Successfully merging this pull request may close these issues.

2 participants