summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-01-10 16:04:06 -0800
committerKonstantin Käfer <mail@kkaefer.com>2018-01-23 17:10:58 -0800
commitca604e57211bf33d74d319c04b1c561d7cc5050a (patch)
tree1e50075f57434adabe99f1be9b728f090beeee03
parentac012c892150613c19a26386ebdff4f6af069771 (diff)
downloadqtlocation-mapboxgl-upstream/verify.tar.gz
[build] Add build that verifies that the code generator was runupstream/verify
-rw-r--r--circle.yml22
-rwxr-xr-xscripts/nitpick/generated-code.js50
2 files changed, 72 insertions, 0 deletions
diff --git a/circle.yml b/circle.yml
index 46ff9f7c6e..c7e1e519c7 100644
--- a/circle.yml
+++ b/circle.yml
@@ -241,6 +241,22 @@ jobs:
name: Verify submodule pin
command: scripts/nitpick/submodule-pin.js
when: always
+ - run:
+ name: CMake file list generation
+ command: scripts/nitpick/generated-code.js cmake
+ when: always
+ - run:
+ name: Shader code generation
+ command: scripts/nitpick/generated-code.js shader
+ when: always
+ - run:
+ name: Style code generation
+ command: scripts/nitpick/generated-code.js style
+ when: always
+ - run:
+ name: Android code generation
+ command: scripts/nitpick/generated-code.js android
+ when: always
# ------------------------------------------------------------------------------
@@ -711,6 +727,9 @@ jobs:
- run:
name: Lint plist files
command: make ios-lint
+ - run:
+ name: Nitpick Darwin code generation
+ command: scripts/nitpick/generated-code.js darwin
- *show-ccache-stats
- *save-cache
@@ -770,6 +789,9 @@ jobs:
- run:
name: Lint plist files
command: make macos-lint
+ - run:
+ name: Nitpick Darwin code generation
+ command: scripts/nitpick/generated-code.js darwin
- *show-ccache-stats
- *save-cache
- store_artifacts:
diff --git a/scripts/nitpick/generated-code.js b/scripts/nitpick/generated-code.js
new file mode 100755
index 0000000000..b8699eaa00
--- /dev/null
+++ b/scripts/nitpick/generated-code.js
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+const nitpick = require('.');
+const child_process = require('child_process');
+const path = require('path');
+const fs = require('fs');
+const os = require('os');
+
+function checkGeneratedFiles(name, scripts) {
+ var files = [];
+
+ scripts.forEach(function(script) {
+ child_process.execSync(script);
+ const list = path.join(path.dirname(script), path.basename(script, path.extname(script)) + '.list');
+ files.push(list);
+ files = files.concat(fs.readFileSync(list, 'utf8').split('\n'));
+ });
+
+ // List missing files
+ var missing = child_process.execFileSync('git', ['ls-files', '--others', '--exclude-standard', '--'].concat(files)).toString().trim();
+ if (!missing.length) {
+ nitpick.ok(`All generated ${name} files are checked in`);
+ } else {
+ nitpick.fail(`These generated ${name} files are not checked in:`, missing);
+ }
+
+ // Diff existing files
+ var diff = child_process.execFileSync('git', ['-c', 'color.ui=always', 'diff', 'HEAD', '--'].concat(files)).toString().trim();
+ if (!diff.length) {
+ nitpick.ok(`All generated ${name} files are up-to-date`);
+ } else {
+ nitpick.fail(`These generated ${name} files have modifications:`, diff);
+ }
+}
+
+const mode = (process.argv[2] || '').toLowerCase();
+if (!mode || mode == 'cmake') {
+ checkGeneratedFiles('CMake list', ['scripts/generate-cmake-files.js']);
+}
+if (!mode || mode == 'shader') {
+ checkGeneratedFiles('shader', ['scripts/generate-shaders.js']);
+}
+if (!mode || mode == 'style') {
+ checkGeneratedFiles('style', ['scripts/generate-style-code.js']);
+}
+if (!mode || mode == 'android') {
+ checkGeneratedFiles('Android', ['platform/android/scripts/generate-style-code.js']);
+}
+if ((!mode || mode == 'darwin') && os.platform() == 'darwin') {
+ checkGeneratedFiles('Darwin', ['platform/darwin/scripts/generate-style-code.js', 'platform/darwin/scripts/update-examples.js']);
+}