summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/androidmk.go6
-rw-r--r--android/testing.go4
-rw-r--r--sdk/testing.go10
3 files changed, 19 insertions, 1 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index a8153ccdc..b5f4b2bd5 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -29,7 +29,11 @@ import (
)
func init() {
- RegisterSingletonType("androidmk", AndroidMkSingleton)
+ RegisterAndroidMkBuildComponents(InitRegistrationContext)
+}
+
+func RegisterAndroidMkBuildComponents(ctx RegistrationContext) {
+ ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
}
// Deprecated: consider using AndroidMkEntriesProvider instead, especially if you're not going to
diff --git a/android/testing.go b/android/testing.go
index 9aff03940..90989ef53 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -410,6 +410,10 @@ func CheckErrorsAgainstExpectations(t *testing.T, errs []error, expectedErrorPat
}
+func SetInMakeForTests(config Config) {
+ config.inMake = true
+}
+
func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) []AndroidMkEntries {
var p AndroidMkEntriesProvider
var ok bool
diff --git a/sdk/testing.go b/sdk/testing.go
index 625b4608f..41333cdc8 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -69,6 +69,16 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
ctx := android.NewTestArchContext()
+ // Enable androidmk support.
+ // * Register the singleton
+ // * Configure that we are inside make
+ // * Add CommonOS to ensure that androidmk processing works.
+ android.RegisterAndroidMkBuildComponents(ctx)
+ android.SetInMakeForTests(config)
+ config.Targets[android.CommonOS] = []android.Target{
+ {android.CommonOS, android.Arch{ArchType: android.Common}, android.NativeBridgeDisabled, "", ""},
+ }
+
// from android package
android.RegisterPackageBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterVisibilityRuleChecker)