Skip to content

Commit

Permalink
Squashed 'src/machinetalk/proto/' changes from 211433bfb..f4481f561
Browse files Browse the repository at this point in the history
f4481f561 Merge pull request machinekit#81 from machinekoder/machinekit-updates
17178e54f add jplan and ros proto definitions
6a2762863 fix gitignore
98f68e22b rtapi_message: fix whitespace
cfc23327e specify proto2 syntax
50d5b91a7 merging updates from upstream Machinekit
30cb027e3 Merge pull request mhaberler#80 from machinekit/ArcEye-patch-1
394d3d897 Amend asciidoc.mustache
a328a2478 Merge pull request mhaberler#79 from machinekoder/js-bundle-update
60f39299a Merge pull request mhaberler#78 from machinekoder/python-build-fix
95f6c564e update js bundles
2179c974f reorder Makefile commands correctly
5531e8cf1 Merge pull request mhaberler#77 from machinekoder/java-support
6c428b26f adding Java build
add0bf491 Merge pull request mhaberler#75 from machinekoder/doc-build-fix
4b58961c0 fix docs build
8cb5b75ce Merge pull request mhaberler#74 from machinekoder/pypi2
dc0d32268 PyPI: update dependencies
6211ed296 Merge pull request mhaberler#73 from machinekoder/pypi
9b16d1f9e preparing for PyPi

git-subtree-dir: src/machinetalk/proto
git-subtree-split: f4481f561ac76a6976afad03f13c7b8e0f7af318
  • Loading branch information
machinekoder committed Jun 30, 2017
1 parent 086bbce commit a1ff330
Show file tree
Hide file tree
Showing 32 changed files with 1,109 additions and 8,033 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build
node_modules
objects
generated
/node_modules
/objects
/generated
/machinetalk
/doc_base
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE
include README.md
recursive-include src/machinetalk/protobuf *.proto
recursive-include python/example *
93 changes: 59 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ CXXGEN := $(BUILDDIR)/cpp
# generated Python files
PYGEN := $(BUILDDIR)/python

# generated Java files
JAVAGEN := $(BUILDDIR)/java

# generated Documentation files
# default to asciidoc template
# for mk-docs formatting, pass in TEMPLATE pointing to the mk-docs template
TEMPLATE := $(SRCDIRINV)/scripts/asciidoc.mustache
DOCFORMAT := asciidoc
DOCEXT := asciidoc
#DOCFORMAT := markdown
#DOCEXT := md
DOCTEMPLATE := $(SRCDIRINV)/scripts/$(DOCFORMAT).mustache

DOCGEN := $(BUILDDIR)/doc

Expand All @@ -73,14 +76,18 @@ vpath %.proto $(PROTODIR):$(GPBINCLUDE):$(DESCDIR)/compiler

# $(PROJECT)/proto/*.proto derived Python bindings
PROTO_PY_TARGETS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(PYGEN)/%_pb2.py}
PROTO_PY_EXTRAS := $(PYGEN)/setup.py $(PYGEN)/$(PROJECT)/__init__.py $(PYGEN)/$(PROJECT)/protobuf/__init__.py
PROTO_PY_EXTRAS := $(PYGEN)/$(PROJECT)/__init__.py $(PYGEN)/$(PROJECT)/protobuf/__init__.py

# generated C++ includes
PROTO_CXX_INCS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(CXXGEN)/%.pb.h}

# generated C++ sources
PROTO_CXX_SRCS := ${PROTO_SPECS:$(SRCDIR)/%.proto=$(CXXGEN)/%.pb.cc}

# generated Java sources
uppercase_file = $(shell echo "$(1)" | sed 's/\(.*\/\)\(.*\)/\1\u\2/')
PROTO_JAVA_TARGETS := $(foreach JAVA,${PROTO_SPECS:$(SRCDIR)/%.proto=$(JAVAGEN)/%.java},$(call uppercase_file,$(JAVA)))

# generated doc file
DOC_TARGET := $(DOCGEN)/$(PROJECT)-protobuf.$(DOCEXT)

Expand All @@ -107,7 +114,36 @@ GENERATED += \
$(PROTO_CXX_SRCS)\
$(PROTO_CXX_INCS) \
$(PROTO_PY_TARGETS) \
$(PROTO_PY_EXTRAS)
$(PROTO_PY_EXTRAS) \
$(PROTO_JAVA_TARGETS)

all: $(PROTO_DEPS) $(GENERATED)

# include dependecy files
-include $(PROTO_DEPS)

ios_replace:
sh scripts/ios-replace.sh $(CXXGEN)

docs: $(DOC_TARGET)

.PHONY: clean
clean:
rm -rf build

install_proto: $(PROTO_SPECS)
mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR)
for proto in $(PROTO_SPECS); do \
install -m 0644 $$proto $(DESTDIR)/include/$(NAMESPACEDIR); \
done

install_cpp: $(PROTO_CXX_INCS)
mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR)
for headerfile in $(PROTO_CXX_INCS); do \
install -m 0644 $$headerfile $(DESTDIR)/include/$(NAMESPACEDIR); \
done

install: install_proto install_cpp

$(OBJDIR)/%.d: $(SRCDIR)/%.proto
$(ECHO) "protoc create dependencies for $<"
Expand Down Expand Up @@ -147,49 +183,38 @@ $(PYGEN)/%_pb2.py: $(SRCDIR)/%.proto
--python_out=$(PYGEN)/ \
$<

$(PYGEN)/%.py: python/%.py
cp "$<" "$@"
$(PYGEN)/%/__init__.py:
$(ECHO) "creating __init__ file $@"
@touch "$@"

# ------------- Java rules ------------
#
# generate Java packages from proto files
define java_from_proto
$(call uppercase_file,$(1:$(SRCDIR)/%.proto=$(JAVAGEN)/%.java)): $1
$(ECHO) "protoc create $$@ from $$<"
@mkdir -p $(JAVAGEN)
$(Q)$(PROTOC) $(PROTOC_FLAGS) \
--proto_path=$(SRCDIR)/ \
--proto_path=$(GPBINCLUDE)/ \
--java_out=$(JAVAGEN)/ \
$$<
endef
$(foreach PROTO,$(PROTO_SPECS),$(eval $(call java_from_proto,$(PROTO))))

# force create of %.proto-dependent files and their deps
Makefile: $(GENERATED) $(PROTO_DEPS)
-include $(PROTO_DEPS)

# ------------- protoc-gen-doc rules ------------
#
# see https://github.com/estan/protoc-gen-doc
#
# generate $(DOCFORMAT) files from proto files
$(DOC_TARGET): $(wildcard $(SRCDIR)/*.proto) $(TEMPLATE) Makefile
$(DOC_TARGET): $(wildcard $(SRCDIR)/*.proto)
#doc_base:
$(ECHO) "protoc create $@ from *.proto"
@mkdir -p $(DOCGEN)
$(Q)cd $(SRCDIR); \
$(PROTOC) $(PROTOC_FLAGS) \
--proto_path=./ \
--proto_path=$(GPBINCLUDE)/ \
--doc_out=$(TEMPLATE),$(SRCDIRINV)/$@:./ \
--doc_out=$(DOCTEMPLATE),$(SRCDIRINV)/$@:./ \
$(NAMESPACEDIR)/*.proto

all: $(GENERATED) $(PROTO_DEPS)

ios_replace:
sh scripts/ios-replace.sh $(CXXGEN)

docs: $(PROTO_DEPS) $(DOC_TARGET)

clean:
rm -rf build

install_proto: $(PROTO_SPECS)
mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR)
for proto in $(PROTO_SPECS); do \
install -m 0644 $$proto $(DESTDIR)/include/$(NAMESPACEDIR); \
done

install_cpp: $(PROTO_CXX_INCS)
mkdir -p $(DESTDIR)/include/$(NAMESPACEDIR)
for headerfile in $(PROTO_CXX_INCS); do \
install -m 0644 $$headerfile $(DESTDIR)/include/$(NAMESPACEDIR); \
done

install: install_proto install_cpp
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ Now create a PR against the machinekit repo.

## Python

### Installation

### Installation via PyPi
To use the Machinetalk protobuf Python modules in your projects, use:

```sh
cd python
pip install machinetalk-protobuf
```

### Installation from source
Alternatively you can install the Python modules directly from the source code.

```sh
python setup.py build
sudo python setup.py install
```
Expand Down
9 changes: 8 additions & 1 deletion dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ machinetalk-protobuf.js is available either only with ProtoBuf.js included.
* **[machinetalk-protobuf.min.map](https://raw.githubusercontent.com/machinekit/machinetalk-protobuf/master/dist/machinetalk-protobuf.min.map)**
is the source map generated by Closure Compiler.

### Updates and Pull Requests
When sending pull requests, please note that these files have been automatically generated from the sources located in
[src/](https://github.com/machinekit/machinekit-protobuf/tree/master/src).
[src/](https://github.com/machinekit/machinetalk-protobuf/tree/master/src).

You can regenerate the bundle with the following commands in the root directory of the repository:
```bash
npm install
npm run bundle
```
Loading

0 comments on commit a1ff330

Please sign in to comment.