Upgrading dependency to Thrift 0.12.0

This commit is contained in:
Renan DelValle 2018-11-27 18:03:50 -08:00
parent 3e4590dcc0
commit 356978cb42
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
1302 changed files with 101701 additions and 26784 deletions

View file

@ -3,6 +3,7 @@
//Prerequisites:
// Node Setup - nodejs.org
// Grunt Setup - npm install //reads the ./package.json and installs project dependencies
// Run grunt - npx grunt // uses project-local installed version of grunt (from package.json)
module.exports = function(grunt) {
'use strict';
@ -38,115 +39,213 @@ module.exports = function(grunt) {
},
shell: {
InstallThriftJS: {
command: 'mkdir test/build; mkdir test/build/js; cp src/thrift.js test/build/js/thrift.js'
command: 'mkdir -p test/build/js/lib; cp src/thrift.js test/build/js/thrift.js'
},
InstallThriftNodeJSDep: {
command: 'cd ../..; npm install'
},
InstallTestLibs: {
command: 'cd test; ant download_jslibs'
},
ThriftGen: {
command: '../../compiler/cpp/thrift -gen js -gen js:node -o test ../../test/ThriftTest.thrift'
command: [
'mkdir -p test/gen-js',
'../../compiler/cpp/thrift -gen js --out test/gen-js ../../test/ThriftTest.thrift',
'../../compiler/cpp/thrift -gen js --out test/gen-js ../../test/JsDeepConstructorTest.thrift',
'mkdir -p test/gen-js-jquery',
'../../compiler/cpp/thrift -gen js:jquery --out test/gen-js-jquery ../../test/ThriftTest.thrift',
'mkdir -p test/gen-nodejs',
'../../compiler/cpp/thrift -gen js:node --out test/gen-nodejs ../../test/ThriftTest.thrift',
'mkdir -p test/gen-js-es6',
'../../compiler/cpp/thrift -gen js:es6 --out test/gen-js-es6 ../../test/ThriftTest.thrift',
'mkdir -p test/gen-nodejs-es6',
'../../compiler/cpp/thrift -gen js:node,es6 --out ./test/gen-nodejs-es6 ../../test/ThriftTest.thrift',
].join(' && ')
},
ThriftGenJQ: {
command: '../../compiler/cpp/thrift -gen js:jquery -gen js:node -o test ../../test/ThriftTest.thrift'
},
ThriftGenDeepConstructor: {
command: '../../compiler/cpp/thrift -gen js -o test ../../test/JsDeepConstructorTest.thrift'
}
},
external_daemon: {
},
ThriftGenDoubleConstants: {
command: '../../compiler/cpp/thrift -gen js -o test ../../test/DoubleConstantsTest.thrift'
},
ThriftTestServer: {
options: {
startCheck: function(stdout, stderr) {
return (/Thrift Server running on port/).test(stdout);
},
nodeSpawnOptions: {
cwd: "test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
async: true,
execOptions: {
cwd: "./test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
},
cmd: "node",
args: ["server_http.js"]
command: "node server_http.js",
},
ThriftTestServerES6: {
options: {
async: true,
execOptions: {
cwd: "./test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
},
command: "node server_http.js --es6",
},
ThriftTestServer_TLS: {
options: {
startCheck: function(stdout, stderr) {
return (/Thrift Server running on port/).test(stdout);
},
nodeSpawnOptions: {
cwd: "test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
async: true,
execOptions: {
cwd: "./test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
},
cmd: "node",
args: ["server_https.js"]
}
command: "node server_https.js",
},
ThriftTestServerES6_TLS: {
options: {
async: true,
execOptions: {
cwd: "./test",
env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
}
},
command: "node server_https.js --es6",
},
},
qunit: {
ThriftJS: {
options: {
urls: [
'http://localhost:8088/test-nojq.html'
]
'http://localhost:8089/test-nojq.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
},
}
},
ThriftJSJQ: {
options: {
urls: [
'http://localhost:8088/test.html'
]
'http://localhost:8089/test.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
},
}
},
ThriftJS_DoubleRendering: {
options: {
urls: [
'http://localhost:8089/test-double-rendering.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
ignoreHTTPSErrors: true,
},
}
},
ThriftWS: {
options: {
urls: [
'http://localhost:8088/testws.html'
]
'http://localhost:8089/testws.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
},
}
},
ThriftJS_TLS: {
options: {
'--ignore-ssl-errors': true,
urls: [
'https://localhost:8089/test-nojq.html'
]
'https://localhost:8091/test-nojq.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
ignoreHTTPSErrors: true,
},
}
},
ThriftJSJQ_TLS: {
options: {
'--ignore-ssl-errors': true,
urls: [
'https://localhost:8089/test.html'
]
'https://localhost:8091/test.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
ignoreHTTPSErrors: true,
},
}
},
ThriftWS_TLS: {
options: {
'--ignore-ssl-errors': true,
urls: [
'https://localhost:8089/testws.html'
]
'https://localhost:8091/testws.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
ignoreHTTPSErrors: true,
},
}
},
ThriftDeepConstructor: {
options: {
urls: [
'http://localhost:8088/test-deep-constructor.html'
]
'http://localhost:8089/test-deep-constructor.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
},
}
},
ThriftWSES6: {
options: {
urls: [
'http://localhost:8088/test-es6.html'
],
puppeteer: {
headless: true,
args: ['--no-sandbox'],
},
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
// The main thrift library file. not es6 yet :(
lib: {
src: ['src/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true,
},
}
}
},
},
// The test files use es6
test: {
src: ['Gruntfile.js', 'test/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true,
},
esversion: 6,
}
},
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
@ -154,19 +253,34 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-external-daemon');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.registerTask('test', ['jshint', 'shell:InstallThriftJS', 'shell:InstallThriftNodeJSDep', 'shell:ThriftGen',
'external_daemon:ThriftTestServer', 'external_daemon:ThriftTestServer_TLS',
'shell:ThriftGenDeepConstructor', 'qunit:ThriftDeepConstructor',
'qunit:ThriftJS', 'qunit:ThriftJS_TLS',
'shell:ThriftGenJQ', 'qunit:ThriftJSJQ', 'qunit:ThriftJSJQ_TLS'
]);
grunt.registerTask('default', ['jshint', 'shell:InstallThriftJS', 'shell:InstallThriftNodeJSDep', 'shell:ThriftGen',
'external_daemon:ThriftTestServer', 'external_daemon:ThriftTestServer_TLS',
'qunit:ThriftJS', 'qunit:ThriftJS_TLS',
'shell:ThriftGenJQ', 'qunit:ThriftJSJQ', 'qunit:ThriftJSJQ_TLS',
'concat', 'uglify', 'jsdoc'
]);
grunt.registerTask('wait', 'Wait just one second for server to start', function () {
var done = this.async();
setTimeout(function() {
done(true);
}, 1000);
});
grunt.registerTask('installAndGenerate', [
'shell:InstallThriftJS', 'shell:InstallThriftNodeJSDep', 'shell:ThriftGen',
'shell:ThriftGenDeepConstructor',
'shell:InstallTestLibs',
]);
grunt.registerTask('test', [
'jshint',
'installAndGenerate',
'shell:ThriftTestServer', 'shell:ThriftTestServer_TLS',
'shell:ThriftTestServerES6', 'shell:ThriftTestServerES6_TLS',
'wait',
'qunit:ThriftDeepConstructor',
'qunit:ThriftJS', 'qunit:ThriftJS_TLS',
'qunit:ThriftWS',
'qunit:ThriftJSJQ', 'qunit:ThriftJSJQ_TLS',
'qunit:ThriftWSES6',
'shell:ThriftTestServer:kill', 'shell:ThriftTestServer_TLS:kill',
'shell:ThriftTestServerES6:kill', 'shell:ThriftTestServerES6_TLS:kill',
]);
grunt.registerTask('default', ['test', 'concat', 'uglify', 'jsdoc']);
};