Skip to content

Commit

Permalink
Reword protoc-gen-lisp to protoc-gen-cl-pb
Browse files Browse the repository at this point in the history
It has been asked we change the name of the lisp
protoc plugin to protoc-gen-cl-pb.
See #276
This does that.

PiperOrigin-RevId: 435654831
  • Loading branch information
Jonathan Godbout authored and copybara-github committed Mar 18, 2022
1 parent b909723 commit 806ed0c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
1 change: 0 additions & 1 deletion .github/workflows/SBCL-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- name: Download quicklisp
run: curl -o quicklisp.lisp 'https://beta.quicklisp.org/quicklisp.lisp'


- name: Install quicklisp
run: |
sbcl --noinform --non-interactive --load quicklisp.lisp --eval "(quicklisp-quickstart:install :path \"$GITHUB_WORKSPACE/quicklisp/\")"
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Version 3.1

* Change the name of the Lisp `protoc` plugin from `protoc-gen-lisp`
to `protoc-gen-cl-pb` to prevent conflict with Robert Browns protocol
buffer implementation.
See: https://github.com/qitab/cl-protobufs/issues/276.

## Version 3.1

* Improve the API for printing and parsing JSON format.

- Have `pretty-print-p` be a parameter to `print-json` instead of
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Common Lisp.
```shell
$ cd cl-protobufs/protoc
$ PROTOC_ROOT=/usr/local make # value of --prefix, above
$ sudo cp protoc-gen-lisp /usr/local/bin/
$ sudo cp protoc-gen-cl-pb /usr/local/bin/
```

Make sure the installation directory is on your `PATH`.
Expand All @@ -68,13 +68,13 @@ Several examples can be found in `cl-protobufs.asd`.
To test your build, try generating Lisp code from the
`cl-protobufs/tests/case-preservation.proto` file with the following command.
Note that the command may differ slightly depending on what directory you're in
and where you installed `protoc-gen-lisp`. In this case we assume you're in the
and where you installed `protoc-gen-cl-pb`. In this case we assume you're in the
directory **containing** the `cl-protobufs` directory. The reason will become
clear in a moment.

```shell
$ protoc --plugin=protoc-gen-lisp=/usr/local/bin/protoc-gen-lisp \
--lisp_out=output-file=case-preservation.lisp:/tmp \
$ protoc --plugin=protoc-gen-cl-pb=/usr/local/bin/protoc-gen-cl-pb \
--cl-pb_out=output-file=case-preservation.lisp:/tmp \
cl-protobufs/tests/case-preservation.proto
```

Expand All @@ -90,8 +90,8 @@ To see an example of this, you can try generating Lisp code for
following command:

```shell
protoc --plugin=protoc-gen-lisp=/usr/local/bin/protoc-gen-lisp \
--lisp_out=output-file=extend.lisp:/tmp
protoc --plugin=protoc-gen-cl-pb=/usr/local/bin/protoc-gen-cl-pb \
--cl-pb_out=output-file=extend.lisp:/tmp
--proto_path=cl-protobufs/tests \
cl-protobufs/tests/extend.proto
```
Expand Down Expand Up @@ -162,14 +162,14 @@ The full name of the Lisp type for the `AddNumbersRequest` message is
## Generated Code Guide

This section explains the code generated from a `.proto` file by
`protoc-gen-lisp`, the Common Lisp plugin for `protoc`. See the "protoc"
`protoc-gen-cl-pb`, the Common Lisp plugin for `protoc`. See the "protoc"
directory in this distribution for the plugin code.

Note that `protoc-gen-lisp` transforms protobuf names like `MyMessage` or
Note that `protoc-gen-cl-pb` transforms protobuf names like `MyMessage` or
`my_field` to names that are more Lisp-like, such as `my-message` and
`my-field`.

The code generated by `protoc-gen-lisp` uses macros to define the generated API.
The code generated by `protoc-gen-cl-pb` uses macros to define the generated API.
Protocol buffer messages should be defined in `.proto` files instead of invoking
these macros directly. Internal details that are not in the API documented below
may change incompatibly in the future.
Expand Down
2 changes: 1 addition & 1 deletion asdf.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ to PARENT-PATH."
;; that method instead of executing (component-pathname component).
(output-file (first (output-files operation component)))
(search-path (cons (directory-namestring source-file) (resolve-search-path component)))
(command (format nil "protoc --proto_path=~{~A~^:~} --lisp_out=output-file=~A:~A ~A ~
(command (format nil "protoc --proto_path=~{~A~^:~} --cl-pb_out=output-file=~A:~A ~A ~
--experimental_allow_proto3_optional"
search-path
(file-namestring output-file)
Expand Down
2 changes: 1 addition & 1 deletion define-proto.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ function) then there is no guarantee on the serialize function working properly.
Parameters:
TYPE - Symbol naming the new type.
NAME - Optional symbol used to override the defaultly generated protobuf message name.
This is supplied automatically by protoc-gen-lisp when TYPE cannot be accurately
This is supplied automatically by protoc-gen-cl-pb when TYPE cannot be accurately
converted back to a camelCase name.
ALIAS-FOR - If supplied, no Lisp struct is defined. Instead, the message is used
as an alias for a class that already exists. This feature is intended to be
Expand Down
2 changes: 1 addition & 1 deletion model-classes.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Parameters:

(defun add-file-descriptor (pathname symbol)
"Register the file-descriptor named by SYMBOL under the key PATHNAME.
Intended for use by protoc-gen-lisp."
Intended for use by protoc-gen-cl-pb."
(setf (gethash pathname *file-descriptors*) (find-file-descriptor symbol)))

(defstruct message
Expand Down
12 changes: 6 additions & 6 deletions protoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# Directory into which the Lisp protocol buffer plugin,
# protoc-gen-lisp, will be installed.
# protoc-gen-cl-pb, will be installed.
INSTALL_ROOT ?= /usr/local/bin

# Directory where Google's protocol buffer compiler is installed. This
Expand All @@ -25,15 +25,15 @@ OFILES = enum.o field.o file.o generator.o literals.o message.o \
CXXFLAGS = -std=c++14 -I$(PROTOC_ROOT)/include -I.
LIBS = -Wl,-L$(PROTOC_ROOT)/lib -Wl,-rpath -Wl,$(PROTOC_ROOT)/lib -lprotoc -lprotobuf -pthread

protoc-gen-lisp: $(OFILES) Makefile
$(CXX) $(OFILES) -o protoc-gen-lisp $(LIBS)
protoc-gen-cl-pb: $(OFILES) Makefile
$(CXX) $(OFILES) -o protoc-gen-cl-pb $(LIBS)

install: protoc-gen-lisp
install: protoc-gen-cl-pb
mkdir -p $(INSTALL_ROOT)
cp protoc-gen-lisp $(INSTALL_ROOT)/
cp protoc-gen-cl-pb $(INSTALL_ROOT)/

clean: .
rm -f $(OFILES) protoc_middleman protoc-gen-lisp
rm -f $(OFILES) protoc_middleman protoc-gen-cl-pb

# Generate the proto2 descriptor cpp files.
protoc_middleman: ../google/protobuf/proto2-descriptor-extensions.proto
Expand Down

0 comments on commit 806ed0c

Please sign in to comment.