From 67883b3ec640c6da8b22422ffbd2dc4f13ebf09e Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 3 Jan 2019 21:35:58 +0900 Subject: [PATCH] Fix: stubs lib is installed in APEX This CL fixes the problem that when a lib is defined with stubs, the stubs variantof the lib is installed to the APEX. This was happening because the non-stubs variant is the last variant of the 'version' variants and addFarVariationDependencies selects the first variant when the 'version' variant isn't specified. Fixing the problem by making the non-stubs variant (whose name is "") the first variant. Test: m (apex_test) Change-Id: I1505fd2f29a0d70c916bad51000aa06f2b80b137 --- apex/apex_test.go | 2 +- cc/library.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apex/apex_test.go b/apex/apex_test.go index dd5bf7082..63d2aabd1 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -664,5 +664,5 @@ func TestStaticLinking(t *testing.T) { ldFlags := ctx.ModuleForTests("not_in_apex", "android_arm64_armv8-a_core").Rule("ld").Args["libFlags"] // Ensure that not_in_apex is linking with the static variant of mylib - ensureContains(t, ldFlags, "mylib/android_arm64_armv8-a_core_static/mylib.a") + ensureContains(t, ldFlags, "mylib/android_arm64_armv8-a_core_static_platform/mylib.a") } diff --git a/cc/library.go b/cc/library.go index 40c1b4f41..da223dcca 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1059,7 +1059,7 @@ func VersionMutator(mctx android.BottomUpMutatorContext) { stubsVersionsFor(mctx.Config())[mctx.ModuleName()] = copiedVersions // "" is for the non-stubs variant - versions = append(versions, "") + versions = append([]string{""}, versions...) modules := mctx.CreateVariations(versions...) for i, m := range modules {