From 4cba817e2403abd995a873f7b9efa8f74d3716d2 Mon Sep 17 00:00:00 2001 From: Yuntao Xu Date: Mon, 7 Feb 2022 11:35:00 -0800 Subject: [PATCH] mk2bp LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG Added the support to convert the Make boolean variable LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG as auto_gen_config and reverse its value in the androidmk tool. Bug: 216194235 Test: m androidmk Test: TreeHugger Change-Id: Ieb51d52df78b9f8d78b36e864fa1e3489faa8c45 --- androidmk/androidmk/android.go | 2 ++ androidmk/androidmk/androidmk_test.go | 30 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go index 6fac79d89..295b0e50e 100644 --- a/androidmk/androidmk/android.go +++ b/androidmk/androidmk/android.go @@ -68,6 +68,8 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){ "LOCAL_MODULE_PATH": prebuiltModulePath, "LOCAL_REPLACE_PREBUILT_APK_INSTALLED": prebuiltPreprocessed, + "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG": invert("auto_gen_config"), + // composite functions "LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))), diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go index 81b5c3030..e8b6f78cf 100644 --- a/androidmk/androidmk/androidmk_test.go +++ b/androidmk/androidmk/androidmk_test.go @@ -1643,6 +1643,36 @@ android_app { "gen_src3", ], } +`, + }, + { + desc: "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG is true", + in: ` +include $(CLEAR_VARS) +LOCAL_MODULE := foo +LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true +include $(BUILD_PACKAGE) + `, + expected: ` +android_app { + name: "foo", + auto_gen_config: false, +} +`, + }, + { + desc: "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG is false", + in: ` +include $(CLEAR_VARS) +LOCAL_MODULE := foo +LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := false +include $(BUILD_PACKAGE) + `, + expected: ` +android_app { + name: "foo", + auto_gen_config: true, +} `, }, }