Skip to content

Commit

Permalink
Generate NOTICE.xml file by running 'yarn update-licenses' command
Browse files Browse the repository at this point in the history
  • Loading branch information
reznord committed Mar 18, 2018
1 parent fd5e9ad commit 7d34177
Show file tree
Hide file tree
Showing 11 changed files with 3,321 additions and 16,996 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage/
/e2e_tests/videos/
mvn/
dist/
NOTICE.xml
16,161 changes: 2,587 additions & 13,574 deletions LICENSES.txt

Large diffs are not rendered by default.

3,996 changes: 575 additions & 3,421 deletions NOTICE.txt

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"prepare-jar": "node ./scripts/prepare-mvn-package.js",
"jar": "yarn build && mvn package",
"version-pom": "node ./scripts/set-pom-version.js -f ./pom.xml -v $npm_package_version",
"version": "npm run version-pom && git add ./pom.xml"
"version": "npm run version-pom && git add ./pom.xml",
"update-licenses": "sh ./scripts/generate_licenses.sh"
},
"lint-staged": {
"linters": {
Expand Down Expand Up @@ -98,6 +99,7 @@
"html-webpack-plugin": "^2.30.1",
"jest": "^21.0.1",
"jest-cli": "^21.0.1",
"js2xmlparser": "^3.0.0",
"json-loader": "^0.5.7",
"lint-staged": "^4.1.3",
"ncp": "^2.0.0",
Expand Down
16 changes: 16 additions & 0 deletions scripts/generate_licenses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

NOTICE_FILE="./NOTICE.txt"
NOTICE_FILE_XML="./NOTICE.xml"
LICENSES_FILE="./LICENSES.txt"

# Generate NOTICE.txt with list of dependencies and their license
# Limit to runtime dependencies
cat ./scripts/static_data/NOTICE_HEADER.txt > $NOTICE_FILE && yarn licenses list --production >> $NOTICE_FILE;
cat ./scripts/static_data/NOTICE_XML_HEADER.txt > $NOTICE_FILE_XML && yarn licenses list --production --json --no-progress | node ./scripts/generate_licenses_xml.js >> $NOTICE_FILE_XML;

# Generate LICENSES.txt with list of full text version of the licenses that dependecies use
# Limit to runtime licenses
cat ./scripts/static_data/LICENSES_HEADER.txt > $LICENSES_FILE && yarn licenses generate-disclaimer --production >> $LICENSES_FILE;

exit 0;
70 changes: 70 additions & 0 deletions scripts/generate_licenses_xml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2002-2018 "Neo4j, Inc"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const js2xmlparser = require('js2xmlparser')
const externalDependencies = require('./static_data/external_dependencies')

process.stdin.setEncoding('utf8')

let data = ''

process.stdin.on('readable', () => {
const chunk = process.stdin.read()
if (chunk !== null) {
data += chunk
}
})

process.stdin.on('end', () => {
let packagesList = parseJson(data)

process.stdout.write(packagesList)
process.exit(1)
})

function buildDependencyObject (id, name, license) {
const tempObj = { '@': { id: '', name: '' }, license: '' }
tempObj['@']['id'] = id
tempObj['@']['name'] = name
tempObj['license'] = license

return tempObj
}

function parseJson (data) {
let parsedObj = JSON.parse(data).data.body

const resArr = [
...externalDependencies.map(dep =>
buildDependencyObject(dep[0], dep[1], dep[2])
),
...parsedObj.map(dep => buildDependencyObject(dep[0], dep[0], dep[2]))
]

let res = {
'missing-artifact': {
artifact: resArr
}
}

let js2xmlparseOptions = { declaration: { include: false } }

return js2xmlparser.parse('licensing-requirements', res, js2xmlparseOptions)
}
5 changes: 5 additions & 0 deletions scripts/static_data/LICENSES_HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This file contains the full license text of the included third party
libraries. For an overview of the licenses see the NOTICE.txt file.


-----
25 changes: 25 additions & 0 deletions scripts/static_data/NOTICE_HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright © 2002-2018 Network Engine for Objects in Lund AB (referred to
in this notice as "Neo Technology")
[http://neotechnology.com]

This product includes software ("Software") developed by Neo Technology.

The copyright in the bundled Neo4j graph database (including the
Software) is owned by Neo Technology. The Software developed and owned
by Neo Technology is licensed under the GNU GENERAL PUBLIC LICENSE
Version 3 (http://www.fsf.org/licensing/licenses/gpl-3.0.html) ("GPL")
to all third parties and that license, as required by the GPL, is
included in the LICENSE.txt file.

However, if you have executed an End User Software License and Services
Agreement or an OEM Software License and Support Services Agreement, or
another commercial license agreement with Neo Technology or one of its
affiliates (each, a "Commercial Agreement"), the terms of the license in
such Commercial Agreement will supersede the GPL and you may use the
software solely pursuant to the terms of the relevant Commercial
Agreement.

Full license texts are found in LICENSES.txt.

Third-party licenses
--------------------
20 changes: 20 additions & 0 deletions scripts/static_data/NOTICE_XML_HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2002-2018 "Neo Technology,"
Network Engine for Objects in Lund AB [http://neotechnology.com]

This file is part of Neo4j.

Neo4j is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
9 changes: 9 additions & 0 deletions scripts/static_data/external_dependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = [
['font-awesome', 'Font Awesome', 'SIL OFL 1.1'],
['font-awesome-css', 'Font Awesome CSS', 'MIT'],
['bootstrap', 'bootstrap', 'MIT'],
['inconsolata', 'Inconsolata Font', 'SIL OFL 1.1'],
['open-sans', 'Open Sans Font', 'SIL OFL 1.1'],
['canvg', 'canvg', 'MIT'],
['d3', 'D3.js', 'BSD License']
]
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4855,6 +4855,12 @@ js-yaml@~3.7.0:
argparse "^1.0.7"
esprima "^2.6.0"

js2xmlparser@^3.0.0:
version "3.0.0"
resolved "https://neo.jfrog.io/neo/api/npm/npm/js2xmlparser/-/js2xmlparser-3.0.0.tgz#3fb60eaa089c5440f9319f51760ccd07e2499733"
dependencies:
xmlcreate "^1.0.1"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://neo.jfrog.io/neo/api/npm/npm/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -9224,6 +9230,10 @@ xmlbuilder@~9.0.1:
version "9.0.4"
resolved "https://neo.jfrog.io/neo/api/npm/npm/xmlbuilder/-/xmlbuilder-9.0.4.tgz#519cb4ca686d005a8420d3496f3f0caeecca580f"

xmlcreate@^1.0.1:
version "1.0.2"
resolved "https://neo.jfrog.io/neo/api/npm/npm/xmlcreate/-/xmlcreate-1.0.2.tgz#fa6bf762a60a413fb3dd8f4b03c5b269238d308f"

xmlhttprequest-ssl@1.5.3:
version "1.5.3"
resolved "https://neo.jfrog.io/neo/api/npm/npm/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz#185a888c04eca46c3e4070d99f7b49de3528992d"
Expand Down

0 comments on commit 7d34177

Please sign in to comment.