Lines Matching refs:mod
310 func simplifyKnownPropertiesDuplicatingEachOther(mod *parser.Module, buf []byte, patchList *parser.…
312 return removeMatchingModuleListProperties(mod, patchList,
318 mod, ok := def.(*parser.Module)
322 if mod.Type != "java_import" {
325 host, _ := getLiteralBoolPropertyValue(mod, "host")
327 mod.Type = "java_import_host"
328 removeProperty(mod, "host")
330 srcs, ok := getLiteralListProperty(mod, "srcs")
343 renameProperty(mod, "srcs", "jars")
346 renameProperty(mod, "srcs", "aars")
347 mod.Type = "android_library_import"
350 removeProperty(mod, "installable")
359 mod, ok := def.(*parser.Module)
364 if mod.Type != "cts_support_package" && mod.Type != "cts_package" &&
365 mod.Type != "cts_target_java_library" &&
366 mod.Type != "cts_host_java_library" {
372 switch mod.Type {
374 mod.Type = "android_test_helper_app"
377 mod.Type = "android_test"
380 mod.Type = "java_library"
383 mod.Type = "java_library_host"
397 mod.Properties = append(mod.Properties, defaults)
405 mod, ok := def.(*parser.Module)
410 if !strings.HasPrefix(mod.Type, "java_") && !strings.HasPrefix(mod.Type, "android_") {
414 hasAndroidLibraries := hasNonEmptyLiteralListProperty(mod, "android_libs")
415 hasStaticAndroidLibraries := hasNonEmptyLiteralListProperty(mod, "android_static_libs")
416 hasResourceDirs := hasNonEmptyLiteralListProperty(mod, "resource_dirs")
419 if mod.Type == "java_library_static" || mod.Type == "java_library" {
420 mod.Type = "android_library"
424 if mod.Type == "java_import" && !hasStaticAndroidLibraries {
425 removeProperty(mod, "android_static_libs")
430 renameProperty(mod, "shared_libs", "libs")
431 renameProperty(mod, "android_libs", "libs")
432 renameProperty(mod, "android_static_libs", "static_libs")
442 mod, ok := def.(*parser.Module)
447 …if !strings.HasPrefix(mod.Type, "java_") && !strings.HasPrefix(mod.Type, "android_") && mod.Type !…
451 hasInstrumentationFor := hasNonEmptyLiteralStringProperty(mod, "instrumentation_for")
452 hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites")
453 tags, _ := getLiteralListPropertyValue(mod, "tags")
465 switch mod.Type {
467 mod.Type = "android_test"
469 mod.Type = "android_test_import"
471 mod.Type = "java_test"
473 mod.Type = "java_test_host"
475 mod.Type = "cc_test"
486 mod, ok := def.(*parser.Module)
491 if mod.Type == "java_library_static" {
492 mod.Type = "java_library"
502 mod, ok := def.(*parser.Module)
507 if mod.Type != "java_library_installable" {
511 mod.Type = "java_library"
513 _, hasInstallable := mod.GetProperty("installable")
521 mod.Properties = append(mod.Properties, prop)
545 func indicateAttributeError(mod *parser.Module, attributeName string, format string, a ...interface…
547 mod.Properties = append(mod.Properties, &parser.Property{
560 func resolveLocalModule(mod *parser.Module, val parser.Expression) parser.Expression {
563 if v, ok := getLiteralStringProperty(mod, "name"); ok {
637 mod, ok := def.(*parser.Module)
642 if mod.Type != "prebuilt_etc" && mod.Type != "prebuilt_etc_host" {
647 convertToSingleSource(mod, "src")
649 renameProperty(mod, "sub_dir", "relative_install_path")
655 if prop_local_module_path, ok := mod.GetProperty(local_module_path); ok {
656 removeProperty(mod, local_module_path)
662 updated = moduleUpdates[i].update(mod, path)
672 return indicateAttributeError(mod, "filename",
676 …return indicateAttributeError(mod, "filename", "Cannot handle $(%s) for the prebuilt_etc", prefixV…
685 mod, ok := def.(*parser.Module)
690 if mod.Type != "android_test" && mod.Type != "android_test_helper_app" {
701 if prop_local_module_path, ok := mod.GetProperty(local_module_path); ok {
702 removeProperty(mod, local_module_path)
708 return indicateAttributeError(mod, "filename",
709 "Only LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) is allowed for the %s", mod.Type)
717 mod, ok := def.(*parser.Module)
718 if !(ok && mod.Type == "android_app_import") {
722 convertToSingleSource(mod, "apk")
724 if cert, ok := mod.GetProperty("certificate"); ok {
727 removeProperty(mod, "certificate")
734 mod.Properties = append(mod.Properties, prop)
744 mod, ok := def.(*parser.Module)
745 if !(ok && mod.Type == "runtime_resource_overlay") {
749 if _, ok := mod.GetProperty("product_specific"); !ok {
756 mod.Properties = append(mod.Properties, prop)
776 mod, ok := def.(*parser.Module)
781 listValue, ok := getLiteralListProperty(mod, field)
789 return fmt.Errorf("Expecting string for %s.%s fields", mod.Type, field)
797 removeProperty(mod, field)
809 mod, ok := def.(*parser.Module)
810 if !(ok && mod.Type == "hidl_interface") {
813 removeProperty(mod, "types")
822 if mod, ok := def.(*parser.Module); ok && mod.Type == "soong_config_bool_variable" {
823 if name, ok := getLiteralStringPropertyValue(mod, "name"); ok {
838 return runPatchListMod(func(mod *parser.Module, buf []byte, patchList *parser.PatchList) error {
839 if mod.Type != "soong_config_module_type" {
843 variables, ok := getLiteralListProperty(mod, "variables")
869 prop, _ := mod.GetProperty("variables")
876 boolVariables, ok := getLiteralListProperty(mod, "bool_variables")
892 mod, ok := def.(*parser.Module)
896 resourceDirList, resourceDirFound := getLiteralListPropertyValue(mod, "resource_dirs")
898 removeProperty(mod, "resource_dirs")
900 assetDirList, assetDirFound := getLiteralListPropertyValue(mod, "asset_dirs")
902 removeProperty(mod, "asset_dirs")
910 func convertToSingleSource(mod *parser.Module, srcPropertyName string) {
911 if srcs, ok := mod.GetProperty("srcs"); ok {
913 removeProperty(mod, "srcs")
915 mod.Properties = append(mod.Properties,
920 Value: resolveLocalModule(mod, srcList.Values[0])})
922 indicateAttributeError(mod, srcPropertyName, "LOCAL_SRC_FILES should contain at most one item")
925 removeProperty(mod, "srcs")
926 mod.Properties = append(mod.Properties,
930 Value: resolveLocalModule(mod, srcs.Value)})
932 renameProperty(mod, "srcs", "apk")
949 mod, ok := def.(*parser.Module)
954 err := modFunc(mod, buf, &patchlist)
988 func reorderCommonProperties(mod *parser.Module, buf []byte, patchlist *parser.PatchList) error {
989 if len(mod.Properties) == 0 {
993 pos := mod.LBracePos.Offset + 1
997 idx := propertyIndex(mod.Properties, name)
1008 pos = mod.Properties[0].End().Offset + 1
1009 mod.Properties = mod.Properties[1:]
1013 prop := mod.Properties[idx]
1014 mod.Properties = append(mod.Properties[:idx], mod.Properties[idx+1:]...)
1034 func removeTags(mod *parser.Module, buf []byte, patchlist *parser.PatchList) error {
1035 prop, ok := mod.GetProperty("tags")
1068 case strings.Contains(mod.Type, "cc_test"),
1069 strings.Contains(mod.Type, "cc_library_static"),
1070 strings.Contains(mod.Type, "java_test"),
1071 mod.Type == "android_test",
1072 mod.Type == "android_test_import":
1074 case strings.Contains(mod.Type, "cc_lib"):
1079 case strings.Contains(mod.Type, "cc_bin"):
1086 case strings.Contains(mod.Type, "java_lib"):
1091 case mod.Type == "android_app":
1114 func removeNestedProperty(mod *parser.Module, patchList *parser.PatchList, propName string) error {
1118 propProvider = mod
1163 return func(mod *parser.Module, buf []byte, patchList *parser.PatchList) error {
1164 return removeNestedProperty(mod, patchList, propName)
1168 func mergeMatchingModuleProperties(mod *parser.Module, buf []byte, patchlist *parser.PatchList) err…
1169 return mergeMatchingProperties(&mod.Properties, buf, patchlist)
1279 func removeMatchingModuleListProperties(mod *parser.Module, patchList *parser.PatchList, canonicalN…
1280 legacyProp, ok := mod.GetProperty(legacyName)
1288 canonicalList, ok := getLiteralListProperty(mod, canonicalName)
1307 func hasNonEmptyLiteralListProperty(mod *parser.Module, name string) bool {
1308 list, found := getLiteralListProperty(mod, name)
1312 func hasNonEmptyLiteralStringProperty(mod *parser.Module, name string) bool {
1313 s, found := getLiteralStringPropertyValue(mod, name)
1317 func getLiteralListProperty(mod *parser.Module, name string) (list *parser.List, found bool) {
1318 prop, ok := mod.GetProperty(name)
1326 func getLiteralListPropertyValue(mod *parser.Module, name string) (list []string, found bool) {
1327 listValue, ok := getLiteralListProperty(mod, name)
1342 func getLiteralStringProperty(mod *parser.Module, name string) (s *parser.String, found bool) {
1343 prop, ok := mod.GetProperty(name)
1351 func getLiteralStringPropertyValue(mod *parser.Module, name string) (s string, found bool) {
1352 stringValue, ok := getLiteralStringProperty(mod, name)
1360 func getLiteralBoolProperty(mod *parser.Module, name string) (b *parser.Bool, found bool) {
1361 prop, ok := mod.GetProperty(name)
1369 func getLiteralBoolPropertyValue(mod *parser.Module, name string) (s bool, found bool) {
1370 boolValue, ok := getLiteralBoolProperty(mod, name)
1387 func renameProperty(mod *parser.Module, from, to string) {
1388 for _, prop := range mod.Properties {
1395 func removeProperty(mod *parser.Module, propertyName string) {
1396 newList := make([]*parser.Property, 0, len(mod.Properties))
1397 for _, prop := range mod.Properties {
1402 mod.Properties = newList
1414 func formatFlagProperty(mod *parser.Module, field string, buf []byte, patchlist *parser.PatchList) …
1416 listValue, ok := getLiteralListProperty(mod, field)
1424 return fmt.Errorf("Expecting string for %s.%s fields", mod.Type, field)
1432 return fmt.Errorf("Expecting string for %s.%s fields", mod.Type, field)
1454 func formatFlagProperties(mod *parser.Module, buf []byte, patchlist *parser.PatchList) error {
1472 err := formatFlagProperty(mod, field, buf, patchlist)
1481 return func(mod *parser.Module, buf []byte, patchList *parser.PatchList) error {
1482 return rewriteLicenseProperties(mod, patchList, fs, relativePath)
1488 func rewriteLicenseProperties(mod *parser.Module, patchList *parser.PatchList, fs pathtools.FileSys…
1530 if hasNonEmptyLiteralListProperty(mod, licenseFilesPropertyName) {
1531 hasFileInParentDir = hasValueStartWithTwoDotsLiteralList(mod, licenseFilesPropertyName)
1535 bpPath, ok := getPathFromProperty(mod, licenseFilesPropertyName, fs, relativePath)
1537 bpDir, err := getDirFromProperty(mod, licenseFilesPropertyName, fs, relativePath)
1561 if hasNonEmptyLiteralListProperty(mod, licenseKindsPropertyName) {
1574 if hasNonEmptyLiteralListProperty(mod, licenseFilesPropertyName) && !hasFileInParentDir {
1575 licenseKinds, err := mergeLiteralListPropertyValue(mod, licenseKindsPropertyName)
1579 licenseFiles, err := mergeLiteralListPropertyValue(mod, licenseFilesPropertyName)
1597 pos := mod.Pos().Offset
1606 func mergeLiteralListPropertyValue(mod *parser.Module, property string) (s string, err error) {
1607 listValue, ok := getLiteralListPropertyValue(mod, property)
1610 return "", fmt.Errorf("Cannot retrieve the %s.%s field", mod.Type, property)
1619 func hasValueStartWithTwoDotsLiteralList(mod *parser.Module, property string) bool {
1620 listValue, ok := getLiteralListPropertyValue(mod, property)
1677 func getDirFromProperty(mod *parser.Module, property string, fs pathtools.FileSystem, relativePath …
1678 listValue, ok := getLiteralListPropertyValue(mod, property)
1681 return "", fmt.Errorf("Cannot retrieve the %s.%s property", mod.Type, property)
1685 return "", fmt.Errorf("Cannot find the value of the %s.%s property", mod.Type, property)
1710 func getPathFromProperty(mod *parser.Module, property string, fs pathtools.FileSystem, relativePath…
1711 dir, err := getDirFromProperty(mod, property, fs, relativePath)
1729 mod, ok := def.(*parser.Module)
1730 if !ok || mod.Type != moduleType {
1733 prop, ok := mod.GetProperty("name")
1735 return "", fmt.Errorf("Cannot get the %s."+"name property", mod.Type)
1782 mod, ok := def.(*parser.Module)
1787 curModuleName, ok := getLiteralStringPropertyValue(mod, "name")
1789 hasNameProperty := hasProperty(mod, "name")
1791 return fmt.Errorf("Cannot retrieve the name property of a module of %s type.", mod.Type)
1793 curVals, ok := getLiteralListPropertyValue(mod, property)
1795 hasLicenseProperty := hasProperty(mod, property)
1798 return fmt.Errorf("Cannot retrieve the %s.%s property", mod.Type, property)
1814 func hasProperty(mod *parser.Module, propName string) bool {
1815 _, ok := mod.GetProperty(propName)