From 3fe7b7f66efb4de8fee61b19d53c91118dde2d33 Mon Sep 17 00:00:00 2001 From: Herbert Xue Date: Fri, 15 Mar 2024 16:03:22 +0800 Subject: [PATCH] Disable "__builtin_func" when converting mk to bp The "__builtin_func" doesn't work in soong. The converting tool androidmk should disable this feature. Bug: 329770862 Test: 1. cd build/soong/androidmk/androidmk 2. go test -run TestEndToEnd Change-Id: I1de04e4e1a34fb7335e0013f59b33f7f2673722a --- androidmk/androidmk/androidmk_test.go | 16 ++++++++++++++++ androidmk/parser/scope.go | 6 ++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go index 460f1ffac..1dd479ca5 100644 --- a/androidmk/androidmk/androidmk_test.go +++ b/androidmk/androidmk/androidmk_test.go @@ -510,6 +510,22 @@ endif # b==false // endif `, }, + { + // Unsupported function case because that doesn't work in bp + desc: "error for unsupported functions", + in: ` +include $(CLEAR_VARS) +LOCAL_SRC_FILES := $(filter-out filter-out-file.java ,$(call all-java-files-under, src)) +LOCAL_PACKAGE_NAME := foo +include $(BUILD_PACKAGE) +`, + expected: ` +android_app { + name: "foo", + srcs: ["UNSUPPORTED FUNCTION:filter-out filter-out-file.java src/**/*.java"], +} + `, + }, { desc: "ignore all-makefiles-under", in: ` diff --git a/androidmk/parser/scope.go b/androidmk/parser/scope.go index 8111c89e1..e1a523a6b 100644 --- a/androidmk/parser/scope.go +++ b/androidmk/parser/scope.go @@ -14,9 +14,7 @@ package parser -import ( - "strings" -) +import "strings" type Scope interface { Get(name string) string @@ -88,7 +86,7 @@ func (v Variable) EvalFunction(scope Scope) ([]string, bool) { if fname == "call" { return scope.Call(argVals[0], argVals[1:]), true } else { - return []string{"__builtin_func:" + fname + " " + strings.Join(argVals, " ")}, true + return []string{"UNSUPPORTED FUNCTION:" + fname + " " + strings.Join(argVals, " ")}, true } } }