Merge "Static variant of a stubs lib is correctly tracked" am: eebdf43337
am: d563bc7b92
am: 5c16c31be5
Change-Id: I4ce6595041cf9f57ae01235b51b90f018010977d
This commit is contained in:
commit
004e8d00fe
8
cc/cc.go
8
cc/cc.go
|
@ -348,6 +348,7 @@ var (
|
||||||
linkerFlagsDepTag = dependencyTag{name: "linker flags file"}
|
linkerFlagsDepTag = dependencyTag{name: "linker flags file"}
|
||||||
dynamicLinkerDepTag = dependencyTag{name: "dynamic linker"}
|
dynamicLinkerDepTag = dependencyTag{name: "dynamic linker"}
|
||||||
reuseObjTag = dependencyTag{name: "reuse objects"}
|
reuseObjTag = dependencyTag{name: "reuse objects"}
|
||||||
|
staticVariantTag = dependencyTag{name: "static variant"}
|
||||||
ndkStubDepTag = dependencyTag{name: "ndk stub", library: true}
|
ndkStubDepTag = dependencyTag{name: "ndk stub", library: true}
|
||||||
ndkLateStubDepTag = dependencyTag{name: "ndk late stub", library: true}
|
ndkLateStubDepTag = dependencyTag{name: "ndk late stub", library: true}
|
||||||
vndkExtDepTag = dependencyTag{name: "vndk extends", library: true}
|
vndkExtDepTag = dependencyTag{name: "vndk extends", library: true}
|
||||||
|
@ -1536,6 +1537,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if depTag == staticVariantTag {
|
||||||
|
if _, ok := ccDep.compiler.(libraryInterface); ok {
|
||||||
|
c.staticVariant = ccDep
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Extract explicitlyVersioned field from the depTag and reset it inside the struct.
|
// Extract explicitlyVersioned field from the depTag and reset it inside the struct.
|
||||||
// Otherwise, sharedDepTag and lateSharedDepTag with explicitlyVersioned set to true
|
// Otherwise, sharedDepTag and lateSharedDepTag with explicitlyVersioned set to true
|
||||||
// won't be matched to sharedDepTag and lateSharedDepTag.
|
// won't be matched to sharedDepTag and lateSharedDepTag.
|
||||||
|
|
|
@ -215,6 +215,7 @@ func createTestContext(t *testing.T, config android.Config, bp string, os androi
|
||||||
ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(BinaryFactory))
|
ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(BinaryFactory))
|
||||||
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
||||||
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
|
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
|
||||||
|
ctx.RegisterModuleType("cc_library_static", android.ModuleFactoryAdaptor(LibraryStaticFactory))
|
||||||
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory))
|
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory))
|
||||||
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(ToolchainLibraryFactory))
|
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(ToolchainLibraryFactory))
|
||||||
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(LlndkLibraryFactory))
|
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(LlndkLibraryFactory))
|
||||||
|
@ -1966,3 +1967,43 @@ func TestStaticExecutable(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStaticDepsOrderWithStubs(t *testing.T) {
|
||||||
|
ctx := testCc(t, `
|
||||||
|
cc_binary {
|
||||||
|
name: "mybin",
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
static_libs: ["libB"],
|
||||||
|
static_executable: true,
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libB",
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
shared_libs: ["libC"],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libC",
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
stl: "none",
|
||||||
|
stubs: {
|
||||||
|
versions: ["1"],
|
||||||
|
},
|
||||||
|
}`)
|
||||||
|
|
||||||
|
mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a_core").Module().(*Module)
|
||||||
|
actual := mybin.depsInLinkOrder
|
||||||
|
expected := getOutputPaths(ctx, "android_arm64_armv8-a_core_static", []string{"libB", "libC"})
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("staticDeps orderings were not propagated correctly"+
|
||||||
|
"\nactual: %v"+
|
||||||
|
"\nexpected: %v",
|
||||||
|
actual,
|
||||||
|
expected,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1032,6 +1032,9 @@ func reuseStaticLibrary(mctx android.BottomUpMutatorContext, static, shared *Mod
|
||||||
sharedCompiler.baseCompiler.Properties.Srcs
|
sharedCompiler.baseCompiler.Properties.Srcs
|
||||||
sharedCompiler.baseCompiler.Properties.Srcs = nil
|
sharedCompiler.baseCompiler.Properties.Srcs = nil
|
||||||
sharedCompiler.baseCompiler.Properties.Generated_sources = nil
|
sharedCompiler.baseCompiler.Properties.Generated_sources = nil
|
||||||
|
} else {
|
||||||
|
// This dep is just to reference static variant from shared variant
|
||||||
|
mctx.AddInterVariantDependency(staticVariantTag, shared, static)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue