Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Add license header to files that have no header - #2469

Merged
tlakollo merged 1 commit into
mainfrom
AddLicenseHeaders
Mar 31, 2022
Merged

tlakollo merged 1 commit into
mainfrom
AddLicenseHeaders

Conversation

@tlakollo

Copy link
Copy Markdown
Contributor

This PR adds the following message as header

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

for files that dont contain any license information

@tlakollo

tlakollo commented Dec 29, 2021 •

Copy link
Copy Markdown
Contributor Author

The runtime repository has license headers for tests and files. Currently, the linker repo does not have a license displayed in all files, with most testing files not having any header. Some concern brought by @MichalStrehovsky is that some of these files may precede the acquisition made by Microsoft and in that case is not clear if we can copyright them.
Having said that, the files under some other license haven't been changed and this PR only adds to files with no license explicitly displayed

@marek-safar

Copy link
Copy Markdown
Contributor

I'd not be too concerned with copyright for test files, especially if they are small.

@mrvoorhe could you comment with explicit approval too?

@vitek-karas

Copy link
Copy Markdown
Member

I'm perfectly OK adding the license header to everything - makes it simple and consistent.
That said, maybe we should change the editor config to make this into a warning:

linker/.editorconfig

Lines 103 to 105 in 1a6468f

# IDE0073: File header
dotnet_diagnostic.IDE0073.severity = suggestion
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.

In that case linter would catch missing headers and fail the CI (and running it locally should actually add the header there for you).

@tlakollo

tlakollo commented Jan 4, 2022

Copy link
Copy Markdown
Contributor Author

I'm perfectly OK adding the license header to everything - makes it simple and consistent.

What about files that currently have a different license header for example AssemblyResolver.cs which has a Novell license?

@vitek-karas

Copy link
Copy Markdown
Member

I guess we will need to involve somebody who understands licensing. The LICENSE.txt in the root doesn't mention Novell at all, it's purely a .NET Foundation license. I assume that we would need to either change the license for the file or add something to the main license.

@MichalStrehovsky

Copy link
Copy Markdown
Member

I would not touch the files that have existing license headers - see dotnet/runtime#63146 (comment).

I don't know if we have existing guidance from CELA on source files that are old, but don't have any licensing header whatsoever.

It should be fine to add the header to any files added in the past ~5 years (and it is our policy to have those headers).

@tlakollo

tlakollo commented Jan 24, 2022 •

Copy link
Copy Markdown
Contributor Author

Following CELA guidance we can:

  • Add Novel, Xamarin, and others to our notice file
  • Add the DFN license information at the start of the file once Microsoft had made changes to the file

@tlakollo

Copy link
Copy Markdown
Contributor Author

Files that still have previous license headers and haven't been modified are:

  • linker\src\linker\Linker\TypePreserve.cs
  • linker\src\linker\Linker\Tracer.cs
  • linker\src\linker\Linker\MethodAction.cs
  • linker\src\linker\Linker.Steps\RegenerateGuidStep.cs

Files from project:

  • linker\src\analyzer\analyzer.csproj

@vitek-karas

Copy link
Copy Markdown
Member

If these files are not modified, then we should keep them as-is.
For the rest I think this makes sense. But please get a review from @richlander at least.

@richlander

Copy link
Copy Markdown
Member

The LICENSE.txt in the root doesn't mention Novell at all

That's what the 3PN is for.

Here are some good rules:

  • Do: Add .NET Foundation copyright notice to all files, including those with no notice.
  • Do: Add .NET Foundation notice to the top even if there are other notices. That's just a sanity win for consistency for our project.
  • Do: Add .NET Foundation notice for files we never modified. It makes it clear that these files are covered by our MIT license and our 3PN. Also, it just helps with our sanity. Let's avoid special rules where we can. Also, if someone complains about this practice, we can address it at the time. We can beg for forgiveness based on a legit intent to improve clarity.
  • Do not: remove/modify the Novell notice (ever).
  • Do: If something feels odd of wrong, ask.

@sbomer sbomer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! It's probably worth re-doing the changes on top of the latest commit from a fresh state to make sure there are no unrelated changes introduced by accident.

Comment thread .editorconfig Resolved
@tlakollo
tlakollo force-pushed the AddLicenseHeaders branch from 5c1ca25 to 9739ff5 Compare March 28, 2022 03:25
@tlakollo

Copy link
Copy Markdown
Contributor Author

@richlander I think this PR is ready for review, PTAL

@tlakollo

Copy link
Copy Markdown
Contributor Author

Every commit now is potentially a merge conflict, so it will be nice to merge this as soon as possible to prevent unnecessary rework

…ginning of the file

Some of the files that hold a license from a third party now have the two licenses as header files
Linker now uses the sdk format of license header instead of the runtime one
Added having the license header as warning in the editor config
Added THIRD-PARTY-NOTICES.TXT file to the repo root
@tlakollo
tlakollo force-pushed the AddLicenseHeaders branch from 6d42017 to f50b81e Compare March 31, 2022 18:56

@sbomer sbomer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

@tlakollo
tlakollo merged commit 4f0d349 into main Mar 31, 2022
@tlakollo
tlakollo deleted the AddLicenseHeaders branch March 31, 2022 22:21
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…ginning of the file (dotnet/linker#2469)

Some of the files that hold a license from a third party now have the two licenses as header files
Linker now uses the sdk format of license header instead of the runtime one
Added having the license header as warning in the editor config
Added THIRD-PARTY-NOTICES.TXT file to the repo root

Commit migrated from dotnet/linker@4f0d349
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants