Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add asdf:*PROTOC-RELATIVE-PATH* to control whether a relative or abso…

…lute

file path is used for the proto file argument to protoc.  The internal
Google compiler wants a relative file path, but the external compiler wants
an absolute path.  Also, add syntax="proto2" to all proto files so the
Google internal protobuf compiler is happy with them.
  • Loading branch information...
commit da7eaa9236fd32f076bd4c0da982bbd8e8073dd8 1 parent 1bbff50
Robert Brown authored December 21, 2010
2  example/addressbook.proto
... ...
@@ -1,5 +1,7 @@
1 1
 // See README.txt for information and build instructions.
2 2
 
  3
+syntax = "proto2";      // for compatibility with internal Google compiler
  4
+
3 5
 package tutorial;
4 6
 
5 7
 option java_package = "com.example.tutorial";
2  google/protobuf/descriptor.proto
@@ -36,7 +36,7 @@
36 36
 // A valid .proto file can be translated directly to a FileDescriptorProto
37 37
 // without any other information (e.g. without reading its imports).
38 38
 
39  
-
  39
+syntax = "proto2";      // for compatibility with internal Google compiler
40 40
 
41 41
 package google.protobuf;
42 42
 option java_package = "com.google.protobuf";
1  google/protobuf/unittest.proto
@@ -34,6 +34,7 @@
34 34
 //
35 35
 // A proto file we will use for unit testing.
36 36
 
  37
+syntax = "proto2";      // for compatibility with internal Google compiler
37 38
 
38 39
 // Some generic_services option(s) added automatically.
39 40
 // See:  http://go/proto2-generic-services-default
1  google/protobuf/unittest_import.proto
@@ -34,6 +34,7 @@
34 34
 //
35 35
 // A proto file which is imported by unittest.proto to test importing.
36 36
 
  37
+syntax = "proto2";      // for compatibility with internal Google compiler
37 38
 
38 39
 // We don't put this in a package within proto2 because we need to make sure
39 40
 // that the generated code doesn't depend on being in the proto2 namespace.
10  protobuf.asd
@@ -47,6 +47,11 @@
47 47
   "Pathname of the Lisp protocol buffer compiler backend, protoc-gen-lisp.")
48 48
 (export '*protoc-gen-lisp*)
49 49
 
  50
+(defvar *protoc-relative-path* nil
  51
+  "Proto file arguments to the protobuf compiler are relative paths?")
  52
+(export '*protoc-relative-path*)
  53
+
  54
+
50 55
 (defclass protobuf-source-file (cl-source-file)
51 56
   ((relative-proto-pathname
52 57
     :initarg :proto-pathname
@@ -145,6 +150,9 @@ relative to PARENT-PATH."
145 150
 
146 151
 (defmethod perform ((operation proto-to-lisp) (component protobuf-source-file))
147 152
   (let* ((source-file (proto-input component))
  153
+         (source-file-argument (if *protoc-relative-path*
  154
+                                   (file-namestring source-file)
  155
+                                   (namestring source-file)))
148 156
          ;; Around methods on output-file may globally redirect output
149 157
          ;; products, so we must call that method instead of executing
150 158
          ;; (component-pathname component).
@@ -155,7 +163,7 @@ relative to PARENT-PATH."
155 163
                                     (namestring *protoc-gen-lisp*)
156 164
                                     search-path
157 165
                                     (directory-namestring output-file)
158  
-                                    (namestring source-file))))
  166
+                                    source-file-argument)))
159 167
     (unless (zerop status)
160 168
       (error 'compile-failed :component component :operation operation))))
161 169
 
2  testproto1.proto
@@ -27,6 +27,8 @@
27 27
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 28
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
 
  30
+syntax = "proto2";      // for compatibility with internal Google compiler
  31
+
30 32
 // dummy message to include in other messages.
31 33
 message Test1Msg {
32 34
   optional int32 foo = 1;
2  testproto2.proto
@@ -27,6 +27,8 @@
27 27
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 28
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
 
  30
+syntax = "proto2";      // for compatibility with internal Google compiler
  31
+
30 32
 message TimeProtocol {
31 33
   repeated group G = 1 {
32 34
     required int32 V1 = 2;

0 notes on commit da7eaa9

Please sign in to comment.
Something went wrong with that request. Please try again.