1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

update readme and makefile

This commit is contained in:
requilence 2020-02-04 20:31:51 +02:00
parent 84ad69e94a
commit f5327b29f7
No known key found for this signature in database
GPG key ID: F07A7D55A2684852
2 changed files with 41 additions and 34 deletions

View file

@ -1,7 +1,7 @@
.PHONY : protos_deps
setup:
GOPRIVATE=github.com/anytypeio/go-anytype-library go mod download
go get github.com/ahmetb/govvv
GOPRIVATE=github.com/anytypeio go mod download
GO111MODULE=off go get github.com/ahmetb/govvv
npm install
fmt:
@ -31,8 +31,7 @@ test-deps:
build-lib:
$(eval FLAGS := $$(shell govvv -flags -pkg github.com/anytypeio/go-anytype-middleware/lib))
export GO111MODULE=on
go build -v -o dist/lib.a -tags nogrpcserver -ldflags "$(FLAGS)" -buildmode=c-archive -v ./lib/clib
GO111MODULE=on go build -v -o dist/lib.a -tags nogrpcserver -ldflags "$(FLAGS)" -buildmode=c-archive -v ./lib/clib
build-js:
cp dist/lib.a jsaddon/lib.a
@ -114,10 +113,10 @@ build-debug: protos-debug
run-debug: build-debug
./dist/debug
build-dev-js:
go mod download
make build-lib build-js
npm run build:ts
build-dev-js: setup build-lib build-js protos-ts
cp -r jsaddon/build ../js-anytype/
cp build/ts/commands.js ../js-anytype/src/proto/commands.js
install-dev-js:
cp -r jsaddon/build ../js-anytype/
cp build/ts/commands.js ../js-anytype/src/proto/commands.js

View file

@ -3,15 +3,19 @@
#### How to build
1. Install Golang 1.12.* [from here](http://golang.org/dl/)
1. Install Golang 1.13.* [from here](http://golang.org/dl/)
2. `make setup` to install deps
3. `make build-lib` to build C(`.so`) library into `dist` folder
3. `make build-lib` to build C-archived(`lib.a + lib.h`) library into `dist` folder
4. `make build-js` to build NodeJS Addon into `jsaddon/build`
5. `npm install & npm build:ts` to compile proto files for TS/JS to `build/ts`
5. `npm install & npm build:ts` to compile proto files for TS/JS into `build/ts`
6. `make install-dev-js` to copy the compiled NodeJS addon and protobuf binding into `../js-anytype`
#### Rebuild proto files
This repo uses custom protoc plugin located at [anytypeio/protobuf/protoc-gen-gogo/gomobile](https://github.com/anytypeio/protobuf/tree/master/protoc-gen-gogo/gomobile).
So make sure you have installed it:
#### Rebuild protobuf generated files
This repo uses custom protoc located at [anytypeio/protobuf](https://github.com/anytypeio/protobuf/tree/master/protoc-gen-gogo). It adds `gomobile` plugin and some env-controlled options to control the generated code style.
This protobuf generator will replace your `protoc` binary, BTW it doesn't have any breaking changes for other protobuf and grpc code
You can install it with a simple command:
```
make setup-protoc
```
@ -21,26 +25,6 @@ Then you can easily regenerate proto files:
make protos
```
#### Run local gRPC server to debug
⚠️ Make sure to update/install protobuf compiler from [this repo](https://github.com/anytypeio/protobuf) using `make setup-protoc`
Commands:
`make run-debug` - builds proto files for grpc server, builds the binary and runs it
`make build-debug` - builds proto files for grpc server and builds the binary into `dist/debug`
If you want to change the default port(9999):
`ANYTYPE_GRPC_ADDR=127.0.0.1:8888 make run-debug`
Useful tools for debug:
**GUI**
https://github.com/uw-labs/bloomrpc
`HowTo: Set the import path to the middleware root, then select commands.proto file`
**CLI**
https://github.com/njpatel/grpcc
#### Run tests
GO test:
```
@ -52,3 +36,27 @@ NodeJS addon test:
cd jsaddon
npm run test
```
#### Run local gRPC server to debug
⚠️ Make sure to update/install protobuf compiler from [this repo](https://github.com/anytypeio/protobuf) using `make setup-protoc`
Commands:
- `make run-debug` - builds proto files for grpc server, builds the binary and runs it
- `make build-debug` - builds proto files for grpc server and builds the binary into `dist/debug`
If you want to change the default port(9999):
`ANYTYPE_GRPC_ADDR=127.0.0.1:8888 make run-debug`
----
Useful tools for debug:
**GUI**
https://github.com/uw-labs/bloomrpc
`HowTo: Set the import path to the middleware root, then select commands.proto file`
**CLI**
https://github.com/njpatel/grpcc