apiaryio / drafter

API Blueprint Parser (C++)
https://apiblueprint.org/
MIT License
302 stars 54 forks source link

Add a third party licenses file #732

Closed kylef closed 5 years ago

kylef commented 5 years ago

The drafter release tarballs, and the releases and installations of Protagonist and Drafter.js don't always clearly specify their vendored dependencies license files.

This PR adds a THIRD_PARTY_LICENSES.txt file to the root of the repository, this is the standard policy for third party dependency licenses (examples elsewhere: https://github.com/oracle/opa-oda-chat/blob/1c87ca3a0a3eb864c16be8bcdb5eda1fb758ab22/THIRD_PARTY_LICENSES.txt, https://github.com/oracle/oci-python-sdk/blob/a7d5f87be08d2925cd312e2684867dc8c29df1df/THIRD_PARTY_LICENSES.txt).

Many of the licenses require that the copyright notice is with source and binary copies of the dependencies. Both the Homebrew package and the Archlinux AUR package should be updated to ensure that THIRD_PARTY_LICENSES.txt is present upon installation of Drafter when we make the next release.

To create the file, I've followed the format that our "black-belt" tool would generate using ---------separator--------- as a separator and package name (and version if possible). I have written a script which verifies that the committed state is correct in CI so that we will catch when it comes out of date, the script will print a message in the CI failure on what a user can do to continue. These scripts are similiar in design and naming to the existing make-tarball.sh and clang-format-check.sh scripts.

Dependencies
Additional changes

Upon merge, the following patches will be proposed to Protagonist and drafter.js so that the THIRD_PARTY_LICENSES.txt are present on installation of those packages along with adding THIRD_PARTY_LICENSES.txt to gitignores.

drafter.js
diff --git a/package.json b/package.json
index a299705..f1830a9 100644
--- a/package.json
+++ b/package.json
@@ -4,6 +4,7 @@
   "description": "Pure JS Drafter built with Emscripten",
   "main": "lib/drafter.nomem.js",
   "files": [
+    "THIRD_PARTY_LICENSES.txt",
     "drafter.d.ts",
     "lib/drafter.js",
     "lib/drafter.js.mem",
@@ -15,6 +16,7 @@
     "test": "node --version | grep -q -E \"v(4|6)\" && npm run test:exclude-await || npm run test:await",
     "build": "./scripts/wrap.js && docker run --rm -v $(pwd):/src -t apiaryio/emcc:1.38.11 scripts/emcbuild.sh",
     "clean": "docker run --rm -v $(pwd):/src -t apiaryio/emcc:1.38.11 scripts/emcclean.sh",
+    "prepack": "cp protagonist/drafter/THIRD_PARTY_LICENSES.txt .",
     "release": "scripts/release.sh"
   },
   "browser": {
Protagonist
diff --git a/package.json b/package.json
index 9215045..55f1cbb 100644
--- a/package.json
+++ b/package.json
@@ -23,15 +23,16 @@
   },
   "scripts": {
     "build": "node-gyp build",
+    "prepack": "cp drafter/THIRD_PARTY_LICENSES.txt THIRD_PARTY_LICENSES.txt",
     "test:exclude-await": "mocha --exclude test/await-test.js",
     "test:await": "mocha",
     "test": "node --version | grep -q -E \"v(4|6)\" && npm run test:exclude-await || npm run test:await"
   },
   "files": [
+    "THIRD_PARTY_LICENSES.txt",
     "binding.gyp",
     "src/*.cc",
     "src/*.h",
-    "drafter/LICENSE",
     "drafter/common.gypi",
     "drafter/drafter.gyp",
     "drafter/src/*.cc",
@@ -46,7 +47,6 @@
     "drafter/src/refract/*.h",
     "drafter/src/refract/dsd/*.cc",
     "drafter/src/refract/dsd/*.h",
-    "drafter/ext/boost/LICENSE_1_0.txt",
     "drafter/ext/boost/boost",
     "drafter/ext/snowcrash/src/*.cc",
     "drafter/ext/snowcrash/src/*.h",
@@ -54,12 +54,10 @@
     "drafter/ext/snowcrash/src/win/RegexMatch.cc",
     "drafter/ext/snowcrash/ext/markdown-parser/src/*.cc",
     "drafter/ext/snowcrash/ext/markdown-parser/src/*.h",
-    "drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/README.md",
     "drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/*.c",
     "drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/*.h",
     "drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/*.c",
     "drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/*.h",
-    "drafter/ext/variant/LICENSE.md",
     "drafter/ext/variant/include/mpark/*.hpp"
   ],
   "license": "MIT"
Caveats