• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2019 The Dagger Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// Serialized forms of types used in the Dagger processor. The wire format of
18// these types is not guaranteed to remain compatible over time; serialization
19// is only expected to function correctly within an individual version of the
20// Dagger processor.
21
22syntax = "proto3";
23
24package dagger.internal.codegen.serialization;
25option java_package = "dagger.internal.codegen.serialization";
26option java_multiple_files = true;
27
28// TODO(ronshapiro): consider exposing some of these in
29// dagger.model.serialization
30
31// Serialized form of `dagger.internal.codegen.BindingRequest`
32message BindingRequestProto {
33  KeyProto key = 1;
34  RequestKindWrapper.RequestKind request_kind = 2;
35  FrameworkTypeWrapper.FrameworkType framework_type = 3;
36}
37
38message RequestKindWrapper {
39  // Serialized form of `dagger.model.RequestKind`
40  enum RequestKind {
41    UNKNOWN = 0;
42    INSTANCE = 1;
43    PROVIDER = 2;
44    LAZY = 3;
45    PROVIDER_OF_LAZY = 4;
46    MEMBERS_INJECTION = 5;
47    PRODUCER = 6;
48    PRODUCED = 7;
49    FUTURE = 8;
50  }
51}
52
53message FrameworkTypeWrapper {
54  // Serialized form of `dagger.internal.codegen.FrameworkType`
55  enum FrameworkType {
56    UNKNOWN = 0;
57    PROVIDER = 1;
58    PRODUCER_NODE = 2;
59  }
60}
61
62// Serialized form of `dagger.model.Key`
63message KeyProto {
64  TypeProto type = 1;
65  AnnotationProto qualifier = 2;
66  MultibindingContributionIdentifier multibinding_contribution_identifier =
67      3;
68
69  // Serialized form of `dagger.model.Key.MultibindingContributionIdentifier`
70  message MultibindingContributionIdentifier {
71    string module = 1;
72    string binding_element = 2;
73  }
74}
75
76// Serialized form of `javax.lang.model.type.TypeMirror`
77message TypeProto {
78  PrimitiveKind primitive_kind = 1;
79
80  // The qualified name of the type. Absent if this is an inner type.
81  string qualified_name = 2;
82
83  // The enclosing type if this is an inner type, otherwise absent.
84  TypeProto enclosing_type = 3;
85
86  // Simple name of the type if this is an inner type, otherwise absent.
87  string simple_name = 4;
88
89  repeated TypeProto type_arguments = 5;
90
91  message Wildcard {
92    TypeProto extends_bound = 1;
93    TypeProto super_bound = 2;
94  }
95  Wildcard wildcard = 6;
96
97  int32 array_dimensions = 7;
98
99  // Kinds of primitive types
100  enum PrimitiveKind {
101    UNKNOWN = 0;
102    BOOLEAN = 1;
103    BYTE = 2;
104    SHORT = 3;
105    CHAR = 4;
106    INT = 5;
107    FLOAT = 6;
108    LONG = 7;
109    DOUBLE = 8;
110  }
111}
112
113// Serialized form of `javax.lang.model.element.AnnotationMirror`
114message AnnotationProto {
115  TypeProto annotation_type = 1;
116  map<string, AnnotationValueProto> values = 2;
117}
118
119// Serialized form of `javax.lang.model.element.AnnotationValue`
120message AnnotationValueProto {
121  Kind kind = 1;
122  bool boolean_value = 2;
123  int32 int_value = 3;
124  int64 long_value = 4;
125  float float_value = 5;
126  double double_value = 6;
127  string string_value = 7;
128  TypeProto class_literal = 8;
129  TypeProto enum_type = 9;
130  string enum_name = 10;
131  AnnotationProto nested_annotation = 11;
132
133  repeated AnnotationValueProto array_values = 12;
134
135  // The type of annotation value
136  enum Kind {
137    UNKNOWN = 0;
138    BOOLEAN = 1;
139    BYTE = 2;
140    SHORT = 3;
141    CHAR = 4;
142    INT = 5;
143    FLOAT = 6;
144    LONG = 7;
145    DOUBLE = 8;
146    STRING = 9;
147    CLASS_LITERAL = 10;
148    ENUM = 11;
149    ANNOTATION = 12;
150    ARRAY = 13;
151  }
152}
153
154// Serialized form of `dagger.internal.codegen.ComponentRequirement`
155message ComponentRequirementProto {
156  oneof requirement {
157    TypeProto dependency = 1;
158    TypeProto module = 2;
159    BoundInstanceRequirement bound_instance = 3;
160  }
161
162  message BoundInstanceRequirement {
163    KeyProto key = 1;
164    bool nullable = 2;
165    string variable_name = 3;
166  }
167}
168