diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2019-03-20 18:54:34 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2019-03-25 11:53:04 +0100 |
commit | ee5be6dff1b106afa43fac6d714a40446144b667 (patch) | |
tree | 8d3d3bf7c231147ca4fa8c933c89b42f6017cd35 | |
parent | ac6855a4734be099319e4003eff4951074e7fd57 (diff) | |
download | qtlocation-mapboxgl-ee5be6dff1b106afa43fac6d714a40446144b667.tar.gz |
[android] - validate license generatrion with nitpick on CI
-rw-r--r-- | platform/android/gradle/android-nitpick.gradle | 10 | ||||
-rw-r--r-- | platform/android/scripts/validate-license.py | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/platform/android/gradle/android-nitpick.gradle b/platform/android/gradle/android-nitpick.gradle index f8e4a47b0b..32539270f5 100644 --- a/platform/android/gradle/android-nitpick.gradle +++ b/platform/android/gradle/android-nitpick.gradle @@ -17,6 +17,8 @@ task androidNitpick { verifyVendorSubmodulePin(MAPBOX_JAVA_DIR, MAPBOX_JAVA_TAG_PREFIX, versions.mapboxServices) verifyVendorSubmodulePin(MAPBOX_TELEMETRY_DIR, MAPBOX_TELEMETRY_TAG_PREFIX, versions.mapboxTelemetry) verifyVendorSubmodulePin(MAPBOX_GESTURES_DIR, MAPBOX_GESTURES_TAG_PREFIX, versions.mapboxGestures) + + verifyLicenseGeneration() } } @@ -51,4 +53,12 @@ private def verifyVendorSubmodulePin(def dir, def prefix, def version) { "If you've bumped the pin, make sure to verify the version tag prefix in the android-nitpick.gradle file.") } output.close() +} + +private def verifyLicenseGeneration() { + println "Verify license generation with git diff..." + exec { + workingDir = "${rootDir}" + commandLine "python", "scripts/validate-license.py" + } }
\ No newline at end of file diff --git a/platform/android/scripts/validate-license.py b/platform/android/scripts/validate-license.py new file mode 100644 index 0000000000..365d7ac265 --- /dev/null +++ b/platform/android/scripts/validate-license.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +from subprocess import call +from subprocess import Popen, PIPE +import sys + +## Run license generation +call('cd ../../ && make android-license', shell=True) + +## Git diff changes +p = Popen(['git', 'diff', '--name-only', 'LICENSE.md'], stdin=PIPE, stdout=PIPE, stderr=PIPE) +output, err = p.communicate(b"input data that is passed to subprocess' stdin") +if "platform/android/LICENSE.md" in output: + raise ValueError("""An error ocurred while validating the license generation. + Changes were detected to the license generation output + but weren't commited. Run make android-license and + commit the changeset to make this validation pass.""")
\ No newline at end of file |