Merge branch 'master' into package_split

This commit is contained in:
murgatroid99 2017-10-12 14:50:43 -07:00
commit da03fc5db8
23 changed files with 1335 additions and 84 deletions

View File

@ -32,11 +32,11 @@ require('./test/gulpfile');
const root = __dirname;
gulp.task('install.all', 'Install dependencies for all subdirectory packages',
['js.core.install', 'native.core.install', 'health-check.install',
['js.core.install', 'native.core.install', 'health-check.install', 'internal.test.install',
'js.install', 'native.install']);
gulp.task('install.all.windows', 'Install dependencies for all subdirectory packages for MS Windows',
['js.core.install', 'native.core.install.windows', 'health-check.install',
['js.core.install', 'native.core.install.windows', 'health-check.install', 'internal.test.install',
'js.install', 'native.install']);
gulp.task('lint', 'Emit linting errors in source and test files',
@ -82,4 +82,6 @@ gulp.task('test', 'Run all tests', ['build'], () => {
gulp.start('test.only');
});
gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']);
gulp.task('default', ['help']);

View File

@ -8,29 +8,24 @@
"name": "Google Inc."
},
"license": "Apache-2.0",
"dependencies": {
"async": "^2.5.0",
"body-parser": "^1.18.0",
"execa": "^0.8.0",
"express": "^4.15.4",
"google-auth-library": "^0.11.0",
"lodash": "^4.17.4",
"mocha-jenkins-reporter": "^0.3.9",
"poisson-process": "^0.2.2"
},
"devDependencies": {
"@types/node": "^8.0.32",
"del": "^3.0.0",
"execa": "^0.8.0",
"gulp": "^3.9.1",
"gulp-help": "^1.6.1",
"gulp-jsdoc3": "^1.0.1",
"gulp-jshint": "^2.0.4",
"gulp-mocha": "^4.3.1",
"gulp-sourcemaps": "^2.6.1",
"gulp-tslint": "^8.1.1",
"gulp-typescript": "^3.2.2",
"gulp-util": "^3.0.8",
"jsdoc": "^3.3.2",
"jshint": "^2.9.5",
"merge2": "^1.1.0",
"mocha": "^3.5.3",
"mocha-jenkins-reporter": "^0.3.9",
"through2": "^2.0.3",
"tslint": "^5.5.0",
"typescript": "^2.5.1",

View File

@ -0,0 +1 @@
**/BUILD

View File

@ -670,6 +670,8 @@
'deps/grpc/src/core/lib/compression/compression.c',
'deps/grpc/src/core/lib/compression/message_compress.c',
'deps/grpc/src/core/lib/compression/stream_compression.c',
'deps/grpc/src/core/lib/compression/stream_compression_gzip.c',
'deps/grpc/src/core/lib/compression/stream_compression_identity.c',
'deps/grpc/src/core/lib/debug/stats.c',
'deps/grpc/src/core/lib/debug/stats_data.c',
'deps/grpc/src/core/lib/http/format_request.c',

@ -1 +1 @@
Subproject commit cbe93839937e4e6272407ab1b7ae7ef848b64894
Subproject commit 8d1dc21994b2c8d4600db706b60b300c1a5a24a7

View File

@ -238,9 +238,13 @@ NAUV_WORK_CB(SendPluginCallback) {
}
}
void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data) {
int plugin_get_metadata(
void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status,
const char **error_details) {
plugin_state *p_state = reinterpret_cast<plugin_state *>(state);
plugin_callback_data *data = new plugin_callback_data;
data->service_url = context.service_url;
@ -252,6 +256,7 @@ void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
uv_mutex_unlock(&p_state->plugin_mutex);
uv_async_send(&p_state->plugin_async);
return 0; // Async processing.
}
void plugin_uv_close_cb(uv_handle_t *handle) {

View File

@ -75,9 +75,13 @@ typedef struct plugin_state {
uv_async_t plugin_async;
} plugin_state;
void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data);
int plugin_get_metadata(
void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status,
const char **error_details);
void plugin_destroy_state(void *state);

View File

@ -21,6 +21,7 @@ const help = require('gulp-help');
// gulp-help monkeypatches tasks to have an additional description parameter
const gulp = help(_gulp);
const jsdoc = require('gulp-jsdoc3');
const jshint = require('gulp-jshint');
const mocha = require('gulp-mocha');
const execa = require('execa');
@ -73,3 +74,9 @@ gulp.task('native.core.build', 'Build native package', () => {
gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => {
return gulp.src(`${testDir}/*.js`).pipe(mocha({reporter: 'mocha-jenkins-reporter'}));
});
gulp.task('native.core.doc.gen', 'Generate docs', (cb) => {
var config = require('./jsdoc_conf.json');
gulp.src([`${nativeCoreDir}/README.md`, `${nativeCoreDir}/index.js`, `${srcDir}/*.js`], {read: false})
.pipe(jsdoc(config, cb));
});

1221
packages/grpc-native-core/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@ grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii'));
* @param {(number|string)=} [options.protobufjsVersion='detect'] 5 and 6
* respectively indicate that an object from the corresponding version of
* Protobuf.js is provided in the value argument. If the option is 'detect',
* gRPC wll guess what the version is based on the structure of the value.
* gRPC will guess what the version is based on the structure of the value.
* @return {Object<string, *>} The resulting gRPC object.
*/
exports.loadObject = function loadObject(value, options) {
@ -213,7 +213,7 @@ exports.ServerCredentials = grpc.ServerCredentials;
* Create insecure server credentials
* @name grpc.ServerCredentials.createInsecure
* @kind function
* @return grpc.ServerCredentials
* @return {grpc.ServerCredentials}
*/
/**
@ -234,7 +234,7 @@ exports.ServerCredentials = grpc.ServerCredentials;
* the server
* @param {boolean} [checkClientCertificate=false] Indicates that the server
* should request and verify the client's certificates
* @return grpc.ServerCredentials
* @return {grpc.ServerCredentials}
*/
exports.makeGenericClientConstructor = client.makeClientConstructor;

View File

@ -2,14 +2,8 @@
"tags": {
"allowUnknownTags": true
},
"source": {
"include": [ "src/node/index.js", "src/node/src" ],
"includePattern": "src/node/.+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts": {
"package": "package.json",
"readme": "src/node/README.md"
"destination": "docs/gen/native/core"
},
"plugins": ["plugins/markdown"],
"templates": {

View File

@ -19,11 +19,8 @@
"lib": "src/node/src"
},
"scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore",
"test": "./node_modules/.bin/mocha test && npm run-script lint",
"build": "./node_modules/.bin/node-pre-gyp build",
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
"gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library"
},
@ -38,12 +35,9 @@
"protobufjs": "^5.0.0"
},
"devDependencies": {
"async": "^2.0.1",
"electron-mocha": "^3.1.1",
"google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0",
"istanbul": "^0.4.4",
"jsdoc": "^3.3.2"
"istanbul": "^0.4.4"
},
"engines": {
"node": ">=4"
@ -58,18 +52,18 @@
"files": [
"LICENSE",
"README.md",
"deps/grpc/src/proto",
"deps/grpc/etc",
"deps/grpc/etc/",
"index.js",
"src",
"ext",
"deps/grpc/include/grpc",
"deps/grpc/src/core",
"deps/grpc/src/boringssl",
"deps/grpc/src/zlib",
"deps/grpc/third_party/nanopb",
"deps/grpc/third_party/zlib",
"deps/grpc/third_party/boringssl",
"src/*.js",
"ext/*.{cc,h}",
"deps/grpc/include/grpc/**/*.h",
"deps/grpc/src/core/**/*.{c,h}",
"deps/grpc/src/boringssl/*.{c,h}",
"deps/grpc/third_party/nanopb/*.{c,h}",
"deps/grpc/third_party/zlib/**/*.{c,h}",
"deps/grpc/third_party/boringssl/crypto/**/*.{c,h}",
"deps/grpc/third_party/boringssl/include/**/*.{c,h}",
"deps/grpc/third_party/boringssl/ssl/**/*.{c,h}",
"binding.gyp"
],
"main": "index.js",

View File

@ -393,8 +393,8 @@ ClientDuplexStream.prototype.getPeer = getPeer;
/**
* Any client call type
* @typedef {(ClientUnaryCall|ClientReadableStream|
* ClientWritableStream|ClientDuplexStream)}
* @typedef {(grpc~ClientUnaryCall|grpc~ClientReadableStream|
* grpc~ClientWritableStream|grpc~ClientDuplexStream)}
* grpc.Client~Call
*/
@ -450,7 +450,7 @@ function getCall(channel, method, options) {
* @memberof grpc
* @constructor
* @param {string} address Server address to connect to
* @param {grpc~ChannelCredentials} credentials Credentials to use to connect to
* @param {grpc.credentials~ChannelCredentials} credentials Credentials to use to connect to
* the server
* @param {Object} options Options to apply to channel creation
*/
@ -929,7 +929,7 @@ exports.makeClientConstructor = function(methods, serviceName,
* Return the underlying channel object for the specified client
* @memberof grpc
* @alias grpc~getClientChannel
* @param {Client} client
* @param {grpc.Client} client The client
* @return {Channel} The channel
* @see grpc.Client#getChannel
*/
@ -945,7 +945,7 @@ exports.getClientChannel = function(client) {
* start connecting if it has not already done so.
* @memberof grpc
* @alias grpc~waitForClientReady
* @param {Client} client The client to wait on
* @param {grpc.Client} client The client to wait on
* @param {grpc~Deadline} deadline When to stop waiting for a connection. Pass
* Infinity to wait forever.
* @param {function(Error)} callback The callback to call when done attempting

View File

@ -145,7 +145,7 @@ exports.defaultGrpcOptions = {
* a number of milliseconds since the Unix Epoch. If it is Infinity, the
* deadline will never be reached. If it is -Infinity, the deadline has already
* passed.
* @typedef {(number|date)} grpc~Deadline
* @typedef {(number|Date)} grpc~Deadline
*/
/**

View File

@ -139,7 +139,8 @@ exports.status = {
* a backoff.
*
* See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE. */
* ABORTED, and UNAVAILABLE.
*/
UNAVAILABLE: 14,
/** Unrecoverable data loss or corruption. */
DATA_LOSS: 15,
@ -150,7 +151,7 @@ exports.status = {
UNAUTHENTICATED: 16
};
/* The comments about propagation bit flags are copied rom
/* The comments about propagation bit flags are copied from
* include/grpc/impl/codegen/propagation_bits.h for the purpose of including
* them in generated documentation.
*/

View File

@ -86,7 +86,7 @@ var _ = require('lodash');
* @param {Buffer=} private_key The client certificate private key, if
* applicable
* @param {Buffer=} cert_chain The client certificate cert chain, if applicable
* @return {grpc.credentials.ChannelCredentials} The SSL Credentials object
* @return {grpc.credentials~ChannelCredentials} The SSL Credentials object
*/
exports.createSsl = ChannelCredentials.createSsl;
@ -113,7 +113,7 @@ exports.createSsl = ChannelCredentials.createSsl;
* @alias grpc.credentials.createFromMetadataGenerator
* @param {grpc.credentials~generateMetadata} metadata_generator The function
* that generates metadata
* @return {grpc.credentials.CallCredentials} The credentials object
* @return {grpc.credentials~CallCredentials} The credentials object
*/
exports.createFromMetadataGenerator = function(metadata_generator) {
return CallCredentials.createFromPlugin(function(service_url, cb_data,
@ -143,7 +143,7 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
* @alias grpc.credentials.createFromGoogleCredential
* @param {external:GoogleCredential} google_credential The Google credential
* object to use
* @return {grpc.credentials.CallCredentials} The resulting credentials object
* @return {grpc.credentials~CallCredentials} The resulting credentials object
*/
exports.createFromGoogleCredential = function(google_credential) {
return exports.createFromMetadataGenerator(function(auth_context, callback) {
@ -166,10 +166,10 @@ exports.createFromGoogleCredential = function(google_credential) {
* ChannelCredentials object.
* @memberof grpc.credentials
* @alias grpc.credentials.combineChannelCredentials
* @param {ChannelCredentials} channel_credential The ChannelCredentials to
* @param {grpc.credentials~ChannelCredentials} channel_credential The ChannelCredentials to
* start with
* @param {...CallCredentials} credentials The CallCredentials to compose
* @return ChannelCredentials A credentials object that combines all of the
* @param {...grpc.credentials~CallCredentials} credentials The CallCredentials to compose
* @return {grpc.credentials~ChannelCredentials} A credentials object that combines all of the
* input credentials
*/
exports.combineChannelCredentials = function(channel_credential) {
@ -184,8 +184,8 @@ exports.combineChannelCredentials = function(channel_credential) {
* Combine any number of CallCredentials into a single CallCredentials object
* @memberof grpc.credentials
* @alias grpc.credentials.combineCallCredentials
* @param {...CallCredentials} credentials the CallCredentials to compose
* @return CallCredentials A credentials object that combines all of the input
* @param {...grpc.credentials~CallCredentials} credentials The CallCredentials to compose
* @return {grpc.credentials~CallCredentials} A credentials object that combines all of the input
* credentials
*/
exports.combineCallCredentials = function() {
@ -202,6 +202,6 @@ exports.combineCallCredentials = function() {
* @memberof grpc.credentials
* @alias grpc.credentials.createInsecure
* @kind function
* @return {ChannelCredentials} The insecure credentials object
* @return {grpc.credentials~ChannelCredentials} The insecure credentials object
*/
exports.createInsecure = ChannelCredentials.createInsecure;

View File

@ -132,7 +132,7 @@ Metadata.prototype.getMap = function() {
/**
* Clone the metadata object.
* @return {Metadata} The new cloned object
* @return {grpc.Metadata} The new cloned object
*/
Metadata.prototype.clone = function() {
var copy = new Metadata();

View File

@ -470,7 +470,7 @@ ServerDuplexStream.prototype._write = _write;
/**
* Send the initial metadata for a writable stream.
* @alias grpc~ServerUnaryCall#sendMetadata
* @param {Metadata} responseMetadata Metadata to send
* @param {grpc.Metadata} responseMetadata Metadata to send
*/
function sendMetadata(responseMetadata) {
/* jshint validthis: true */

View File

@ -21,11 +21,8 @@
"lib": "src/node/src"
},
"scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore",
"test": "./node_modules/.bin/mocha test && npm run-script lint",
"build": "./node_modules/.bin/node-pre-gyp build",
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
"gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library"
},
@ -40,12 +37,9 @@
"protobufjs": "^5.0.0"
},
"devDependencies": {
"async": "^2.0.1",
"electron-mocha": "^3.1.1",
"google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0",
"istanbul": "^0.4.4",
"jsdoc": "^3.3.2"
"istanbul": "^0.4.4"
},
"engines": {
"node": ">=4"
@ -60,18 +54,18 @@
"files": [
"LICENSE",
"README.md",
"deps/grpc/src/proto",
"deps/grpc/etc",
"deps/grpc/etc/",
"index.js",
"src",
"ext",
"deps/grpc/include/grpc",
"deps/grpc/src/core",
"deps/grpc/src/boringssl",
"deps/grpc/src/zlib",
"deps/grpc/third_party/nanopb",
"deps/grpc/third_party/zlib",
"deps/grpc/third_party/boringssl",
"src/*.js",
"ext/*.{cc,h}",
"deps/grpc/include/grpc/**/*.h",
"deps/grpc/src/core/**/*.{c,h}",
"deps/grpc/src/boringssl/*.{c,h}",
"deps/grpc/third_party/nanopb/*.{c,h}",
"deps/grpc/third_party/zlib/**/*.{c,h}",
"deps/grpc/third_party/boringssl/crypto/**/*.{c,h}",
"deps/grpc/third_party/boringssl/include/**/*.{c,h}",
"deps/grpc/third_party/boringssl/ssl/**/*.{c,h}",
"binding.gyp"
],
"main": "index.js",

View File

@ -31,6 +31,7 @@ call npm install || goto :error
for %%v in (4.8.4 6.11.3 7.9.0 8.5.0) do (
nvm install %%v
nvm use %%v
npm install -g npm
node -e "console.log(process.versions)"
call .\node_modules\.bin\gulp clean.all || goto :error

View File

@ -48,6 +48,7 @@ do
echo "Switching to node version $version"
nvm install $version
nvm use $version
npm install -g npm
set -ex
mkdir -p "reports/node$version"

View File

@ -32,6 +32,10 @@ gulp.task('internal.test.clean.links', 'Delete npm links', () => {
return del(path.resolve(testDir, 'node_modules/grpc'));
});
gulp.task('internal.test.install', 'Install test dependencies', () => {
return execa('npm', ['install'], {cwd: testDir, stdio: 'inherit'});
});
gulp.task('internal.test.clean.all', 'Delete all files created by tasks',
['internal.test.clean.links']);

25
test/package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "grpc-node-test",
"version": "0.1.0",
"description": "Dummy package for the grpc-node repository tests",
"private": true,
"keywords": [],
"author": {
"name": "Google Inc."
},
"license": "Apache-2.0",
"contributors": [
{
"name": "Google Inc."
}
],
"dependencies": {
"async": "^2.0.1",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"google-auth-library": "^0.9.2",
"lodash": "^4.17.4",
"minimist": "^1.1.0",
"poisson-process": "^0.2.1"
}
}