Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c860d02a authored by Liz Kammer's avatar Liz Kammer Committed by Automerger Merge Worker
Browse files

Merge "Support preprocessed prebuilt tests in androidmk" am: fd0d56af am: 21a4ee6b

Change-Id: I7eea428e53c1acca9f8568dc6eb076266af925f5
parents 258b6cc9 21a4ee6b
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -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,
@@ -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"))),
@@ -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)
	}
@@ -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()
+25 −0
Original line number Diff line number Diff line
@@ -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"],
}
`,
	},
	{
+4 −1
Original line number Diff line number Diff line
@@ -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":
@@ -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.