Skip to content

Commit 2af89e4

Browse files
committed
Moved gRPC node package root to repo root, made it depend on grpc.gyp
1 parent b3ca2ad commit 2af89e4

22 files changed

+117
-443
lines changed
File renamed without changes.

binding.gyp

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"variables" : {
3+
'config': '<!(echo $CONFIG)'
4+
},
5+
"targets" : [
6+
{
7+
'include_dirs': [
8+
"<!(node -e \"require('nan')\")"
9+
],
10+
'cflags': [
11+
'-std=c++0x',
12+
'-Wall',
13+
'-pthread',
14+
'-g',
15+
'-zdefs',
16+
'-Werror',
17+
'-Wno-error=deprecated-declarations'
18+
],
19+
'ldflags': [
20+
'-g'
21+
],
22+
"conditions": [
23+
['OS != "win"', {
24+
'conditions': [
25+
['config=="gcov"', {
26+
'cflags': [
27+
'-ftest-coverage',
28+
'-fprofile-arcs',
29+
'-O0'
30+
],
31+
'ldflags': [
32+
'-ftest-coverage',
33+
'-fprofile-arcs'
34+
]
35+
}
36+
]
37+
]
38+
}],
39+
['OS == "mac"', {
40+
'xcode_settings': {
41+
'MACOSX_DEPLOYMENT_TARGET': '10.9',
42+
'OTHER_CFLAGS': [
43+
'-std=c++11',
44+
'-stdlib=libc++'
45+
]
46+
}
47+
}]
48+
],
49+
"target_name": "grpc_node",
50+
"sources": [
51+
"src/node/ext/byte_buffer.cc",
52+
"src/node/ext/call.cc",
53+
"src/node/ext/channel.cc",
54+
"src/node/ext/completion_queue_async_worker.cc",
55+
"src/node/ext/credentials.cc",
56+
"src/node/ext/node_grpc.cc",
57+
"src/node/ext/server.cc",
58+
"src/node/ext/server_credentials.cc",
59+
"src/node/ext/timeval.cc"
60+
],
61+
"dependencies": [
62+
"grpc.gyp:grpc"
63+
]
64+
}
65+
]
66+
}

grpc.gyp

+7-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@
7878
'-ldl',
7979
'-lpthread',
8080
'-lz'
81-
]
81+
],
82+
'direct_dependent_settings': {
83+
'include_dirs': [
84+
'.',
85+
'include'
86+
],
87+
}
8288
},
8389
'targets': [
8490
# TODO: Add C++ targets

src/node/package.json package.json

+21-17
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
}
1717
],
1818
"directories": {
19-
"lib": "src",
20-
"example": "examples"
19+
"lib": "src/node/src"
2120
},
2221
"scripts": {
23-
"lint": "node ./node_modules/jshint/bin/jshint src test examples interop index.js",
24-
"test": "./node_modules/.bin/mocha && npm run-script lint",
25-
"gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json",
26-
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha"
22+
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/examples src/node/interop src/node/index.js",
23+
"test": "./node_modules/.bin/mocha src/node/test && npm run-script lint",
24+
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json",
25+
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test"
2726
},
2827
"dependencies": {
2928
"bindings": "^1.2.0",
@@ -47,17 +46,22 @@
4746
},
4847
"files": [
4948
"LICENSE",
50-
"README.md",
51-
"index.js",
52-
"binding.gyp",
53-
"bin",
54-
"cli",
55-
"examples",
56-
"ext",
57-
"interop",
58-
"src",
59-
"test"
49+
"src/node/README.md",
50+
"src/node/index.js",
51+
"src/node/bin",
52+
"src/node/cli",
53+
"src/node/examples",
54+
"src/node/ext",
55+
"src/node/health_check",
56+
"src/node/interop",
57+
"src/node/src",
58+
"src/node/test",
59+
"src/core",
60+
"test/proto",
61+
"include",
62+
"grpc.gyp",
63+
"binding.gyp"
6064
],
61-
"main": "index.js",
65+
"main": "src/node/index.js",
6266
"license": "BSD-3-Clause"
6367
}

src/node/LICENSE

-28
This file was deleted.

src/node/README.md

-36
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,19 @@ Beta
55

66
## PREREQUISITES
77
- `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.
8-
- [homebrew][] on Mac OS X. These simplify the installation of the gRPC C core.
98

109
## INSTALLATION
1110

12-
**Linux (Debian):**
13-
14-
Add [Debian jessie-backports][] to your `sources.list` file. Example:
15-
16-
```sh
17-
echo "deb http://http.debian.net/debian jessie-backports main" | \
18-
sudo tee -a /etc/apt/sources.list
19-
```
20-
21-
Install the gRPC Debian package
22-
23-
```sh
24-
sudo apt-get update
25-
sudo apt-get install libgrpc-dev
26-
```
27-
2811
Install the gRPC NPM package
2912

3013
```sh
3114
npm install grpc
3215
```
3316

34-
**Mac OS X**
35-
36-
Install [homebrew][]. Run the following command to install gRPC Node.js.
37-
```sh
38-
$ curl -fsSL https://goo.gl/getgrpc | bash -s nodejs
39-
```
40-
This will download and run the [gRPC install script][], then install the latest version of gRPC Nodejs npm package.
41-
4217
## BUILD FROM SOURCE
4318
1. Clone [the grpc Git Repository](https://github.com/grpc/grpc).
44-
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.
4519
3. Run `npm install`.
4620

47-
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:
48-
49-
```sh
50-
CXXFLAGS=-I<custom location>/include LDFLAGS=-L<custom location>/lib npm install [grpc]
51-
```
52-
5321
## TESTING
5422
To run the test suite, simply run `npm test` in the install location.
5523

@@ -110,7 +78,3 @@ ServerCredentials
11078
```
11179

11280
An object with factory methods for creating credential objects for servers.
113-
114-
[homebrew]:http://brew.sh
115-
[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install
116-
[Debian jessie-backports]:http://backports.debian.org/Instructions/

src/node/binding.gyp

-100
This file was deleted.

src/node/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var server = require('./src/server.js');
4343

4444
var Metadata = require('./src/metadata.js');
4545

46-
var grpc = require('bindings')('grpc');
46+
var grpc = require('bindings')('grpc_node');
4747

4848
/**
4949
* Load a gRPC object from an existing ProtoBuf.Reflect object.
@@ -90,7 +90,6 @@ exports.load = function load(filename, format) {
9090
default:
9191
throw new Error('Unrecognized format "' + format + '"');
9292
}
93-
9493
return loadObject(builder.ns);
9594
};
9695

src/node/interop/empty.proto

-43
This file was deleted.

src/node/interop/interop_client.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ var fs = require('fs');
3737
var path = require('path');
3838
var _ = require('lodash');
3939
var grpc = require('..');
40-
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
40+
var testProto = grpc.load({
41+
root: __dirname + '/../../..',
42+
file: 'test/proto/test.proto'}).grpc.testing;
4143
var GoogleAuth = require('google-auth-library');
4244

4345
var assert = require('assert');

0 commit comments

Comments
 (0)