Add RemoveOptionalPrebuiltPrefix() helper function
Test: m nothing
Bug: 171061220
Change-Id: Iaca95efcaf3f02e066751c6e988d609ac40e048a
diff --git a/android/prebuilt.go b/android/prebuilt.go
index bb98ed4..8114a65 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -17,6 +17,7 @@
import (
"fmt"
"reflect"
+ "strings"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -74,6 +75,12 @@
srcsPropertyName string
}
+// RemoveOptionalPrebuiltPrefix returns the result of removing the "prebuilt_" prefix from the
+// supplied name if it has one, or returns the name unmodified if it does not.
+func RemoveOptionalPrebuiltPrefix(name string) string {
+ return strings.TrimPrefix(name, "prebuilt_")
+}
+
func (p *Prebuilt) Name(name string) string {
return "prebuilt_" + name
}