2017-11-17 19:55:38 +01:00
|
|
|
// Copyright 2017 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2015-04-28 22:30:13 +02:00
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
2017-05-09 22:34:34 +02:00
|
|
|
"android/soong/android"
|
2017-11-16 23:33:08 +01:00
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
"fmt"
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
2015-04-28 22:30:13 +02:00
|
|
|
"reflect"
|
2017-09-28 02:05:30 +02:00
|
|
|
"sort"
|
|
|
|
"strings"
|
2015-04-28 22:30:13 +02:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
var buildDir string
|
|
|
|
|
|
|
|
func setUp() {
|
|
|
|
var err error
|
|
|
|
buildDir, err = ioutil.TempDir("", "soong_cc_test")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func tearDown() {
|
|
|
|
os.RemoveAll(buildDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
run := func() int {
|
|
|
|
setUp()
|
|
|
|
defer tearDown()
|
|
|
|
|
|
|
|
return m.Run()
|
|
|
|
}
|
|
|
|
|
|
|
|
os.Exit(run())
|
|
|
|
}
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
func createTestContext(t *testing.T, config android.Config, bp string) *android.TestContext {
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
ctx := android.NewTestArchContext()
|
2017-11-03 01:00:50 +01:00
|
|
|
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
2017-11-16 23:33:08 +01:00
|
|
|
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory))
|
2018-10-03 07:25:58 +02:00
|
|
|
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(ToolchainLibraryFactory))
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(llndkLibraryFactory))
|
2017-12-14 11:54:34 +01:00
|
|
|
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
|
2018-10-03 07:25:58 +02:00
|
|
|
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
|
2018-04-17 23:58:42 +02:00
|
|
|
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
2018-01-31 16:54:12 +01:00
|
|
|
ctx.BottomUp("image", imageMutator).Parallel()
|
2018-10-03 07:25:58 +02:00
|
|
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
ctx.BottomUp("vndk", vndkMutator).Parallel()
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
ctx.BottomUp("version", versionMutator).Parallel()
|
2018-10-03 07:25:58 +02:00
|
|
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
})
|
|
|
|
ctx.Register()
|
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
// add some modules that are required by the compiler and/or linker
|
|
|
|
bp = bp + `
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
toolchain_library {
|
|
|
|
name: "libatomic",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
2018-10-08 03:16:48 +02:00
|
|
|
src: "",
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
toolchain_library {
|
|
|
|
name: "libcompiler_rt-extras",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
2018-10-08 03:16:48 +02:00
|
|
|
src: "",
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
|
2018-10-09 00:10:12 +02:00
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-arm-android",
|
|
|
|
vendor_available: true,
|
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-aarch64-android",
|
|
|
|
vendor_available: true,
|
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-i686-android",
|
|
|
|
vendor_available: true,
|
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-x86_64-android",
|
|
|
|
vendor_available: true,
|
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
toolchain_library {
|
|
|
|
name: "libgcc",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
2018-10-08 03:16:48 +02:00
|
|
|
src: "",
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
cc_library {
|
|
|
|
name: "libc",
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
system_shared_libs: [],
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
}
|
|
|
|
llndk_library {
|
|
|
|
name: "libc",
|
|
|
|
symbol_file: "",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libm",
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
system_shared_libs: [],
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
}
|
|
|
|
llndk_library {
|
|
|
|
name: "libm",
|
|
|
|
symbol_file: "",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libdl",
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
system_shared_libs: [],
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
}
|
|
|
|
llndk_library {
|
|
|
|
name: "libdl",
|
|
|
|
symbol_file: "",
|
|
|
|
}
|
2018-11-02 23:56:30 +01:00
|
|
|
cc_library {
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
name: "libc++_static",
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libc++",
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libunwind_llvm",
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "crtbegin_so",
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
2018-08-28 02:55:37 +02:00
|
|
|
vendor_available: true,
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "crtend_so",
|
2018-07-11 03:49:27 +02:00
|
|
|
recovery_available: true,
|
2018-08-28 02:55:37 +02:00
|
|
|
vendor_available: true,
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
|
2017-11-16 23:29:11 +01:00
|
|
|
cc_library {
|
|
|
|
name: "libprotobuf-cpp-lite",
|
|
|
|
}
|
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
`
|
|
|
|
|
|
|
|
ctx.MockFileSystem(map[string][]byte{
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
"Android.bp": []byte(bp),
|
|
|
|
"foo.c": nil,
|
|
|
|
"bar.c": nil,
|
|
|
|
"a.proto": nil,
|
|
|
|
"b.aidl": nil,
|
|
|
|
"my_include": nil,
|
|
|
|
"foo.map.txt": nil,
|
2017-09-28 02:05:30 +02:00
|
|
|
})
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
return ctx
|
|
|
|
}
|
|
|
|
|
|
|
|
func testCcWithConfig(t *testing.T, bp string, config android.Config) *android.TestContext {
|
2018-03-29 08:08:15 +02:00
|
|
|
t.Helper()
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
ctx := createTestContext(t, config, bp)
|
|
|
|
|
2017-08-09 02:46:01 +02:00
|
|
|
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
2018-03-12 09:29:17 +01:00
|
|
|
android.FailIfErrored(t, errs)
|
2017-09-28 02:05:30 +02:00
|
|
|
_, errs = ctx.PrepareBuildActions(config)
|
2018-03-12 09:29:17 +01:00
|
|
|
android.FailIfErrored(t, errs)
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
return ctx
|
|
|
|
}
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
func testCc(t *testing.T, bp string) *android.TestContext {
|
2018-03-29 08:08:15 +02:00
|
|
|
t.Helper()
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
config := android.TestArchConfig(buildDir, nil)
|
2018-03-13 02:06:05 +01:00
|
|
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
|
|
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
|
|
|
|
return testCcWithConfig(t, bp, config)
|
|
|
|
}
|
|
|
|
|
|
|
|
func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
|
2018-03-29 08:08:15 +02:00
|
|
|
t.Helper()
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
config := android.TestArchConfig(buildDir, nil)
|
2018-03-13 02:06:05 +01:00
|
|
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
|
|
|
|
return testCcWithConfig(t, bp, config)
|
|
|
|
}
|
|
|
|
|
|
|
|
func testCcError(t *testing.T, pattern string, bp string) {
|
2018-03-29 08:08:15 +02:00
|
|
|
t.Helper()
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
config := android.TestArchConfig(buildDir, nil)
|
2018-03-13 02:06:05 +01:00
|
|
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
|
|
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
|
|
|
|
ctx := createTestContext(t, config, bp)
|
|
|
|
|
|
|
|
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
|
|
|
if len(errs) > 0 {
|
2018-03-12 09:34:26 +01:00
|
|
|
android.FailIfNoMatchingErrors(t, pattern, errs)
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
_, errs = ctx.PrepareBuildActions(config)
|
|
|
|
if len(errs) > 0 {
|
2018-03-12 09:34:26 +01:00
|
|
|
android.FailIfNoMatchingErrors(t, pattern, errs)
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2018-08-28 02:55:37 +02:00
|
|
|
coreVariant = "android_arm64_armv8-a_core_shared"
|
|
|
|
vendorVariant = "android_arm64_armv8-a_vendor_shared"
|
|
|
|
recoveryVariant = "android_arm64_armv8-a_recovery_shared"
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
)
|
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
func TestVendorSrc(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libTest",
|
|
|
|
srcs: ["foo.c"],
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
2017-09-28 02:05:30 +02:00
|
|
|
vendor_available: true,
|
|
|
|
target: {
|
|
|
|
vendor: {
|
|
|
|
srcs: ["bar.c"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
`)
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
ld := ctx.ModuleForTests("libTest", vendorVariant).Rule("ld")
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
var objs []string
|
|
|
|
for _, o := range ld.Inputs {
|
|
|
|
objs = append(objs, o.Base())
|
|
|
|
}
|
2018-01-03 22:40:46 +01:00
|
|
|
if len(objs) != 2 || objs[0] != "foo.o" || objs[1] != "bar.o" {
|
Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.
However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume
cc_library {
name: "libfoo",
srcs: ["foo.c"],
target: {
vendor: {
srcs: ["bar.c"],
},
},
}
Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o
So, bar.o is included twice and this causes multiple symbol definition
error.
In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.
Bug: 67731122
Test: build
Test: cc_test.go
Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-12 16:05:00 +02:00
|
|
|
t.Errorf("inputs of libTest must be []string{\"foo.o\", \"bar.o\"}, but was %#v.", objs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string,
|
|
|
|
isVndkSp bool, extends string) {
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
t.Helper()
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
mod := ctx.ModuleForTests(name, vendorVariant).Module().(*Module)
|
|
|
|
if !mod.hasVendorVariant() {
|
2018-03-22 00:25:58 +01:00
|
|
|
t.Errorf("%q must have vendor variant", name)
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check library properties.
|
|
|
|
lib, ok := mod.compiler.(*libraryDecorator)
|
|
|
|
if !ok {
|
|
|
|
t.Errorf("%q must have libraryDecorator", name)
|
|
|
|
} else if lib.baseInstaller.subDir != subDir {
|
|
|
|
t.Errorf("%q must use %q as subdir but it is using %q", name, subDir,
|
|
|
|
lib.baseInstaller.subDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check VNDK properties.
|
|
|
|
if mod.vndkdep == nil {
|
|
|
|
t.Fatalf("%q must have `vndkdep`", name)
|
|
|
|
}
|
|
|
|
if !mod.isVndk() {
|
|
|
|
t.Errorf("%q isVndk() must equal to true", name)
|
|
|
|
}
|
|
|
|
if mod.isVndkSp() != isVndkSp {
|
|
|
|
t.Errorf("%q isVndkSp() must equal to %t", name, isVndkSp)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check VNDK extension properties.
|
|
|
|
isVndkExt := extends != ""
|
|
|
|
if mod.isVndkExt() != isVndkExt {
|
|
|
|
t.Errorf("%q isVndkExt() must equal to %t", name, isVndkExt)
|
|
|
|
}
|
|
|
|
|
|
|
|
if actualExtends := mod.getVndkExtendsModuleName(); actualExtends != extends {
|
|
|
|
t.Errorf("%q must extend from %q but get %q", name, extends, actualExtends)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestVndk(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_private",
|
|
|
|
vendor_available: false,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_private",
|
|
|
|
vendor_available: false,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "")
|
|
|
|
checkVndkModule(t, ctx, "libvndk_private", "vndk-VER", false, "")
|
|
|
|
checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "")
|
|
|
|
checkVndkModule(t, ctx, "libvndk_sp_private", "vndk-sp-VER", true, "")
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVndkDepError(t *testing.T) {
|
|
|
|
// Check whether an error is emitted when a VNDK lib depends on a system lib.
|
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libfwk"], // Cause error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libfwk",
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// Check whether an error is emitted when a VNDK lib depends on a vendor lib.
|
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvendor"], // Cause error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
vendor: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// Check whether an error is emitted when a VNDK-SP lib depends on a system lib.
|
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libfwk"], // Cause error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libfwk",
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// Check whether an error is emitted when a VNDK-SP lib depends on a vendor lib.
|
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvendor"], // Cause error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
vendor: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// Check whether an error is emitted when a VNDK-SP lib depends on a VNDK lib.
|
|
|
|
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvndk"], // Cause error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
2018-11-28 07:14:47 +01:00
|
|
|
func TestVndkMustNotBeProductSpecific(t *testing.T) {
|
|
|
|
// Check whether an error is emitted when a vndk lib has 'product_specific: true'.
|
|
|
|
testCcError(t, "product_specific must not be true when `vndk: {enabled: true}`", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
product_specific: true, // Cause error
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
func TestVndkExt(t *testing.T) {
|
|
|
|
// This test checks the VNDK-Ext properties.
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
checkVndkModule(t, ctx, "libvndk_ext", "vndk", false, "libvndk")
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
// This test checks the VNDK-Ext properties when BOARD_VNDK_VERSION is not set.
|
|
|
|
ctx := testCcNoVndk(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// Ensures that the core variant of "libvndk_ext" can be found.
|
|
|
|
mod := ctx.ModuleForTests("libvndk_ext", coreVariant).Module().(*Module)
|
|
|
|
if extends := mod.getVndkExtendsModuleName(); extends != "libvndk" {
|
|
|
|
t.Errorf("\"libvndk_ext\" must extend from \"libvndk\" but get %q", extends)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestVndkExtError(t *testing.T) {
|
|
|
|
// This test ensures an error is emitted in ill-formed vndk-ext definition.
|
|
|
|
testCcError(t, "must set `vendor: true` to set `extends: \".*\"`", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
testCcError(t, "must set `extends: \"\\.\\.\\.\"` to vndk extension", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
|
|
|
|
// This test ensures an error is emitted for inconsistent support_system_process.
|
|
|
|
testCcError(t, "module \".*\" with mismatched support_system_process", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
testCcError(t, "module \".*\" with mismatched support_system_process", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestVndkExtVendorAvailableFalseError(t *testing.T) {
|
2018-03-29 08:08:15 +02:00
|
|
|
// This test ensures an error is emitted when a VNDK-Ext library extends a VNDK library
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
// with `vendor_available: false`.
|
|
|
|
testCcError(t, "`extends` refers module \".*\" which does not have `vendor_available: true`", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: false,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVendorModuleUseVndkExt(t *testing.T) {
|
|
|
|
// This test ensures a vendor module can depend on a VNDK-Ext library.
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
vendor: true,
|
|
|
|
shared_libs: ["libvndk_ext", "libvndk_sp_ext"],
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVndkExtUseVendorLib(t *testing.T) {
|
|
|
|
// This test ensures a VNDK-Ext library can depend on a vendor library.
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
shared_libs: ["libvendor"],
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
vendor: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
2018-03-29 08:08:15 +02:00
|
|
|
|
|
|
|
// This test ensures a VNDK-SP-Ext library can depend on a vendor library.
|
|
|
|
testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvendor"], // Cause an error
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
vendor: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVndkSpExtUseVndkError(t *testing.T) {
|
|
|
|
// This test ensures an error is emitted if a VNDK-SP-Ext library depends on a VNDK
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
// library.
|
|
|
|
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
|
2018-03-29 08:08:15 +02:00
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
2018-03-29 08:08:15 +02:00
|
|
|
shared_libs: ["libvndk"], // Cause an error
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
nocrt: true,
|
|
|
|
}
|
2018-03-29 08:08:15 +02:00
|
|
|
`)
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
// This test ensures an error is emitted if a VNDK-SP-Ext library depends on a VNDK-Ext
|
|
|
|
// library.
|
|
|
|
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
cc_library {
|
2018-03-29 08:08:15 +02:00
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
vendor: true,
|
2018-03-29 08:08:15 +02:00
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvndk_ext"], // Cause an error
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:08:15 +02:00
|
|
|
func TestVndkUseVndkExtError(t *testing.T) {
|
|
|
|
// This test ensures an error is emitted if a VNDK/VNDK-SP library depends on a
|
|
|
|
// VNDK-Ext/VNDK-SP-Ext library.
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk2",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvndk_ext"],
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2018-11-06 17:12:13 +01:00
|
|
|
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
cc_library {
|
|
|
|
name: "libvndk",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk2",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
target: {
|
|
|
|
vendor: {
|
|
|
|
shared_libs: ["libvndk_ext"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_2",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
|
|
|
shared_libs: ["libvndk_sp_ext"],
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2018-11-06 17:12:13 +01:00
|
|
|
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp_ext",
|
|
|
|
vendor: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
extends: "libvndk_sp",
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libvndk_sp2",
|
|
|
|
vendor_available: true,
|
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
target: {
|
|
|
|
vendor: {
|
|
|
|
shared_libs: ["libvndk_sp_ext"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
|
2015-05-01 01:36:18 +02:00
|
|
|
var (
|
|
|
|
str11 = "01234567891"
|
|
|
|
str10 = str11[:10]
|
|
|
|
str9 = str11[:9]
|
|
|
|
str5 = str11[:5]
|
|
|
|
str4 = str11[:4]
|
|
|
|
)
|
|
|
|
|
|
|
|
var splitListForSizeTestCases = []struct {
|
|
|
|
in []string
|
|
|
|
out [][]string
|
|
|
|
size int
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
in: []string{str10},
|
|
|
|
out: [][]string{{str10}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str9},
|
|
|
|
out: [][]string{{str9}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5},
|
|
|
|
out: [][]string{{str5}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str11},
|
|
|
|
out: nil,
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str10, str10},
|
|
|
|
out: [][]string{{str10}, {str10}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str9, str10},
|
|
|
|
out: [][]string{{str9}, {str10}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str10, str9},
|
|
|
|
out: [][]string{{str10}, {str9}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5, str4},
|
|
|
|
out: [][]string{{str5, str4}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5, str4, str5},
|
|
|
|
out: [][]string{{str5, str4}, {str5}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5, str4, str5, str4},
|
|
|
|
out: [][]string{{str5, str4}, {str5, str4}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5, str4, str5, str5},
|
|
|
|
out: [][]string{{str5, str4}, {str5}, {str5}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str5, str5, str5, str4},
|
|
|
|
out: [][]string{{str5}, {str5}, {str5, str4}},
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str9, str11},
|
|
|
|
out: nil,
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: []string{str11, str9},
|
|
|
|
out: nil,
|
|
|
|
size: 10,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSplitListForSize(t *testing.T) {
|
|
|
|
for _, testCase := range splitListForSizeTestCases {
|
2017-05-09 22:34:34 +02:00
|
|
|
out, _ := splitListForSize(android.PathsForTesting(testCase.in), testCase.size)
|
|
|
|
|
|
|
|
var outStrings [][]string
|
|
|
|
|
|
|
|
if len(out) > 0 {
|
|
|
|
outStrings = make([][]string, len(out))
|
|
|
|
for i, o := range out {
|
|
|
|
outStrings[i] = o.Strings()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(outStrings, testCase.out) {
|
2015-05-01 01:36:18 +02:00
|
|
|
t.Errorf("incorrect output:")
|
|
|
|
t.Errorf(" input: %#v", testCase.in)
|
|
|
|
t.Errorf(" size: %d", testCase.size)
|
|
|
|
t.Errorf(" expected: %#v", testCase.out)
|
2017-05-09 22:34:34 +02:00
|
|
|
t.Errorf(" got: %#v", outStrings)
|
2015-05-01 01:36:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
var staticLinkDepOrderTestCases = []struct {
|
|
|
|
// This is a string representation of a map[moduleName][]moduleDependency .
|
|
|
|
// It models the dependencies declared in an Android.bp file.
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic string
|
|
|
|
|
|
|
|
// This is a string representation of a map[moduleName][]moduleDependency .
|
|
|
|
// It models the dependencies declared in an Android.bp file.
|
|
|
|
inShared string
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
// allOrdered is a string representation of a map[moduleName][]moduleDependency .
|
|
|
|
// The keys of allOrdered specify which modules we would like to check.
|
|
|
|
// The values of allOrdered specify the expected result (of the transitive closure of all
|
|
|
|
// dependencies) for each module to test
|
|
|
|
allOrdered string
|
|
|
|
|
|
|
|
// outOrdered is a string representation of a map[moduleName][]moduleDependency .
|
|
|
|
// The keys of outOrdered specify which modules we would like to check.
|
|
|
|
// The values of outOrdered specify the expected result (of the ordered linker command line)
|
|
|
|
// for each module to test.
|
|
|
|
outOrdered string
|
|
|
|
}{
|
|
|
|
// Simple tests
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "",
|
|
|
|
},
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:",
|
|
|
|
},
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b; b:",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:b; b:",
|
|
|
|
},
|
|
|
|
// Tests of reordering
|
|
|
|
{
|
|
|
|
// diamond example
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:d,b,c; b:d; c:d; d:",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:b,c,d; b:d; c:d; d:",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// somewhat real example
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "bsdiff_unittest:b,c,d,e,f,g,h,i; e:b",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "bsdiff_unittest:c,d,e,b,f,g,h,i; e:b",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// multiple reorderings
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b,c,d,e; d:b; e:c",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:d,b,e,c; d:b; e:c",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// should reorder without adding new transitive dependencies
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "bin:lib2,lib1; lib1:lib2,liboptional",
|
2017-09-28 02:05:30 +02:00
|
|
|
allOrdered: "bin:lib1,lib2,liboptional; lib1:lib2,liboptional",
|
|
|
|
outOrdered: "bin:lib1,lib2; lib1:lib2,liboptional",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// multiple levels of dependencies
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b,c,d,e,f,g,h; f:b,c,d; b:c,d; c:d",
|
2017-09-28 02:05:30 +02:00
|
|
|
allOrdered: "a:e,f,b,c,d,g,h; f:b,c,d; b:c,d; c:d",
|
|
|
|
outOrdered: "a:e,f,b,c,d,g,h; f:b,c,d; b:c,d; c:d",
|
|
|
|
},
|
2017-11-28 00:48:57 +01:00
|
|
|
// shared dependencies
|
|
|
|
{
|
|
|
|
// Note that this test doesn't recurse, to minimize the amount of logic it tests.
|
|
|
|
// So, we don't actually have to check that a shared dependency of c will change the order
|
|
|
|
// of a library that depends statically on b and on c. We only need to check that if c has
|
|
|
|
// a shared dependency on b, that that shows up in allOrdered.
|
|
|
|
inShared: "c:b",
|
|
|
|
allOrdered: "c:b",
|
|
|
|
outOrdered: "c:",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// This test doesn't actually include any shared dependencies but it's a reminder of what
|
|
|
|
// the second phase of the above test would look like
|
|
|
|
inStatic: "a:b,c; c:b",
|
|
|
|
allOrdered: "a:c,b; c:b",
|
|
|
|
outOrdered: "a:c,b; c:b",
|
|
|
|
},
|
2017-09-28 02:05:30 +02:00
|
|
|
// tiebreakers for when two modules specifying different orderings and there is no dependency
|
|
|
|
// to dictate an order
|
|
|
|
{
|
|
|
|
// if the tie is between two modules at the end of a's deps, then a's order wins
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a1:b,c,d,e; a2:b,c,e,d; b:d,e; c:e,d",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a1:b,c,d,e; a2:b,c,e,d; b:d,e; c:e,d",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// if the tie is between two modules at the start of a's deps, then c's order is used
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a1:d,e,b1,c1; b1:d,e; c1:e,d; a2:d,e,b2,c2; b2:d,e; c2:d,e",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a1:b1,c1,e,d; b1:d,e; c1:e,d; a2:b2,c2,d,e; b2:d,e; c2:d,e",
|
|
|
|
},
|
|
|
|
// Tests involving duplicate dependencies
|
|
|
|
{
|
|
|
|
// simple duplicate
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b,c,c,b",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:c,b",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// duplicates with reordering
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b,c,d,c; c:b",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:d,c,b",
|
|
|
|
},
|
|
|
|
// Tests to confirm the nonexistence of infinite loops.
|
|
|
|
// These cases should never happen, so as long as the test terminates and the
|
|
|
|
// result is deterministic then that should be fine.
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:a",
|
2017-09-28 02:05:30 +02:00
|
|
|
outOrdered: "a:a",
|
|
|
|
},
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b; b:c; c:a",
|
2017-09-28 02:05:30 +02:00
|
|
|
allOrdered: "a:b,c; b:c,a; c:a,b",
|
|
|
|
outOrdered: "a:b; b:c; c:a",
|
|
|
|
},
|
|
|
|
{
|
2017-11-28 00:48:57 +01:00
|
|
|
inStatic: "a:b,c; b:c,a; c:a,b",
|
2017-09-28 02:05:30 +02:00
|
|
|
allOrdered: "a:c,a,b; b:a,b,c; c:b,c,a",
|
|
|
|
outOrdered: "a:c,b; b:a,c; c:b,a",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// converts from a string like "a:b,c; d:e" to (["a","b"], {"a":["b","c"], "d":["e"]}, [{"a", "a.o"}, {"b", "b.o"}])
|
|
|
|
func parseModuleDeps(text string) (modulesInOrder []android.Path, allDeps map[android.Path][]android.Path) {
|
|
|
|
// convert from "a:b,c; d:e" to "a:b,c;d:e"
|
|
|
|
strippedText := strings.Replace(text, " ", "", -1)
|
|
|
|
if len(strippedText) < 1 {
|
|
|
|
return []android.Path{}, make(map[android.Path][]android.Path, 0)
|
|
|
|
}
|
|
|
|
allDeps = make(map[android.Path][]android.Path, 0)
|
|
|
|
|
|
|
|
// convert from "a:b,c;d:e" to ["a:b,c", "d:e"]
|
|
|
|
moduleTexts := strings.Split(strippedText, ";")
|
|
|
|
|
|
|
|
outputForModuleName := func(moduleName string) android.Path {
|
|
|
|
return android.PathForTesting(moduleName)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, moduleText := range moduleTexts {
|
|
|
|
// convert from "a:b,c" to ["a", "b,c"]
|
|
|
|
components := strings.Split(moduleText, ":")
|
|
|
|
if len(components) != 2 {
|
|
|
|
panic(fmt.Sprintf("illegal module dep string %q from larger string %q; must contain one ':', not %v", moduleText, text, len(components)-1))
|
|
|
|
}
|
|
|
|
moduleName := components[0]
|
|
|
|
moduleOutput := outputForModuleName(moduleName)
|
|
|
|
modulesInOrder = append(modulesInOrder, moduleOutput)
|
|
|
|
|
|
|
|
depString := components[1]
|
|
|
|
// convert from "b,c" to ["b", "c"]
|
|
|
|
depNames := strings.Split(depString, ",")
|
|
|
|
if len(depString) < 1 {
|
|
|
|
depNames = []string{}
|
|
|
|
}
|
|
|
|
var deps []android.Path
|
|
|
|
for _, depName := range depNames {
|
|
|
|
deps = append(deps, outputForModuleName(depName))
|
|
|
|
}
|
|
|
|
allDeps[moduleOutput] = deps
|
|
|
|
}
|
|
|
|
return modulesInOrder, allDeps
|
|
|
|
}
|
|
|
|
|
2017-11-28 00:48:57 +01:00
|
|
|
func TestLinkReordering(t *testing.T) {
|
2017-09-28 02:05:30 +02:00
|
|
|
for _, testCase := range staticLinkDepOrderTestCases {
|
|
|
|
errs := []string{}
|
|
|
|
|
|
|
|
// parse testcase
|
2017-11-28 00:48:57 +01:00
|
|
|
_, givenTransitiveDeps := parseModuleDeps(testCase.inStatic)
|
2017-09-28 02:05:30 +02:00
|
|
|
expectedModuleNames, expectedTransitiveDeps := parseModuleDeps(testCase.outOrdered)
|
|
|
|
if testCase.allOrdered == "" {
|
|
|
|
// allow the test case to skip specifying allOrdered
|
|
|
|
testCase.allOrdered = testCase.outOrdered
|
|
|
|
}
|
|
|
|
_, expectedAllDeps := parseModuleDeps(testCase.allOrdered)
|
2017-11-28 00:48:57 +01:00
|
|
|
_, givenAllSharedDeps := parseModuleDeps(testCase.inShared)
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
// For each module whose post-reordered dependencies were specified, validate that
|
|
|
|
// reordering the inputs produces the expected outputs.
|
|
|
|
for _, moduleName := range expectedModuleNames {
|
|
|
|
moduleDeps := givenTransitiveDeps[moduleName]
|
2017-11-28 00:48:57 +01:00
|
|
|
givenSharedDeps := givenAllSharedDeps[moduleName]
|
|
|
|
orderedAllDeps, orderedDeclaredDeps := orderDeps(moduleDeps, givenSharedDeps, givenTransitiveDeps)
|
2017-09-28 02:05:30 +02:00
|
|
|
|
|
|
|
correctAllOrdered := expectedAllDeps[moduleName]
|
|
|
|
if !reflect.DeepEqual(orderedAllDeps, correctAllOrdered) {
|
|
|
|
errs = append(errs, fmt.Sprintf("orderDeps returned incorrect orderedAllDeps."+
|
2017-11-28 00:48:57 +01:00
|
|
|
"\nin static:%q"+
|
|
|
|
"\nin shared:%q"+
|
2017-09-28 02:05:30 +02:00
|
|
|
"\nmodule: %v"+
|
|
|
|
"\nexpected: %s"+
|
|
|
|
"\nactual: %s",
|
2017-11-28 00:48:57 +01:00
|
|
|
testCase.inStatic, testCase.inShared, moduleName, correctAllOrdered, orderedAllDeps))
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
correctOutputDeps := expectedTransitiveDeps[moduleName]
|
|
|
|
if !reflect.DeepEqual(correctOutputDeps, orderedDeclaredDeps) {
|
|
|
|
errs = append(errs, fmt.Sprintf("orderDeps returned incorrect orderedDeclaredDeps."+
|
2017-11-28 00:48:57 +01:00
|
|
|
"\nin static:%q"+
|
|
|
|
"\nin shared:%q"+
|
2017-09-28 02:05:30 +02:00
|
|
|
"\nmodule: %v"+
|
|
|
|
"\nexpected: %s"+
|
|
|
|
"\nactual: %s",
|
2017-11-28 00:48:57 +01:00
|
|
|
testCase.inStatic, testCase.inShared, moduleName, correctOutputDeps, orderedDeclaredDeps))
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(errs) > 0 {
|
|
|
|
sort.Strings(errs)
|
|
|
|
for _, err := range errs {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
|
2017-09-28 02:05:30 +02:00
|
|
|
func getOutputPaths(ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
|
|
|
|
for _, moduleName := range moduleNames {
|
|
|
|
module := ctx.ModuleForTests(moduleName, variant).Module().(*Module)
|
|
|
|
output := module.outputFile.Path()
|
|
|
|
paths = append(paths, output)
|
|
|
|
}
|
|
|
|
return paths
|
|
|
|
}
|
|
|
|
|
2017-11-28 00:48:57 +01:00
|
|
|
func TestStaticLibDepReordering(t *testing.T) {
|
2017-09-28 02:05:30 +02:00
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "a",
|
|
|
|
static_libs: ["b", "c", "d"],
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "b",
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "c",
|
|
|
|
static_libs: ["b"],
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "d",
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
variant := "android_arm64_armv8-a_core_static"
|
|
|
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
2017-11-28 00:48:57 +01:00
|
|
|
actual := moduleA.depsInLinkOrder
|
2017-09-28 02:05:30 +02:00
|
|
|
expected := getOutputPaths(ctx, variant, []string{"c", "b", "d"})
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(actual, expected) {
|
|
|
|
t.Errorf("staticDeps orderings were not propagated correctly"+
|
|
|
|
"\nactual: %v"+
|
|
|
|
"\nexpected: %v",
|
|
|
|
actual,
|
|
|
|
expected,
|
|
|
|
)
|
|
|
|
}
|
2017-09-26 03:50:54 +02:00
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
|
2017-11-28 00:48:57 +01:00
|
|
|
func TestStaticLibDepReorderingWithShared(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library {
|
|
|
|
name: "a",
|
|
|
|
static_libs: ["b", "c"],
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-11-28 00:48:57 +01:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "b",
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-11-28 00:48:57 +01:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "c",
|
|
|
|
shared_libs: ["b"],
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
stl: "none",
|
2017-11-28 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
variant := "android_arm64_armv8-a_core_static"
|
|
|
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
|
|
|
actual := moduleA.depsInLinkOrder
|
|
|
|
expected := getOutputPaths(ctx, variant, []string{"c", "b"})
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(actual, expected) {
|
|
|
|
t.Errorf("staticDeps orderings did not account for shared libs"+
|
|
|
|
"\nactual: %v"+
|
|
|
|
"\nexpected: %v",
|
|
|
|
actual,
|
|
|
|
expected,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-14 11:54:34 +01:00
|
|
|
func TestLlndkHeaders(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
llndk_headers {
|
|
|
|
name: "libllndk_headers",
|
|
|
|
export_include_dirs: ["my_include"],
|
|
|
|
}
|
|
|
|
llndk_library {
|
|
|
|
name: "libllndk",
|
|
|
|
export_llndk_headers: ["libllndk_headers"],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
shared_libs: ["libllndk"],
|
|
|
|
vendor: true,
|
|
|
|
srcs: ["foo.c"],
|
Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2017-10-31 11:04:35 +01:00
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
2017-12-14 11:54:34 +01:00
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
// _static variant is used since _shared reuses *.o from the static variant
|
|
|
|
cc := ctx.ModuleForTests("libvendor", "android_arm_armv7-a-neon_vendor_static").Rule("cc")
|
|
|
|
cflags := cc.Args["cFlags"]
|
|
|
|
if !strings.Contains(cflags, "-Imy_include") {
|
|
|
|
t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-19 18:17:32 +01:00
|
|
|
func checkRuntimeLibs(t *testing.T, expected []string, module *Module) {
|
|
|
|
actual := module.Properties.AndroidMkRuntimeLibs
|
|
|
|
if !reflect.DeepEqual(actual, expected) {
|
|
|
|
t.Errorf("incorrect runtime_libs for shared libs"+
|
|
|
|
"\nactual: %v"+
|
|
|
|
"\nexpected: %v",
|
|
|
|
actual,
|
|
|
|
expected,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const runtimeLibAndroidBp = `
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor_available1",
|
|
|
|
vendor_available: true,
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor_available2",
|
|
|
|
vendor_available: true,
|
|
|
|
runtime_libs: ["libvendor_available1"],
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor_available3",
|
|
|
|
vendor_available: true,
|
|
|
|
runtime_libs: ["libvendor_available1"],
|
|
|
|
target: {
|
|
|
|
vendor: {
|
|
|
|
exclude_runtime_libs: ["libvendor_available1"],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libcore",
|
|
|
|
runtime_libs: ["libvendor_available1"],
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor1",
|
|
|
|
vendor: true,
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor2",
|
|
|
|
vendor: true,
|
|
|
|
runtime_libs: ["libvendor_available1", "libvendor1"],
|
|
|
|
no_libgcc : true,
|
|
|
|
nocrt : true,
|
|
|
|
system_shared_libs : [],
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
func TestRuntimeLibs(t *testing.T) {
|
|
|
|
ctx := testCc(t, runtimeLibAndroidBp)
|
|
|
|
|
|
|
|
// runtime_libs for core variants use the module names without suffixes.
|
|
|
|
variant := "android_arm64_armv8-a_core_shared"
|
|
|
|
|
|
|
|
module := ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
|
|
|
|
|
|
|
module = ctx.ModuleForTests("libcore", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
|
|
|
|
|
|
|
// runtime_libs for vendor variants have '.vendor' suffixes if the modules have both core
|
|
|
|
// and vendor variants.
|
|
|
|
variant = "android_arm64_armv8-a_vendor_shared"
|
|
|
|
|
|
|
|
module = ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1.vendor"}, module)
|
|
|
|
|
|
|
|
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1.vendor", "libvendor1"}, module)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExcludeRuntimeLibs(t *testing.T) {
|
|
|
|
ctx := testCc(t, runtimeLibAndroidBp)
|
|
|
|
|
|
|
|
variant := "android_arm64_armv8-a_core_shared"
|
|
|
|
module := ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
|
|
|
|
|
|
|
variant = "android_arm64_armv8-a_vendor_shared"
|
|
|
|
module = ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, nil, module)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRuntimeLibsNoVndk(t *testing.T) {
|
|
|
|
ctx := testCcNoVndk(t, runtimeLibAndroidBp)
|
|
|
|
|
|
|
|
// If DeviceVndkVersion is not defined, then runtime_libs are copied as-is.
|
|
|
|
|
|
|
|
variant := "android_arm64_armv8-a_core_shared"
|
|
|
|
|
|
|
|
module := ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
|
|
|
|
|
|
|
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
|
|
|
checkRuntimeLibs(t, []string{"libvendor_available1", "libvendor1"}, module)
|
|
|
|
}
|
|
|
|
|
2018-11-16 02:19:56 +01:00
|
|
|
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_library {
|
|
|
|
name: "lib2",
|
|
|
|
static_libs: ["lib1"],
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
func TestStaticLibDepExport(t *testing.T) {
|
|
|
|
ctx := testCc(t, staticLibAndroidBp)
|
|
|
|
|
|
|
|
// Check the shared version of lib2.
|
|
|
|
variant := "android_arm64_armv8-a_core_shared"
|
|
|
|
module := ctx.ModuleForTests("lib2", variant).Module().(*Module)
|
|
|
|
checkStaticLibs(t, []string{"lib1", "libclang_rt.builtins-aarch64-android", "libatomic", "libgcc"}, module)
|
|
|
|
|
|
|
|
// Check the static version of lib2.
|
|
|
|
variant = "android_arm64_armv8-a_core_static"
|
|
|
|
module = ctx.ModuleForTests("lib2", variant).Module().(*Module)
|
|
|
|
// libc++_static is linked additionally.
|
|
|
|
checkStaticLibs(t, []string{"lib1", "libc++_static", "libclang_rt.builtins-aarch64-android", "libatomic", "libgcc"}, module)
|
|
|
|
}
|
|
|
|
|
2017-09-26 03:50:54 +02:00
|
|
|
var compilerFlagsTestCases = []struct {
|
|
|
|
in string
|
|
|
|
out bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
in: "a",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-a",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-Ipath/to/something",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-isystempath/to/something",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "--coverage",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-include a/b",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-include a/b c/d",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMACRO",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMAC RO",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-a -b",
|
|
|
|
out: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMACRO=definition",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMACRO=defi nition",
|
|
|
|
out: true, // TODO(jiyong): this should be false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMACRO(x)=x + 1",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
in: "-DMACRO=\"defi nition\"",
|
|
|
|
out: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
type mockContext struct {
|
|
|
|
BaseModuleContext
|
|
|
|
result bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ctx *mockContext) PropertyErrorf(property, format string, args ...interface{}) {
|
|
|
|
// CheckBadCompilerFlags calls this function when the flag should be rejected
|
|
|
|
ctx.result = false
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCompilerFlags(t *testing.T) {
|
|
|
|
for _, testCase := range compilerFlagsTestCases {
|
|
|
|
ctx := &mockContext{result: true}
|
|
|
|
CheckBadCompilerFlags(ctx, "", []string{testCase.in})
|
|
|
|
if ctx.result != testCase.out {
|
|
|
|
t.Errorf("incorrect output:")
|
|
|
|
t.Errorf(" input: %#v", testCase.in)
|
|
|
|
t.Errorf(" expected: %#v", testCase.out)
|
|
|
|
t.Errorf(" got: %#v", ctx.result)
|
|
|
|
}
|
|
|
|
}
|
2017-09-28 02:05:30 +02:00
|
|
|
}
|
Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.
However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).
This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:
cc_library {
name: "libvendor",
proprietary: true,
...
}
vendor_public_library {
name: "libvendor",
symbol_file: "libvendor.map.txt",
}
This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.
Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-19 10:23:01 +01:00
|
|
|
|
|
|
|
func TestVendorPublicLibraries(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library_headers {
|
|
|
|
name: "libvendorpublic_headers",
|
|
|
|
export_include_dirs: ["my_include"],
|
|
|
|
}
|
|
|
|
vendor_public_library {
|
|
|
|
name: "libvendorpublic",
|
|
|
|
symbol_file: "",
|
|
|
|
export_public_headers: ["libvendorpublic_headers"],
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendorpublic",
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
vendor: true,
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libsystem",
|
|
|
|
shared_libs: ["libvendorpublic"],
|
|
|
|
vendor: false,
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libvendor",
|
|
|
|
shared_libs: ["libvendorpublic"],
|
|
|
|
vendor: true,
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
no_libgcc: true,
|
|
|
|
nocrt: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
variant := "android_arm64_armv8-a_core_shared"
|
|
|
|
|
|
|
|
// test if header search paths are correctly added
|
|
|
|
// _static variant is used since _shared reuses *.o from the static variant
|
|
|
|
cc := ctx.ModuleForTests("libsystem", strings.Replace(variant, "_shared", "_static", 1)).Rule("cc")
|
|
|
|
cflags := cc.Args["cFlags"]
|
|
|
|
if !strings.Contains(cflags, "-Imy_include") {
|
|
|
|
t.Errorf("cflags for libsystem must contain -Imy_include, but was %#v.", cflags)
|
|
|
|
}
|
|
|
|
|
|
|
|
// test if libsystem is linked to the stub
|
|
|
|
ld := ctx.ModuleForTests("libsystem", variant).Rule("ld")
|
|
|
|
libflags := ld.Args["libFlags"]
|
|
|
|
stubPaths := getOutputPaths(ctx, variant, []string{"libvendorpublic" + vendorPublicLibrarySuffix})
|
|
|
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
|
|
|
t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
|
|
|
|
}
|
|
|
|
|
|
|
|
// test if libvendor is linked to the real shared lib
|
|
|
|
ld = ctx.ModuleForTests("libvendor", strings.Replace(variant, "_core", "_vendor", 1)).Rule("ld")
|
|
|
|
libflags = ld.Args["libFlags"]
|
|
|
|
stubPaths = getOutputPaths(ctx, strings.Replace(variant, "_core", "_vendor", 1), []string{"libvendorpublic"})
|
|
|
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
|
|
|
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2018-07-11 03:49:27 +02:00
|
|
|
|
|
|
|
func TestRecovery(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "librecovery",
|
|
|
|
recovery: true,
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "librecovery32",
|
|
|
|
recovery: true,
|
|
|
|
compile_multilib:"32",
|
|
|
|
}
|
2018-08-28 02:55:37 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "libHalInRecovery",
|
|
|
|
recovery_available: true,
|
|
|
|
vendor: true,
|
|
|
|
}
|
2018-07-11 03:49:27 +02:00
|
|
|
`)
|
|
|
|
|
|
|
|
variants := ctx.ModuleVariantsForTests("librecovery")
|
|
|
|
const arm64 = "android_arm64_armv8-a_recovery_shared"
|
|
|
|
if len(variants) != 1 || !android.InList(arm64, variants) {
|
|
|
|
t.Errorf("variants of librecovery must be \"%s\" only, but was %#v", arm64, variants)
|
|
|
|
}
|
|
|
|
|
|
|
|
variants = ctx.ModuleVariantsForTests("librecovery32")
|
|
|
|
if android.InList(arm64, variants) {
|
|
|
|
t.Errorf("multilib was set to 32 for librecovery32, but its variants has %s.", arm64)
|
|
|
|
}
|
2018-08-28 02:55:37 +02:00
|
|
|
|
|
|
|
recoveryModule := ctx.ModuleForTests("libHalInRecovery", recoveryVariant).Module().(*Module)
|
|
|
|
if !recoveryModule.Platform() {
|
|
|
|
t.Errorf("recovery variant of libHalInRecovery must not specific to device, soc, or product")
|
|
|
|
}
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
}
|
2018-08-28 02:55:37 +02:00
|
|
|
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
func TestVersionedStubs(t *testing.T) {
|
|
|
|
ctx := testCc(t, `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "libFoo",
|
2018-11-02 10:23:15 +01:00
|
|
|
srcs: ["foo.c"],
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
stubs: {
|
|
|
|
symbol_file: "foo.map.txt",
|
|
|
|
versions: ["1", "2", "3"],
|
|
|
|
},
|
|
|
|
}
|
2018-11-02 10:23:15 +01:00
|
|
|
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "libBar",
|
2018-11-02 10:23:15 +01:00
|
|
|
srcs: ["bar.c"],
|
Add support for versioned stubs.
A cc_library or cc_library_shared can be configured to have stubs
variants of the lib.
cc_library_shared {
name: "libfoo",
srcs: ["foo.cpp"],
stubs: {
symbol_file: "foo.map.txt",
versions: ["1", "2", "3"],
},
}
then, stubs variants of libfoo for version 1, 2, and 3 are created
from foo.map.txt. Each version has the symbols from the map file where
each symbol is annotated with the version that the symbol was introduced
via the 'introduced=<ver>' syntax. The versions don't need to be in sync
with the platform versions (e.g., P for 28). The versions are local to
the library.
For another library or executable to use the versioned stubs lib, use
the new 'name#ver' syntax to specify the version:
cc_binary {
name: "test",
....
shared_libs: ["libFoo#2"],
}
Internally, a new mutator 'version' is applied to all cc.Module objects.
By default, a variant named 'impl' is created for the non-stub version.
If the versions property is set, additional variations are created per a
version with the mutable property BuildStubs set as true, which lets the
compiler and the linker to build a stubs lib from the symbol file
instead from the source files.
This feature will be used to enforce stable interfaces among APEXs. When
a lib foo in an APEX is depending on a lib bar in another APEX, then bar
should have stable interface (in C lang) and foo should be depending on
one of the stubs libs of bar. Only libraries in the same APEX as foo can
link against non-stub version of it.
Bug: 112672359
Test: m (cc_test added)
Change-Id: I2488be0b9d7b7b8d7761234dc1c9c0e3add8601c
2018-10-15 15:25:07 +02:00
|
|
|
shared_libs: ["libFoo#1"],
|
|
|
|
}`)
|
|
|
|
|
|
|
|
variants := ctx.ModuleVariantsForTests("libFoo")
|
|
|
|
expectedVariants := []string{
|
|
|
|
"android_arm64_armv8-a_core_shared",
|
|
|
|
"android_arm64_armv8-a_core_shared_1",
|
|
|
|
"android_arm64_armv8-a_core_shared_2",
|
|
|
|
"android_arm64_armv8-a_core_shared_3",
|
|
|
|
"android_arm_armv7-a-neon_core_shared",
|
|
|
|
"android_arm_armv7-a-neon_core_shared_1",
|
|
|
|
"android_arm_armv7-a-neon_core_shared_2",
|
|
|
|
"android_arm_armv7-a-neon_core_shared_3",
|
|
|
|
}
|
|
|
|
variantsMismatch := false
|
|
|
|
if len(variants) != len(expectedVariants) {
|
|
|
|
variantsMismatch = true
|
|
|
|
} else {
|
|
|
|
for _, v := range expectedVariants {
|
|
|
|
if !inList(v, variants) {
|
|
|
|
variantsMismatch = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if variantsMismatch {
|
|
|
|
t.Errorf("variants of libFoo expected:\n")
|
|
|
|
for _, v := range expectedVariants {
|
|
|
|
t.Errorf("%q\n", v)
|
|
|
|
}
|
|
|
|
t.Errorf(", but got:\n")
|
|
|
|
for _, v := range variants {
|
|
|
|
t.Errorf("%q\n", v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
libBarLinkRule := ctx.ModuleForTests("libBar", "android_arm64_armv8-a_core_shared").Rule("ld")
|
|
|
|
libFlags := libBarLinkRule.Args["libFlags"]
|
|
|
|
libFoo1StubPath := "libFoo/android_arm64_armv8-a_core_shared_1/libFoo.so"
|
|
|
|
if !strings.Contains(libFlags, libFoo1StubPath) {
|
|
|
|
t.Errorf("%q is not found in %q", libFoo1StubPath, libFlags)
|
|
|
|
}
|
2018-11-02 10:23:15 +01:00
|
|
|
|
|
|
|
libBarCompileRule := ctx.ModuleForTests("libBar", "android_arm64_armv8-a_core_shared").Rule("cc")
|
|
|
|
cFlags := libBarCompileRule.Args["cFlags"]
|
|
|
|
libFoo1VersioningMacro := "-D__LIBFOO_API__=1"
|
|
|
|
if !strings.Contains(cFlags, libFoo1VersioningMacro) {
|
|
|
|
t.Errorf("%q is not found in %q", libFoo1VersioningMacro, cFlags)
|
|
|
|
}
|
2018-07-11 03:49:27 +02:00
|
|
|
}
|