Lines Matching refs:xml
33 static bool RequiredNameIsNotEmpty(xml::Element* el, SourcePathDiagnostics* diag) { in RequiredNameIsNotEmpty()
34 xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name"); in RequiredNameIsNotEmpty()
50 static bool NameIsJavaClassName(xml::Element* el, xml::Attribute* attr, in NameIsJavaClassName()
71 static bool OptionalNameIsJavaClassName(xml::Element* el, SourcePathDiagnostics* diag) { in OptionalNameIsJavaClassName()
72 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name")) { in OptionalNameIsJavaClassName()
78 static bool RequiredNameIsJavaClassName(xml::Element* el, SourcePathDiagnostics* diag) { in RequiredNameIsJavaClassName()
79 xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name"); in RequiredNameIsJavaClassName()
88 static bool RequiredNameIsJavaPackage(xml::Element* el, SourcePathDiagnostics* diag) { in RequiredNameIsJavaPackage()
89 xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name"); in RequiredNameIsJavaPackage()
104 static xml::XmlNodeAction::ActionFuncWithDiag RequiredAndroidAttribute(const std::string& attr) { in RequiredAndroidAttribute()
105 return [=](xml::Element* el, SourcePathDiagnostics* diag) -> bool { in RequiredAndroidAttribute()
106 if (el->FindAttribute(xml::kSchemaAndroid, attr) == nullptr) { in RequiredAndroidAttribute()
115 static bool AutoGenerateIsFeatureSplit(xml::Element* el, SourcePathDiagnostics* diag) { in AutoGenerateIsFeatureSplit()
119 xml::Attribute* attr = el->FindAttribute({}, kFeatureSplit); in AutoGenerateIsFeatureSplit()
126 xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, kIsFeatureSplit); in AutoGenerateIsFeatureSplit()
139 el->attributes.push_back(xml::Attribute{xml::kSchemaAndroid, kIsFeatureSplit, "true"}); in AutoGenerateIsFeatureSplit()
145 static bool VerifyManifest(xml::Element* el, SourcePathDiagnostics* diag) { in VerifyManifest()
146 xml::Attribute* attr = el->FindAttribute({}, "package"); in VerifyManifest()
175 static bool FixCoreAppAttribute(xml::Element* el, SourcePathDiagnostics* diag) { in FixCoreAppAttribute()
176 if (xml::Attribute* attr = el->FindAttribute("", "coreApp")) { in FixCoreAppAttribute()
188 static bool VerifyUsesFeature(xml::Element* el, SourcePathDiagnostics* diag) { in VerifyUsesFeature()
190 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name")) { in VerifyUsesFeature()
200 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "glEsVersion")) { in VerifyUsesFeature()
217 bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor, in BuildRules()
250 xml::XmlNodeAction intent_filter_action; in BuildRules()
256 xml::XmlNodeAction meta_data_action; in BuildRules()
259 xml::XmlNodeAction uses_feature_action; in BuildRules()
263 xml::XmlNodeAction component_action; in BuildRules()
270 xml::XmlNodeAction& manifest_action = (*executor)["manifest"]; in BuildRules()
274 manifest_action.Action([&](xml::Element* el) -> bool { in BuildRules()
277 el->RemoveAttribute(xml::kSchemaAndroid, "versionName"); in BuildRules()
279 if (el->FindAttribute(xml::kSchemaAndroid, "versionName") == nullptr) { in BuildRules()
281 xml::Attribute{xml::kSchemaAndroid, "versionName", in BuildRules()
288 el->RemoveAttribute(xml::kSchemaAndroid, "versionCode"); in BuildRules()
290 if (el->FindAttribute(xml::kSchemaAndroid, "versionCode") == nullptr) { in BuildRules()
292 xml::Attribute{xml::kSchemaAndroid, "versionCode", in BuildRules()
299 el->RemoveAttribute(xml::kSchemaAndroid, "versionCodeMajor"); in BuildRules()
301 if (el->FindAttribute(xml::kSchemaAndroid, "versionCodeMajor") == nullptr) { in BuildRules()
303 xml::Attribute{xml::kSchemaAndroid, "versionCodeMajor", in BuildRules()
315 manifest_action["uses-sdk"].Action([&](xml::Element* el) -> bool { in BuildRules()
317 el->FindAttribute(xml::kSchemaAndroid, "minSdkVersion") == nullptr) { in BuildRules()
320 xml::Attribute{xml::kSchemaAndroid, "minSdkVersion", in BuildRules()
325 el->FindAttribute(xml::kSchemaAndroid, "targetSdkVersion") == nullptr) { in BuildRules()
328 xml::Attribute{xml::kSchemaAndroid, "targetSdkVersion", in BuildRules()
336 manifest_action["instrumentation"].Action([&](xml::Element* el) -> bool { in BuildRules()
341 if (xml::Attribute* attr = in BuildRules()
342 el->FindAttribute(xml::kSchemaAndroid, "targetPackage")) { in BuildRules()
350 manifest_action["overlay"].Action([&](xml::Element* el) -> bool { in BuildRules()
355 if (xml::Attribute* attr = in BuildRules()
356 el->FindAttribute(xml::kSchemaAndroid, "targetPackage")) { in BuildRules()
385 xml::XmlNodeAction& application_action = manifest_action["application"]; in BuildRules()
392 xml::XmlNodeAction& static_library_action = application_action["static-library"]; in BuildRules()
396 xml::XmlNodeAction& uses_static_library_action = application_action["uses-static-library"]; in BuildRules()
402 xml::XmlNodeAction& uses_package_action = application_action["uses-package"]; in BuildRules()
407 application_action.Action([&](xml::Element* el) -> bool { in BuildRules()
408 xml::Attribute *attr = el->FindOrCreateAttribute(xml::kSchemaAndroid, "debuggable"); in BuildRules()
434 const StringPiece& attr_name, xml::Element* el) { in FullyQualifyClassName()
435 xml::Attribute* attr = el->FindAttribute(attr_ns, attr_name); in FullyQualifyClassName()
443 static bool RenameManifestPackage(const StringPiece& package_override, xml::Element* manifest_el) { in RenameManifestPackage()
444 xml::Attribute* attr = manifest_el->FindAttribute({}, "package"); in RenameManifestPackage()
453 xml::Element* application_el = manifest_el->FindChild({}, "application"); in RenameManifestPackage()
455 FullyQualifyClassName(original_package, xml::kSchemaAndroid, "name", application_el); in RenameManifestPackage()
456 FullyQualifyClassName(original_package, xml::kSchemaAndroid, "backupAgent", application_el); in RenameManifestPackage()
458 for (xml::Element* child_el : application_el->GetChildElements()) { in RenameManifestPackage()
463 FullyQualifyClassName(original_package, xml::kSchemaAndroid, "name", child_el); in RenameManifestPackage()
467 FullyQualifyClassName(original_package, xml::kSchemaAndroid, "targetActivity", child_el); in RenameManifestPackage()
475 bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) { in Consume()
477 xml::Element* root = xml::FindRootElement(doc->root.get()); in Consume()
489 std::unique_ptr<xml::Element> uses_sdk = util::make_unique<xml::Element>(); in Consume()
495 xml::Attribute* attr = root->FindOrCreateAttribute(xml::kSchemaAndroid, "compileSdkVersion"); in Consume()
510 xml::Attribute* attr = in Consume()
511 root->FindOrCreateAttribute(xml::kSchemaAndroid, "compileSdkVersionCodename"); in Consume()
524 xml::XmlActionExecutor executor; in Consume()
529 xml::XmlActionExecutorPolicy policy = options_.warn_validation in Consume()
530 ? xml::XmlActionExecutorPolicy::kWhitelistWarning in Consume()
531 : xml::XmlActionExecutorPolicy::kWhitelist; in Consume()