From 2af89e49cb4ad5b5e30cd4c447acaca1d0c44843 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 1 Oct 2015 11:54:00 -0700 Subject: Moved gRPC node package root to repo root, made it depend on grpc.gyp --- .istanbul.yml | 6 ++ binding.gyp | 66 +++++++++++++++++++ grpc.gyp | 8 ++- package.json | 67 +++++++++++++++++++ src/node/.istanbul.yml | 6 -- src/node/LICENSE | 28 -------- src/node/README.md | 36 ---------- src/node/binding.gyp | 100 ---------------------------- src/node/index.js | 3 +- src/node/interop/empty.proto | 43 ------------ src/node/interop/interop_client.js | 4 +- src/node/interop/interop_server.js | 4 +- src/node/interop/messages.proto | 132 ------------------------------------- src/node/interop/test.proto | 72 -------------------- src/node/package.json | 63 ------------------ src/node/src/client.js | 4 +- src/node/src/server.js | 2 +- src/node/test/call_test.js | 2 +- src/node/test/channel_test.js | 2 +- src/node/test/constant_test.js | 2 +- src/node/test/end_to_end_test.js | 2 +- src/node/test/server_test.js | 2 +- src/node/test/surface_test.js | 2 +- templates/grpc.gyp.template | 8 ++- 24 files changed, 169 insertions(+), 495 deletions(-) create mode 100644 .istanbul.yml create mode 100644 binding.gyp create mode 100644 package.json delete mode 100644 src/node/.istanbul.yml delete mode 100644 src/node/LICENSE delete mode 100644 src/node/binding.gyp delete mode 100644 src/node/interop/empty.proto delete mode 100644 src/node/interop/messages.proto delete mode 100644 src/node/interop/test.proto delete mode 100644 src/node/package.json diff --git a/.istanbul.yml b/.istanbul.yml new file mode 100644 index 0000000000..9ff1379f51 --- /dev/null +++ b/.istanbul.yml @@ -0,0 +1,6 @@ +reporting: + watermarks: + statements: [80, 95] + lines: [80, 95] + functions: [80, 95] + branches: [80, 95] diff --git a/binding.gyp b/binding.gyp new file mode 100644 index 0000000000..1cab4bb80a --- /dev/null +++ b/binding.gyp @@ -0,0 +1,66 @@ +{ + "variables" : { + 'config': '=0.10.13" + }, + "files": [ + "LICENSE", + "src/node/README.md", + "src/node/index.js", + "src/node/bin", + "src/node/cli", + "src/node/examples", + "src/node/ext", + "src/node/health_check", + "src/node/interop", + "src/node/src", + "src/node/test", + "src/core", + "test/proto", + "include", + "grpc.gyp", + "binding.gyp" + ], + "main": "src/node/index.js", + "license": "BSD-3-Clause" +} diff --git a/src/node/.istanbul.yml b/src/node/.istanbul.yml deleted file mode 100644 index 9ff1379f51..0000000000 --- a/src/node/.istanbul.yml +++ /dev/null @@ -1,6 +0,0 @@ -reporting: - watermarks: - statements: [80, 95] - lines: [80, 95] - functions: [80, 95] - branches: [80, 95] diff --git a/src/node/LICENSE b/src/node/LICENSE deleted file mode 100644 index 0209b570e1..0000000000 --- a/src/node/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2015, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/node/README.md b/src/node/README.md index 7719d08290..5d89e2228d 100644 --- a/src/node/README.md +++ b/src/node/README.md @@ -5,51 +5,19 @@ Beta ## PREREQUISITES - `node`: This requires `node` to be installed. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package. -- [homebrew][] on Mac OS X. These simplify the installation of the gRPC C core. ## INSTALLATION -**Linux (Debian):** - -Add [Debian jessie-backports][] to your `sources.list` file. Example: - -```sh -echo "deb http://http.debian.net/debian jessie-backports main" | \ -sudo tee -a /etc/apt/sources.list -``` - -Install the gRPC Debian package - -```sh -sudo apt-get update -sudo apt-get install libgrpc-dev -``` - Install the gRPC NPM package ```sh npm install grpc ``` -**Mac OS X** - -Install [homebrew][]. Run the following command to install gRPC Node.js. -```sh -$ curl -fsSL https://goo.gl/getgrpc | bash -s nodejs -``` -This will download and run the [gRPC install script][], then install the latest version of gRPC Nodejs npm package. - ## BUILD FROM SOURCE 1. Clone [the grpc Git Repository](https://github.com/grpc/grpc). - 2. Follow the instructions in the `INSTALL` file in the root of that repository to install the C core library that this package depends on. 3. Run `npm install`. -If you install the gRPC C core library in a custom location, then you need to set some environment variables to install this library. The command will look like this: - -```sh -CXXFLAGS=-I/include LDFLAGS=-L/lib npm install [grpc] -``` - ## TESTING To run the test suite, simply run `npm test` in the install location. @@ -110,7 +78,3 @@ ServerCredentials ``` An object with factory methods for creating credential objects for servers. - -[homebrew]:http://brew.sh -[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install -[Debian jessie-backports]:http://backports.debian.org/Instructions/ diff --git a/src/node/binding.gyp b/src/node/binding.gyp deleted file mode 100644 index 247719e981..0000000000 --- a/src/node/binding.gyp +++ /dev/null @@ -1,100 +0,0 @@ -{ - "variables" : { - 'config': '/dev/null 2>&1 && echo true || echo false)' - }, - 'conditions': [ - ['config=="gcov"', { - 'cflags': [ - '-ftest-coverage', - '-fprofile-arcs', - '-O0' - ], - 'ldflags': [ - '-ftest-coverage', - '-fprofile-arcs' - ] - } - ], - ['pkg_config_grpc == "true"', { - 'link_settings': { - 'libraries': [ - '=0.10.13" - }, - "files": [ - "LICENSE", - "README.md", - "index.js", - "binding.gyp", - "bin", - "cli", - "examples", - "ext", - "interop", - "src", - "test" - ], - "main": "index.js", - "license": "BSD-3-Clause" -} diff --git a/src/node/src/client.js b/src/node/src/client.js index 7f510231b3..33ddb3cec4 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -40,7 +40,7 @@ var _ = require('lodash'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); var common = require('./common'); @@ -54,7 +54,7 @@ var Readable = stream.Readable; var Writable = stream.Writable; var Duplex = stream.Duplex; var util = require('util'); -var version = require('../package.json').version; +var version = require('../../../package.json').version; util.inherits(ClientWritableStream, Writable); diff --git a/src/node/src/server.js b/src/node/src/server.js index 70b4a9d80e..87b5b7ad06 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -40,7 +40,7 @@ var _ = require('lodash'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); var common = require('./common'); diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js index e7f071bcd5..ec502183c1 100644 --- a/src/node/test/call_test.js +++ b/src/node/test/call_test.js @@ -34,7 +34,7 @@ 'use strict'; var assert = require('assert'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); /** * Helper function to return an absolute deadline given a relative timeout in diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js index d81df2a36d..4418dfff4c 100644 --- a/src/node/test/channel_test.js +++ b/src/node/test/channel_test.js @@ -34,7 +34,7 @@ 'use strict'; var assert = require('assert'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); /** * This is used for testing functions with multiple asynchronous calls that diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index fa06ad4e4d..b17cd339cb 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -34,7 +34,7 @@ 'use strict'; var assert = require('assert'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); /** * List of all status names diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js index 4b8da3bfb1..813221dafe 100644 --- a/src/node/test/end_to_end_test.js +++ b/src/node/test/end_to_end_test.js @@ -34,7 +34,7 @@ 'use strict'; var assert = require('assert'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); /** * This is used for testing functions with multiple asynchronous calls that diff --git a/src/node/test/server_test.js b/src/node/test/server_test.js index 1e69d52e58..999a183b3c 100644 --- a/src/node/test/server_test.js +++ b/src/node/test/server_test.js @@ -36,7 +36,7 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); -var grpc = require('bindings')('grpc.node'); +var grpc = require('bindings')('grpc_node'); describe('server', function() { describe('constructor', function() { diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index d917c7a171..89ea086938 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -356,7 +356,7 @@ describe('Echo metadata', function() { call.end(); }); it('shows the correct user-agent string', function(done) { - var version = require('../package.json').version; + var version = require('../../../package.json').version; var call = client.unary({}, function(err, data) { assert.ifError(err); }, metadata); call.on('metadata', function(metadata) { diff --git a/templates/grpc.gyp.template b/templates/grpc.gyp.template index 873606202a..cd5446d553 100644 --- a/templates/grpc.gyp.template +++ b/templates/grpc.gyp.template @@ -80,7 +80,13 @@ '-ldl', '-lpthread', '-lz' - ] + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '.', + 'include' + ], + } }, 'targets': [ % for lib in libs: -- cgit v1.2.3