Loading androidmk/androidmk/android.go +28 −22 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ type variableAssignmentContext struct { append bool } var trueValue = &bpparser.Bool{ Value: true, } var rewriteProperties = map[string](func(variableAssignmentContext) error){ // custom functions "LOCAL_32_BIT_ONLY": local32BitOnly, Loading @@ -60,6 +64,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){ "LOCAL_UNINSTALLABLE_MODULE": invert("installable"), "LOCAL_PROGUARD_ENABLED": proguardEnabled, "LOCAL_MODULE_PATH": prebuiltModulePath, "LOCAL_REPLACE_PREBUILT_APK_INSTALLED": prebuiltPreprocessed, // composite functions "LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))), Loading Loading @@ -495,10 +500,6 @@ func hostOs(ctx variableAssignmentContext) error { Value: false, } trueValue := &bpparser.Bool{ Value: true, } if inList("windows") { err = setVariable(ctx.file, ctx.append, "target.windows", "enabled", trueValue, true) } Loading Loading @@ -704,6 +705,11 @@ func ldflags(ctx variableAssignmentContext) error { return nil } func prebuiltPreprocessed(ctx variableAssignmentContext) error { ctx.mkvalue = ctx.mkvalue.Clone() return setVariable(ctx.file, false, ctx.prefix, "preprocessed", trueValue, true) } func cflags(ctx variableAssignmentContext) error { // The Soong replacement for CFLAGS doesn't need the same extra escaped quotes that were present in Make ctx.mkvalue = ctx.mkvalue.Clone() Loading androidmk/androidmk/androidmk_test.go +25 −0 Original line number Diff line number Diff line Loading @@ -1339,6 +1339,31 @@ android_app_import { apk: "foo.apk", } `, }, { desc: "android_test_import prebuilt", in: ` include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_SRC_FILES := foo.apk LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_TAGS := tests LOCAL_MODULE_SUFFIX := .apk LOCAL_CERTIFICATE := PRESIGNED LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/foo.apk LOCAL_COMPATIBILITY_SUITE := cts include $(BUILD_PREBUILT) `, expected: ` android_test_import { name: "foo", srcs: ["foo.apk"], certificate: "PRESIGNED", preprocessed: true, test_suites: ["cts"], } `, }, { Loading bpfix/bpfix/bpfix.go +4 −1 Original line number Diff line number Diff line Loading @@ -408,6 +408,8 @@ func rewriteTestModuleTypes(f *Fixer) error { switch mod.Type { case "android_app": mod.Type = "android_test" case "android_app_import": mod.Type = "android_test_import" case "java_library", "java_library_installable": mod.Type = "java_test" case "java_library_host": Loading Loading @@ -951,7 +953,8 @@ func removeTags(mod *parser.Module, buf []byte, patchlist *parser.PatchList) err case strings.Contains(mod.Type, "cc_test"), strings.Contains(mod.Type, "cc_library_static"), strings.Contains(mod.Type, "java_test"), mod.Type == "android_test": mod.Type == "android_test", mod.Type == "android_test_import": continue case strings.Contains(mod.Type, "cc_lib"): replaceStr += `// WARNING: Module tags are not supported in Soong. Loading Loading
androidmk/androidmk/android.go +28 −22 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ type variableAssignmentContext struct { append bool } var trueValue = &bpparser.Bool{ Value: true, } var rewriteProperties = map[string](func(variableAssignmentContext) error){ // custom functions "LOCAL_32_BIT_ONLY": local32BitOnly, Loading @@ -60,6 +64,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){ "LOCAL_UNINSTALLABLE_MODULE": invert("installable"), "LOCAL_PROGUARD_ENABLED": proguardEnabled, "LOCAL_MODULE_PATH": prebuiltModulePath, "LOCAL_REPLACE_PREBUILT_APK_INSTALLED": prebuiltPreprocessed, // composite functions "LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))), Loading Loading @@ -495,10 +500,6 @@ func hostOs(ctx variableAssignmentContext) error { Value: false, } trueValue := &bpparser.Bool{ Value: true, } if inList("windows") { err = setVariable(ctx.file, ctx.append, "target.windows", "enabled", trueValue, true) } Loading Loading @@ -704,6 +705,11 @@ func ldflags(ctx variableAssignmentContext) error { return nil } func prebuiltPreprocessed(ctx variableAssignmentContext) error { ctx.mkvalue = ctx.mkvalue.Clone() return setVariable(ctx.file, false, ctx.prefix, "preprocessed", trueValue, true) } func cflags(ctx variableAssignmentContext) error { // The Soong replacement for CFLAGS doesn't need the same extra escaped quotes that were present in Make ctx.mkvalue = ctx.mkvalue.Clone() Loading
androidmk/androidmk/androidmk_test.go +25 −0 Original line number Diff line number Diff line Loading @@ -1339,6 +1339,31 @@ android_app_import { apk: "foo.apk", } `, }, { desc: "android_test_import prebuilt", in: ` include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_SRC_FILES := foo.apk LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_TAGS := tests LOCAL_MODULE_SUFFIX := .apk LOCAL_CERTIFICATE := PRESIGNED LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/foo.apk LOCAL_COMPATIBILITY_SUITE := cts include $(BUILD_PREBUILT) `, expected: ` android_test_import { name: "foo", srcs: ["foo.apk"], certificate: "PRESIGNED", preprocessed: true, test_suites: ["cts"], } `, }, { Loading
bpfix/bpfix/bpfix.go +4 −1 Original line number Diff line number Diff line Loading @@ -408,6 +408,8 @@ func rewriteTestModuleTypes(f *Fixer) error { switch mod.Type { case "android_app": mod.Type = "android_test" case "android_app_import": mod.Type = "android_test_import" case "java_library", "java_library_installable": mod.Type = "java_test" case "java_library_host": Loading Loading @@ -951,7 +953,8 @@ func removeTags(mod *parser.Module, buf []byte, patchlist *parser.PatchList) err case strings.Contains(mod.Type, "cc_test"), strings.Contains(mod.Type, "cc_library_static"), strings.Contains(mod.Type, "java_test"), mod.Type == "android_test": mod.Type == "android_test", mod.Type == "android_test_import": continue case strings.Contains(mod.Type, "cc_lib"): replaceStr += `// WARNING: Module tags are not supported in Soong. Loading