Merge "Revert "Export static libraries.""
am: 22d7486605
Change-Id: I96bd769857841c1ed4d384cab27a52b7c1999731
This commit is contained in:
@@ -435,7 +435,6 @@ toolchain_library {
|
|||||||
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib/libwinpthread.a",
|
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib/libwinpthread.a",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
notice: "../../prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/licenses/mingw-w64-svn-r5861/mingw-w64-libraries/winpthreads/COPYING",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
|
@@ -275,10 +275,9 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
|
|||||||
if amod.commonProperties.Owner != nil {
|
if amod.commonProperties.Owner != nil {
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_OWNER :=", *amod.commonProperties.Owner)
|
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_OWNER :=", *amod.commonProperties.Owner)
|
||||||
}
|
}
|
||||||
}
|
if amod.commonProperties.Notice != nil {
|
||||||
|
fmt.Fprintln(&data.preamble, "LOCAL_NOTICE_FILE :=", "$(LOCAL_PATH)/"+*amod.commonProperties.Notice)
|
||||||
if amod.commonProperties.Notice != nil {
|
}
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_NOTICE_FILE :=", "$(LOCAL_PATH)/"+*amod.commonProperties.Notice)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if host {
|
if host {
|
||||||
|
@@ -238,9 +238,6 @@ func TestArchConfig(buildDir string, env map[string]string) Config {
|
|||||||
{BuildOs, Arch{ArchType: X86_64}},
|
{BuildOs, Arch{ArchType: X86_64}},
|
||||||
{BuildOs, Arch{ArchType: X86}},
|
{BuildOs, Arch{ArchType: X86}},
|
||||||
},
|
},
|
||||||
Windows: []Target{
|
|
||||||
{Windows, Arch{ArchType: X86}},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.BuildOsVariant = config.Targets[BuildOs][0].String()
|
config.BuildOsVariant = config.Targets[BuildOs][0].String()
|
||||||
|
@@ -70,12 +70,6 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
||||||
}
|
}
|
||||||
if len(c.Properties.AndroidMkStaticLibs) > 0 {
|
|
||||||
fmt.Fprintln(w, "LOCAL_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkStaticLibs, " "))
|
|
||||||
}
|
|
||||||
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
|
|
||||||
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||||
|
16
cc/cc.go
16
cc/cc.go
@@ -176,12 +176,10 @@ type BaseProperties struct {
|
|||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version *string
|
Sdk_version *string
|
||||||
|
|
||||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||||
AndroidMkStaticLibs []string `blueprint:"mutated"`
|
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
|
||||||
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
|
HideFromMake bool `blueprint:"mutated"`
|
||||||
AndroidMkWholeStaticLibs []string `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
HideFromMake bool `blueprint:"mutated"`
|
|
||||||
PreventInstall bool `blueprint:"mutated"`
|
|
||||||
|
|
||||||
UseVndk bool `blueprint:"mutated"`
|
UseVndk bool `blueprint:"mutated"`
|
||||||
|
|
||||||
@@ -1481,15 +1479,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
// they merely serve as Make dependencies and do not affect this lib itself.
|
// they merely serve as Make dependencies and do not affect this lib itself.
|
||||||
c.Properties.AndroidMkSharedLibs = append(
|
c.Properties.AndroidMkSharedLibs = append(
|
||||||
c.Properties.AndroidMkSharedLibs, makeLibName(depName))
|
c.Properties.AndroidMkSharedLibs, makeLibName(depName))
|
||||||
case staticDepTag, staticExportDepTag, lateStaticDepTag:
|
|
||||||
c.Properties.AndroidMkStaticLibs = append(
|
|
||||||
c.Properties.AndroidMkStaticLibs, makeLibName(depName))
|
|
||||||
case runtimeDepTag:
|
case runtimeDepTag:
|
||||||
c.Properties.AndroidMkRuntimeLibs = append(
|
c.Properties.AndroidMkRuntimeLibs = append(
|
||||||
c.Properties.AndroidMkRuntimeLibs, makeLibName(depName))
|
c.Properties.AndroidMkRuntimeLibs, makeLibName(depName))
|
||||||
case wholeStaticDepTag:
|
|
||||||
c.Properties.AndroidMkWholeStaticLibs = append(
|
|
||||||
c.Properties.AndroidMkWholeStaticLibs, makeLibName(depName))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -55,17 +55,13 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
ctx := android.NewTestArchContext()
|
ctx := android.NewTestArchContext()
|
||||||
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("cc_library_host_static", android.ModuleFactoryAdaptor(LibraryHostStaticFactory))
|
|
||||||
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))
|
||||||
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
|
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
|
||||||
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
|
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
|
||||||
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
|
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
|
||||||
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
||||||
ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(binaryFactory))
|
|
||||||
ctx.RegisterModuleType("cc_binary_host", android.ModuleFactoryAdaptor(binaryHostFactory))
|
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", imageMutator).Parallel()
|
ctx.BottomUp("image", imageMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
@@ -126,19 +122,6 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
src: "",
|
src: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
|
||||||
name: "libwinpthread",
|
|
||||||
vendor_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
host_supported: true,
|
|
||||||
src: "",
|
|
||||||
target: {
|
|
||||||
windows: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libc",
|
name: "libc",
|
||||||
no_libgcc: true,
|
no_libgcc: true,
|
||||||
@@ -172,20 +155,14 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
name: "libdl",
|
name: "libdl",
|
||||||
symbol_file: "",
|
symbol_file: "",
|
||||||
}
|
}
|
||||||
cc_library_static {
|
cc_library {
|
||||||
name: "libc++_static",
|
name: "libc++_static",
|
||||||
no_libgcc: true,
|
no_libgcc: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
host_supported: true,
|
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
target: {
|
|
||||||
windows: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libc++",
|
name: "libc++",
|
||||||
@@ -216,14 +193,6 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_object {
|
|
||||||
name: "crtbegin_dynamic",
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_object {
|
|
||||||
name: "crtend_android",
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
name: "crtend_so",
|
name: "crtend_so",
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
@@ -1580,65 +1549,6 @@ func TestRuntimeLibsNoVndk(t *testing.T) {
|
|||||||
checkRuntimeLibs(t, []string{"libvendor_available1", "libvendor1"}, module)
|
checkRuntimeLibs(t, []string{"libvendor_available1", "libvendor1"}, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkStaticLibs(t *testing.T, expected []string, module *Module) {
|
|
||||||
actual := module.Properties.AndroidMkStaticLibs
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
|
||||||
t.Errorf("incorrect static_libs"+
|
|
||||||
"\nactual: %v"+
|
|
||||||
"\nexpected: %v",
|
|
||||||
actual,
|
|
||||||
expected,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const staticLibAndroidBp = `
|
|
||||||
cc_library {
|
|
||||||
name: "lib1",
|
|
||||||
}
|
|
||||||
cc_binary {
|
|
||||||
name: "bin1",
|
|
||||||
static_libs: ["lib1"],
|
|
||||||
}
|
|
||||||
cc_library_host_static {
|
|
||||||
name: "lib2",
|
|
||||||
target: {
|
|
||||||
windows: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cc_binary_host {
|
|
||||||
name: "bin2",
|
|
||||||
static_libs: ["lib2"],
|
|
||||||
stl: "libc++_static",
|
|
||||||
target: {
|
|
||||||
windows: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
func TestStaticLibs(t *testing.T) {
|
|
||||||
ctx := testCc(t, staticLibAndroidBp)
|
|
||||||
|
|
||||||
// Check a device binary.
|
|
||||||
variant := "android_arm64_armv8-a_core"
|
|
||||||
module := ctx.ModuleForTests("bin1", variant).Module().(*Module)
|
|
||||||
checkStaticLibs(t, []string{"lib1", "libclang_rt.builtins-aarch64-android", "libatomic", "libgcc"}, module)
|
|
||||||
|
|
||||||
// Check a host binary.
|
|
||||||
variant = "linux_glibc_x86_64"
|
|
||||||
module = ctx.ModuleForTests("bin2", variant).Module().(*Module)
|
|
||||||
checkStaticLibs(t, []string{"lib2", "libc++_static"}, module)
|
|
||||||
|
|
||||||
// Check a host binary on Windows.
|
|
||||||
variant = "windows_x86"
|
|
||||||
module = ctx.ModuleForTests("bin2", variant).Module().(*Module)
|
|
||||||
checkStaticLibs(t, []string{"lib2", "libc++_static", "libwinpthread"}, module)
|
|
||||||
}
|
|
||||||
|
|
||||||
var compilerFlagsTestCases = []struct {
|
var compilerFlagsTestCases = []struct {
|
||||||
in string
|
in string
|
||||||
out bool
|
out bool
|
||||||
|
Reference in New Issue
Block a user