summaryrefslogtreecommitdiff
path: root/platform/android/scripts/generate-license.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/scripts/generate-license.py')
-rw-r--r--platform/android/scripts/generate-license.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/platform/android/scripts/generate-license.py b/platform/android/scripts/generate-license.py
new file mode 100644
index 0000000000..a05169e096
--- /dev/null
+++ b/platform/android/scripts/generate-license.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+
+import os
+import json
+
+path = os.getcwd() + "/platform/android/"
+with open(path + "LICENSE.md", 'w') as licenseFile:
+ licenseFile.write("<!-- This file was generated. Use `make android-license` to update. -->\n")
+ licenseFile.write("## Additional Mapbox GL licenses\n")
+ with open(path + "MapboxGLAndroidSDK/build/reports/licenses/licenseReleaseReport.json", 'r') as dataFile:
+ data = json.load(dataFile)
+
+ gradleLicensePlugin ="""
+ {
+ "project": "Gradle License Plugin",
+ "url": "https://github.com/jaredsburrows/gradle-license-plugin",
+ "licenses": [
+ {
+ "license": "The Apache Software License, Version 2.0",
+ "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
+ }
+ ]
+ }
+ """
+ data.append(json.loads(gradleLicensePlugin))
+
+ licenseName = ""
+ licenseUrl = ""
+ for entry in data:
+ projectName = entry["project"]
+ projectUrl = entry["url"]
+ for license in entry["licenses"]:
+ licenseName = license["license"]
+ licenseUrl = license["license_url"]
+
+ licenseFile.write("Mapbox GL uses portions of the %s.\n" % projectName +
+ ("URL: [%s](%s)\n" % (projectUrl, projectUrl) if projectUrl is not None else "") +
+ "License: [%s](%s)" % (licenseName, licenseUrl) +
+ "\n\n===========================================================================\n\n")