OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of protoc; | 5 part of protoc; |
6 | 6 |
7 class FileGenerator implements ProtobufContainer { | 7 class FileGenerator implements ProtobufContainer { |
8 final FileDescriptorProto _fileDescriptor; | 8 final FileDescriptorProto _fileDescriptor; |
9 final ProtobufContainer _parent; | 9 final ProtobufContainer _parent; |
10 final GenerationContext _context; | 10 final GenerationContext _context; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 String libraryName = _generateLibraryName(filePath); | 111 String libraryName = _generateLibraryName(filePath); |
112 | 112 |
113 out.println( | 113 out.println( |
114 '///\n' | 114 '///\n' |
115 '// Generated code. Do not modify.\n' | 115 '// Generated code. Do not modify.\n' |
116 '///\n' | 116 '///\n' |
117 'library $libraryName;\n' | 117 'library $libraryName;\n' |
118 '\n' | 118 '\n' |
119 "import 'dart:typed_data';\n\n" | 119 "import 'dart:typed_data';\n" |
| 120 '\n' |
| 121 "import 'package:fixnum/fixnum.dart';\n" |
120 "import 'package:protobuf/protobuf.dart';" | 122 "import 'package:protobuf/protobuf.dart';" |
121 ); | 123 ); |
122 | 124 |
123 for (String import in _fileDescriptor.dependency) { | 125 for (String import in _fileDescriptor.dependency) { |
124 Uri importPath = new Uri.file(import); | 126 Uri importPath = new Uri.file(import); |
125 if (importPath.isAbsolute) { | 127 if (importPath.isAbsolute) { |
126 // protoc should never generate an import with an absolute path. | 128 // protoc should never generate an import with an absolute path. |
127 throw("FAILURE: Import with absolute path is not supported"); | 129 throw("FAILURE: Import with absolute path is not supported"); |
128 } | 130 } |
129 // Create a relative path from the current file to the import. | 131 // Create a relative path from the current file to the import. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 <String, ProtobufContainer>{}; | 173 <String, ProtobufContainer>{}; |
172 | 174 |
173 GenerationContext(this.options); | 175 GenerationContext(this.options); |
174 | 176 |
175 void register(ProtobufContainer container) { | 177 void register(ProtobufContainer container) { |
176 _registry[container.fqname] = container; | 178 _registry[container.fqname] = container; |
177 } | 179 } |
178 | 180 |
179 ProtobufContainer operator [](String fqname) => _registry[fqname]; | 181 ProtobufContainer operator [](String fqname) => _registry[fqname]; |
180 } | 182 } |
OLD | NEW |