Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | #include "test/Builders.h" |
| 18 | |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 19 | #include "Diagnostics.h" |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 20 | #include "android-base/logging.h" |
| 21 | #include "androidfw/StringPiece.h" |
Adam Lesinski | 0045116 | 2017-10-03 07:44:08 -0700 | [diff] [blame] | 22 | #include "io/StringStream.h" |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 23 | #include "test/Common.h" |
| 24 | #include "util/Util.h" |
| 25 | |
Shane Farmer | efe4539 | 2017-08-21 14:39:28 -0700 | [diff] [blame] | 26 | using ::aapt::configuration::Abi; |
| 27 | using ::aapt::configuration::AndroidSdk; |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 28 | using ::aapt::configuration::ConfiguredArtifact; |
Shane Farmer | 78c43d7 | 2017-12-04 09:08:38 -0800 | [diff] [blame] | 29 | using ::aapt::configuration::GetOrCreateGroup; |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 30 | using ::aapt::io::StringInputStream; |
MÃ¥rten Kongstad | 24c9aa6 | 2018-06-20 08:46:41 +0200 | [diff] [blame] | 31 | using ::android::ConfigDescription; |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 32 | using ::android::StringPiece; |
| 33 | |
| 34 | namespace aapt { |
| 35 | namespace test { |
| 36 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 37 | ResourceTableBuilder& ResourceTableBuilder::AddSimple(StringPiece name, const ResourceId& id) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 38 | return AddValue(name, id, util::make_unique<Id>()); |
| 39 | } |
| 40 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 41 | ResourceTableBuilder& ResourceTableBuilder::AddSimple(StringPiece name, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 42 | const ConfigDescription& config, |
| 43 | const ResourceId& id) { |
| 44 | return AddValue(name, config, id, util::make_unique<Id>()); |
| 45 | } |
| 46 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 47 | ResourceTableBuilder& ResourceTableBuilder::AddReference(StringPiece name, StringPiece ref) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 48 | return AddReference(name, {}, ref); |
| 49 | } |
| 50 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 51 | ResourceTableBuilder& ResourceTableBuilder::AddReference(StringPiece name, const ResourceId& id, |
| 52 | StringPiece ref) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 53 | return AddValue(name, id, util::make_unique<Reference>(ParseNameOrDie(ref))); |
| 54 | } |
| 55 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 56 | ResourceTableBuilder& ResourceTableBuilder::AddString(StringPiece name, StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 57 | return AddString(name, {}, str); |
| 58 | } |
| 59 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 60 | ResourceTableBuilder& ResourceTableBuilder::AddString(StringPiece name, const ResourceId& id, |
| 61 | StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 62 | return AddValue(name, id, util::make_unique<String>(table_->string_pool.MakeRef(str))); |
| 63 | } |
| 64 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 65 | ResourceTableBuilder& ResourceTableBuilder::AddString(StringPiece name, const ResourceId& id, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 66 | const ConfigDescription& config, |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 67 | StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 68 | return AddValue(name, config, id, util::make_unique<String>(table_->string_pool.MakeRef(str))); |
| 69 | } |
| 70 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 71 | ResourceTableBuilder& ResourceTableBuilder::AddFileReference(StringPiece name, StringPiece path, |
Adam Lesinski | 8780eb6 | 2017-10-31 17:44:39 -0700 | [diff] [blame] | 72 | io::IFile* file) { |
| 73 | return AddFileReference(name, {}, path, file); |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 74 | } |
| 75 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 76 | ResourceTableBuilder& ResourceTableBuilder::AddFileReference(StringPiece name, const ResourceId& id, |
| 77 | StringPiece path, io::IFile* file) { |
Adam Lesinski | 8780eb6 | 2017-10-31 17:44:39 -0700 | [diff] [blame] | 78 | auto file_ref = util::make_unique<FileReference>(table_->string_pool.MakeRef(path)); |
| 79 | file_ref->file = file; |
| 80 | return AddValue(name, id, std::move(file_ref)); |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 83 | ResourceTableBuilder& ResourceTableBuilder::AddFileReference(StringPiece name, StringPiece path, |
Adam Lesinski | 8780eb6 | 2017-10-31 17:44:39 -0700 | [diff] [blame] | 84 | const ConfigDescription& config, |
| 85 | io::IFile* file) { |
| 86 | auto file_ref = util::make_unique<FileReference>(table_->string_pool.MakeRef(path)); |
| 87 | file_ref->file = file; |
| 88 | return AddValue(name, config, {}, std::move(file_ref)); |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 89 | } |
| 90 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 91 | ResourceTableBuilder& ResourceTableBuilder::AddValue(StringPiece name, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 92 | std::unique_ptr<Value> value) { |
| 93 | return AddValue(name, {}, std::move(value)); |
| 94 | } |
| 95 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 96 | ResourceTableBuilder& ResourceTableBuilder::AddValue(StringPiece name, const ResourceId& id, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 97 | std::unique_ptr<Value> value) { |
| 98 | return AddValue(name, {}, id, std::move(value)); |
| 99 | } |
| 100 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 101 | ResourceTableBuilder& ResourceTableBuilder::AddValue(StringPiece name, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 102 | const ConfigDescription& config, |
| 103 | const ResourceId& id, |
| 104 | std::unique_ptr<Value> value) { |
| 105 | ResourceName res_name = ParseNameOrDie(name); |
Ryan Mitchell | 1d008d1 | 2021-03-19 14:54:17 -0700 | [diff] [blame] | 106 | NewResourceBuilder builder(res_name); |
| 107 | builder.SetValue(std::move(value), config).SetAllowMangled(true); |
| 108 | if (id.id != 0U) { |
| 109 | builder.SetId(id); |
| 110 | } |
| 111 | |
| 112 | CHECK(table_->AddResource(builder.Build(), GetDiagnostics())); |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 113 | return *this; |
| 114 | } |
| 115 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 116 | ResourceTableBuilder& ResourceTableBuilder::SetSymbolState(StringPiece name, const ResourceId& id, |
Adam Lesinski | 71be705 | 2017-12-12 16:48:07 -0800 | [diff] [blame] | 117 | Visibility::Level level, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 118 | bool allow_new) { |
| 119 | ResourceName res_name = ParseNameOrDie(name); |
Ryan Mitchell | 1d008d1 | 2021-03-19 14:54:17 -0700 | [diff] [blame] | 120 | NewResourceBuilder builder(res_name); |
| 121 | builder.SetVisibility({level}).SetAllowNew({}).SetAllowMangled(true); |
| 122 | if (id.id != 0U) { |
| 123 | builder.SetId(id); |
| 124 | } |
| 125 | |
| 126 | CHECK(table_->AddResource(builder.Build(), GetDiagnostics())); |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 127 | return *this; |
| 128 | } |
| 129 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 130 | ResourceTableBuilder& ResourceTableBuilder::SetOverlayable(StringPiece name, |
Ryan Mitchell | 54237ff | 2018-12-13 15:44:29 -0800 | [diff] [blame] | 131 | const OverlayableItem& overlayable) { |
Ryan Mitchell | e4e989c | 2018-10-29 02:21:50 -0700 | [diff] [blame] | 132 | ResourceName res_name = ParseNameOrDie(name); |
Ryan Mitchell | 1d008d1 | 2021-03-19 14:54:17 -0700 | [diff] [blame] | 133 | CHECK(table_->AddResource( |
| 134 | NewResourceBuilder(res_name).SetOverlayable(overlayable).SetAllowMangled(true).Build(), |
| 135 | GetDiagnostics())); |
| 136 | return *this; |
| 137 | } |
| 138 | |
| 139 | ResourceTableBuilder& ResourceTableBuilder::Add(NewResource&& res) { |
| 140 | CHECK(table_->AddResource(std::move(res), GetDiagnostics())); |
Ryan Mitchell | e4e989c | 2018-10-29 02:21:50 -0700 | [diff] [blame] | 141 | return *this; |
| 142 | } |
| 143 | |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 144 | android::StringPool* ResourceTableBuilder::string_pool() { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 145 | return &table_->string_pool; |
| 146 | } |
| 147 | |
| 148 | std::unique_ptr<ResourceTable> ResourceTableBuilder::Build() { |
| 149 | return std::move(table_); |
| 150 | } |
| 151 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 152 | std::unique_ptr<Reference> BuildReference(StringPiece ref, const std::optional<ResourceId>& id) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 153 | std::unique_ptr<Reference> reference = util::make_unique<Reference>(ParseNameOrDie(ref)); |
| 154 | reference->id = id; |
| 155 | return reference; |
| 156 | } |
| 157 | |
| 158 | std::unique_ptr<BinaryPrimitive> BuildPrimitive(uint8_t type, uint32_t data) { |
| 159 | android::Res_value value = {}; |
| 160 | value.size = sizeof(value); |
| 161 | value.dataType = type; |
| 162 | value.data = data; |
| 163 | return util::make_unique<BinaryPrimitive>(value); |
| 164 | } |
| 165 | |
Adam Lesinski | 73bff1e | 2017-12-08 16:06:10 -0800 | [diff] [blame] | 166 | AttributeBuilder::AttributeBuilder() |
| 167 | : attr_(util::make_unique<Attribute>(android::ResTable_map::TYPE_ANY)) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | AttributeBuilder& AttributeBuilder::SetTypeMask(uint32_t typeMask) { |
| 171 | attr_->type_mask = typeMask; |
| 172 | return *this; |
| 173 | } |
| 174 | |
Adam Lesinski | 73bff1e | 2017-12-08 16:06:10 -0800 | [diff] [blame] | 175 | AttributeBuilder& AttributeBuilder::SetWeak(bool weak) { |
| 176 | attr_->SetWeak(weak); |
| 177 | return *this; |
| 178 | } |
| 179 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 180 | AttributeBuilder& AttributeBuilder::AddItem(StringPiece name, uint32_t value) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 181 | attr_->symbols.push_back( |
| 182 | Attribute::Symbol{Reference(ResourceName({}, ResourceType::kId, name)), value}); |
| 183 | return *this; |
| 184 | } |
| 185 | |
| 186 | std::unique_ptr<Attribute> AttributeBuilder::Build() { |
| 187 | return std::move(attr_); |
| 188 | } |
| 189 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 190 | StyleBuilder& StyleBuilder::SetParent(StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 191 | style_->parent = Reference(ParseNameOrDie(str)); |
| 192 | return *this; |
| 193 | } |
| 194 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 195 | StyleBuilder& StyleBuilder::AddItem(StringPiece str, std::unique_ptr<Item> value) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 196 | style_->entries.push_back(Style::Entry{Reference(ParseNameOrDie(str)), std::move(value)}); |
| 197 | return *this; |
| 198 | } |
| 199 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 200 | StyleBuilder& StyleBuilder::AddItem(StringPiece str, const ResourceId& id, |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 201 | std::unique_ptr<Item> value) { |
| 202 | AddItem(str, std::move(value)); |
| 203 | style_->entries.back().key.id = id; |
| 204 | return *this; |
| 205 | } |
| 206 | |
| 207 | std::unique_ptr<Style> StyleBuilder::Build() { |
| 208 | return std::move(style_); |
| 209 | } |
| 210 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 211 | StyleableBuilder& StyleableBuilder::AddItem(StringPiece str, const std::optional<ResourceId>& id) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 212 | styleable_->entries.push_back(Reference(ParseNameOrDie(str))); |
| 213 | styleable_->entries.back().id = id; |
| 214 | return *this; |
| 215 | } |
| 216 | |
| 217 | std::unique_ptr<Styleable> StyleableBuilder::Build() { |
| 218 | return std::move(styleable_); |
| 219 | } |
| 220 | |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 221 | std::unique_ptr<xml::XmlResource> BuildXmlDom(StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 222 | std::string input = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; |
| 223 | input.append(str.data(), str.size()); |
| 224 | StringInputStream in(input); |
| 225 | StdErrDiagnostics diag; |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 226 | std::unique_ptr<xml::XmlResource> doc = xml::Inflate(&in, &diag, android::Source("test.xml")); |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 227 | CHECK(doc != nullptr && doc->root != nullptr) << "failed to parse inline XML string"; |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 228 | return doc; |
| 229 | } |
| 230 | |
| 231 | std::unique_ptr<xml::XmlResource> BuildXmlDomForPackageName(IAaptContext* context, |
Yurii Zubrytskyi | a577514 | 2022-11-02 17:49:49 -0700 | [diff] [blame] | 232 | StringPiece str) { |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 233 | std::unique_ptr<xml::XmlResource> doc = BuildXmlDom(str); |
| 234 | doc->file.name.package = context->GetCompilationPackage(); |
| 235 | return doc; |
| 236 | } |
| 237 | |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 238 | ArtifactBuilder& ArtifactBuilder::SetName(const std::string& name) { |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 239 | artifact_.name = name; |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 240 | return *this; |
| 241 | } |
| 242 | |
Shane Farmer | 78c43d7 | 2017-12-04 09:08:38 -0800 | [diff] [blame] | 243 | ArtifactBuilder& ArtifactBuilder::SetVersion(int version) { |
| 244 | artifact_.version = version; |
| 245 | return *this; |
| 246 | } |
| 247 | |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 248 | ArtifactBuilder& ArtifactBuilder::AddAbi(configuration::Abi abi) { |
| 249 | artifact_.abis.push_back(abi); |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 250 | return *this; |
| 251 | } |
| 252 | |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 253 | ArtifactBuilder& ArtifactBuilder::AddDensity(const ConfigDescription& density) { |
| 254 | artifact_.screen_densities.push_back(density); |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 255 | return *this; |
| 256 | } |
| 257 | |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 258 | ArtifactBuilder& ArtifactBuilder::AddLocale(const ConfigDescription& locale) { |
| 259 | artifact_.locales.push_back(locale); |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 260 | return *this; |
| 261 | } |
| 262 | |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 263 | ArtifactBuilder& ArtifactBuilder::SetAndroidSdk(int min_sdk) { |
| 264 | artifact_.android_sdk = {AndroidSdk::ForMinSdk(min_sdk)}; |
Shane Farmer | efe4539 | 2017-08-21 14:39:28 -0700 | [diff] [blame] | 265 | return *this; |
| 266 | } |
| 267 | |
Shane Farmer | cb6c3f9 | 2017-11-27 13:19:36 -0800 | [diff] [blame] | 268 | configuration::OutputArtifact ArtifactBuilder::Build() { |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 269 | return artifact_; |
| 270 | } |
| 271 | |
Shane Farmer | 78c43d7 | 2017-12-04 09:08:38 -0800 | [diff] [blame] | 272 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddAbiGroup( |
| 273 | const std::string& label, std::vector<configuration::Abi> abis) { |
| 274 | return AddGroup(label, &config_.abi_groups, std::move(abis)); |
| 275 | } |
| 276 | |
| 277 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddDensityGroup( |
| 278 | const std::string& label, std::vector<std::string> densities) { |
| 279 | std::vector<ConfigDescription> configs; |
| 280 | for (const auto& density : densities) { |
| 281 | configs.push_back(test::ParseConfigOrDie(density)); |
| 282 | } |
| 283 | return AddGroup(label, &config_.screen_density_groups, configs); |
| 284 | } |
| 285 | |
| 286 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddLocaleGroup( |
| 287 | const std::string& label, std::vector<std::string> locales) { |
| 288 | std::vector<ConfigDescription> configs; |
| 289 | for (const auto& locale : locales) { |
| 290 | configs.push_back(test::ParseConfigOrDie(locale)); |
| 291 | } |
| 292 | return AddGroup(label, &config_.locale_groups, configs); |
| 293 | } |
| 294 | |
| 295 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddDeviceFeatureGroup( |
| 296 | const std::string& label) { |
| 297 | return AddGroup(label, &config_.device_feature_groups); |
| 298 | } |
| 299 | |
| 300 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddGlTextureGroup( |
| 301 | const std::string& label) { |
| 302 | return AddGroup(label, &config_.gl_texture_groups); |
| 303 | } |
| 304 | |
| 305 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddAndroidSdk( |
| 306 | std::string label, int min_sdk) { |
| 307 | config_.android_sdks[label] = AndroidSdk::ForMinSdk(min_sdk); |
| 308 | return *this; |
| 309 | } |
| 310 | |
| 311 | PostProcessingConfigurationBuilder& PostProcessingConfigurationBuilder::AddArtifact( |
| 312 | configuration::ConfiguredArtifact artifact) { |
| 313 | config_.artifacts.push_back(std::move(artifact)); |
| 314 | return *this; |
| 315 | } |
| 316 | |
| 317 | configuration::PostProcessingConfiguration PostProcessingConfigurationBuilder::Build() { |
| 318 | return config_; |
| 319 | } |
| 320 | |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 321 | } // namespace test |
| 322 | } // namespace aapt |