Home | History | Annotate | Download | only in aapt2
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      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 syntax = "proto2";
     18 
     19 option optimize_for = LITE_RUNTIME;
     20 
     21 package aapt.pb;
     22 
     23 message ConfigDescription {
     24 	optional bytes data = 1;
     25 	optional string product = 2;
     26 }
     27 
     28 message StringPool {
     29 	optional bytes data = 1;
     30 }
     31 
     32 message CompiledFile {
     33 	message Symbol {
     34 		optional string resource_name = 1;
     35 		optional uint32 line_no = 2;
     36 	}
     37 
     38 	optional string resource_name = 1;
     39 	optional ConfigDescription config = 2;
     40 	optional string source_path = 3;
     41 	repeated Symbol exported_symbols = 4;
     42 }
     43 
     44 message ResourceTable {
     45 	optional StringPool string_pool = 1;
     46 	optional StringPool source_pool = 2;
     47 	optional StringPool symbol_pool = 3;
     48 	repeated Package packages = 4;
     49 }
     50 
     51 message Package {
     52 	optional uint32 package_id = 1;
     53 	optional string package_name = 2;
     54 	repeated Type types = 3;
     55 }
     56 
     57 message Type {
     58 	optional uint32 id = 1;
     59 	optional string name = 2;
     60 	repeated Entry entries = 3;
     61 }
     62 
     63 message SymbolStatus {
     64 	enum Visibility {
     65 		Unknown = 0;
     66 		Private = 1;
     67 		Public = 2;
     68 	}
     69 	optional Visibility visibility = 1;
     70 	optional Source source = 2;
     71 	optional string comment = 3;
     72 }
     73 
     74 message Entry {
     75 	optional uint32 id = 1;
     76 	optional string name = 2;
     77 	optional SymbolStatus symbol_status = 3;
     78 	repeated ConfigValue config_values = 4;
     79 }
     80 
     81 message ConfigValue {
     82 	optional ConfigDescription config = 1;
     83 	optional Value value = 2;
     84 }
     85 
     86 message Source {
     87 	optional uint32 path_idx = 1;
     88 	optional uint32 line_no = 2;
     89 	optional uint32 col_no = 3;
     90 }
     91 
     92 message Reference {
     93 	enum Type {
     94 		Ref = 0;
     95 		Attr = 1;
     96 	}
     97 	optional Type type = 1;
     98 	optional uint32 id = 2;
     99 	optional uint32 symbol_idx = 3;
    100 	optional bool private = 4;
    101 }
    102 
    103 message Id {
    104 }
    105 
    106 message String {
    107 	optional uint32 idx = 1;
    108 }
    109 
    110 message RawString {
    111 	optional uint32 idx = 1;
    112 }
    113 
    114 message FileReference {
    115 	optional uint32 path_idx = 1;
    116 }
    117 
    118 message Primitive {
    119 	optional uint32 type = 1;
    120 	optional uint32 data = 2;
    121 }
    122 
    123 message Attribute {
    124 	message Symbol {
    125 		optional Source source = 1;
    126 		optional string comment = 2;
    127 		optional Reference name = 3;
    128 		optional uint32 value = 4;
    129 	}
    130 	optional uint32 format_flags = 1;
    131 	optional int32 min_int = 2;
    132 	optional int32 max_int = 3;
    133 	repeated Symbol symbols = 4;
    134 }
    135 
    136 message Style {
    137 	message Entry {
    138 		optional Source source = 1;
    139 		optional string comment = 2;
    140 		optional Reference key = 3;
    141 		optional Item item = 4;
    142 	}
    143 
    144 	optional Reference parent = 1;
    145 	optional Source parent_source = 2;
    146 	repeated Entry entries = 3;
    147 }
    148 
    149 message Styleable {
    150 	message Entry {
    151 		optional Source source = 1;
    152 		optional string comment = 2;
    153 		optional Reference attr = 3;
    154 	}
    155 	repeated Entry entries = 1;
    156 }
    157 
    158 message Array {
    159 	message Entry {
    160 		optional Source source = 1;
    161 		optional string comment = 2;
    162 		optional Item item = 3;
    163 	}
    164 	repeated Entry entries = 1;
    165 }
    166 
    167 message Plural {
    168 	enum Arity {
    169 		Zero = 0;
    170 		One = 1;
    171 		Two = 2;
    172 		Few = 3;
    173 		Many = 4;
    174 		Other = 5;
    175 	}
    176 
    177 	message Entry {
    178 		optional Source source = 1;
    179 		optional string comment = 2;
    180 		optional Arity arity = 3;
    181 		optional Item item = 4;
    182 	}
    183 	repeated Entry entries = 1;
    184 }
    185 
    186 message Item {
    187 	optional Reference ref = 1;
    188 	optional String str = 2;
    189 	optional RawString raw_str = 3;
    190 	optional FileReference file = 4;
    191 	optional Id id = 5;
    192 	optional Primitive prim = 6;
    193 }
    194 
    195 message CompoundValue {
    196 	optional Attribute attr = 1;
    197 	optional Style style = 2;
    198 	optional Styleable styleable = 3;
    199 	optional Array array = 4;
    200 	optional Plural plural = 5;
    201 }
    202 
    203 message Value {
    204 	optional Source source = 1;
    205 	optional string comment = 2;
    206 	optional bool weak = 3;
    207 
    208 	optional Item item = 4;
    209 	optional CompoundValue compound_value = 5;
    210 }
    211