aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/proto/serialize_format.proto
blob: a7f913057db659337340888addbd498ad77fbec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright 2016 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto2";

// option java_api_version = 2;

package xml;

option java_package = "com.google.devtools.build.android.proto";

// A header message describing information about the rest of the message stream,
// It will be the first message in a buffer that contain these messages.
// See com.google.devtools.build.android.AndroidDataSerializer for details on
// how these messages are used.
message Header {
  // The number of entries stored in a serialized buffer.
  optional uint32 entry_count = 1;
  // The number of ProtoSource entries.
  optional uint32 source_count = 2;
}

// The serialized format for a DataKey.
message DataKey {
  // Used for both the FullyQualifiedName name and RelativeAssetPath path
  optional string key_value = 2;
  // The resource type for FullyQualifiedNames
  optional string resource_type = 3;
  optional string key_package = 4;
  repeated string qualifiers = 5;
  // The size of the associated value. Useful for calculating an offset.
  // Required
  optional int32 value_size = 6;
  // Whether this DataKey is a reference to another DataKey.
  optional bool reference = 7;
}

// The serialized format for a DataValue.
message DataValue {
  // The index of the ProtoSource in the source table section.
  // Required
  optional uint32 source_id = 1;

  // If xml_value is defined it's an xml value, otherwise, it's a file value.
  optional DataValueXml xml_value= 2;
}

// A container for all the source information to be persisted.
message ProtoSource {
  // Required
  optional string filename = 1;
  // The indexes of sources this source replaces.
  repeated uint32 overwritten = 2;
}

// The container for a serialized xml value.
message DataValueXml {
  enum XmlType {
    ARRAY = 0;
    ATTR = 1;
    ID = 2;
    PLURAL = 3;
    PUBLIC = 4;
    SIMPLE = 5;
    STYLEABLE = 6;
    STYLE = 7;
    RESOURCES_ATTRIBUTE = 8;
  }

  optional XmlType type = 1;
  map<string, string> mapped_string_value = 2;
  map<string, DataValueXml> mapped_xml_value = 3;
  repeated string list_value = 4;
  optional string value = 5;
  optional string value_type = 6;
  repeated DataKey references = 7;
  map<string, string> attribute = 8;
  map<string, string> namespace = 9;
}

// Container for serialized attributes.
message ToolAttributes {
  message ToolAttributeValues {
    repeated string values = 1;
  }
  map<string, ToolAttributeValues> attributes = 1;
}