Add support for sysprop description files to c++

From now on, a c++ shared library can be built only with adding
".sysprop" description file to srcs. Sysprop library generator will
automatically generate a .cpp and .h files, and the header file will be
exposed to any clients linking against the shared library. For the full
schema of description file, see system/tools/sysprop/sysprop.proto.

Bug: 80125326
Test: 1) write a .sysprop description file.
2) create cc_library_shared and add description file to srcs.
3) create another module, link against library of 2), include generated
header, and access generated sysprop functions
4) see compile succeeded.

Change-Id: I95005a0724aeb8f11a856b7aee92787a16a5374d
This commit is contained in:
Inseob Kim
2018-09-06 00:55:20 +09:00
parent 55e095b6d8
commit 21f26907cc
3 changed files with 51 additions and 1 deletions

View File

@@ -224,6 +224,10 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps = protoDeps(ctx, deps, &compiler.Proto, Bool(compiler.Properties.Proto.Static))
}
if compiler.hasSrcExt(".sysprop") {
deps.SharedLibs = append(deps.SharedLibs, "libbase")
}
if Bool(compiler.Properties.Openmp) {
deps.StaticLibs = append(deps.StaticLibs, "libomp")
}
@@ -489,6 +493,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags = rsFlags(ctx, flags, &compiler.Properties)
}
if compiler.hasSrcExt(".sysprop") {
flags.GlobalFlags = append(flags.GlobalFlags,
"-I"+android.PathForModuleGen(ctx, "sysprop", "include").String())
}
if len(compiler.Properties.Srcs) > 0 {
module := ctx.ModuleDir() + "/Android.bp:" + ctx.ModuleName()
if inList("-Wno-error", flags.CFlags) || inList("-Wno-error", flags.CppFlags) {