Hi,

recently there are discussions related to the 0.9.0rcX releases about properly mentioning code/files from other projects.

Although there is no technical solution to automatically identify such code/files (unless you have a big machinery just for that topic...), I think we can at least help ourselves here a little bit.

The idea is to have a "magic word" added to files that have been taken from other projects. That "magic word" can then be used to check whether the file is mentioned in `LICENSE`.

Proposal is to have that check the mention of those files during the regular build (Gradle `check` task).

The only convention is to use the same "magic word" in those files. It doesn't matter where that appears in the file - it just has to appear.

In other words: when you copy a file (from a source with a compatible license!) add that "magic word" CODE_COPIED_TO_POLARIS somewhere.

The necessary build code is up in this PR https://github.com/apache/polaris/pull/904

A POC with the "magic word" added to files (based on ) is available in this branch: https://github.com/snazy/polaris/tree/copied-add-magic - a `./gradlew check --continue` (or just the necessary tasks `./gradlew checkForCopiedCode checkCopiedCodeMentionsExist --continue`) fails as expected as the LICENSE does not include the marked files (see example snippet below). A "reverse check" (mentioned files don't exist) is also there.

There's also a rudimentary content-type detection to exclude known binary files (e.g. image/png) from being scanned for the "magic word".

Robert




> Task :checkCopiedCodeMentionsExist FAILED
The following 2 files mentioned in LICENSE do not exist, fix the LICENSE file.

* foo/bar/baz
* left/over/mention/of/a/file

> Task :checkForCopiedCode FAILED
The following 29 files have the CODE_COPIED_TO_POLARIS marker but are not mentioned in LICENSE, add those in an appropriate section.

* server-templates/api.mustache
* server-templates/apiService.mustache
* server-templates/apiServiceImpl.mustache
* server-templates/bodyParams.mustache
* server-templates/formParams.mustache
* server-templates/headerParams.mustache
* server-templates/pojo.mustache
* server-templates/queryParams.mustache
* site/layouts/community/list.html
* site/layouts/docs/baseof.html
* site/layouts/home/baseof.html
* site/layouts/home/list.html
* site/layouts/partials/community_links.html
* site/layouts/partials/favicons.html
* site/layouts/partials/head.html
* site/layouts/partials/navbar.html
* site/layouts/partials/sidebar-releases-tree.html
* site/layouts/partials/sidebar-releases.html
* site/layouts/partials/trimZeroPrefix.html
* site/layouts/shortcodes/redoc-polaris.html
* spec/rest-catalog-open-api.yaml



--
Robert Stupp
@snazy

Reply via email to