Delete SyspropMutator (again)
This CL essentially un-reverts aosp/2119952, now that the issue has been resolved. Bug: 226199990 Test: m Change-Id: I3b828eb7f7cf54023c9e1d3229cf1ff7c85ab6dd
This commit is contained in:
parent
2ba6d37e7b
commit
d82e8f6858
5 changed files with 9 additions and 95 deletions
|
@ -45,7 +45,6 @@ bootstrap_go_package {
|
||||||
"snapshot_utils.go",
|
"snapshot_utils.go",
|
||||||
"stl.go",
|
"stl.go",
|
||||||
"strip.go",
|
"strip.go",
|
||||||
"sysprop.go",
|
|
||||||
"tidy.go",
|
"tidy.go",
|
||||||
"util.go",
|
"util.go",
|
||||||
"vendor_snapshot.go",
|
"vendor_snapshot.go",
|
||||||
|
|
19
cc/cc.go
19
cc/cc.go
|
@ -51,7 +51,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
||||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||||
ctx.BottomUp("version", versionMutator).Parallel()
|
ctx.BottomUp("version", versionMutator).Parallel()
|
||||||
ctx.BottomUp("begin", BeginMutator).Parallel()
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
||||||
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
|
@ -2392,18 +2391,8 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sysprop_library has to support both C++ and Java. So sysprop_library internally creates one
|
|
||||||
// C++ implementation library and one Java implementation library. When a module links against
|
|
||||||
// sysprop_library, the C++ implementation library has to be linked. syspropImplLibraries is a
|
|
||||||
// map from sysprop_library to implementation library; it will be used in whole_static_libs,
|
|
||||||
// static_libs, and shared_libs.
|
|
||||||
syspropImplLibraries := syspropImplLibraries(actx.Config())
|
|
||||||
|
|
||||||
for _, lib := range deps.WholeStaticLibs {
|
for _, lib := range deps.WholeStaticLibs {
|
||||||
depTag := libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: true, reexportFlags: true}
|
depTag := libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: true, reexportFlags: true}
|
||||||
if impl, ok := syspropImplLibraries[lib]; ok {
|
|
||||||
lib = impl
|
|
||||||
}
|
|
||||||
|
|
||||||
lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
|
@ -2421,10 +2410,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
depTag.excludeInApex = true
|
depTag.excludeInApex = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if impl, ok := syspropImplLibraries[lib]; ok {
|
|
||||||
lib = impl
|
|
||||||
}
|
|
||||||
|
|
||||||
lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
|
@ -2454,10 +2439,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
depTag.excludeInApex = true
|
depTag.excludeInApex = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if impl, ok := syspropImplLibraries[lib]; ok {
|
|
||||||
lib = impl
|
|
||||||
}
|
|
||||||
|
|
||||||
name, version := StubsLibNameAndVersion(lib)
|
name, version := StubsLibNameAndVersion(lib)
|
||||||
sharedLibNames = append(sharedLibNames, name)
|
sharedLibNames = append(sharedLibNames, name)
|
||||||
|
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
// Copyright (C) 2019 The Android Open Source Project
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
package cc
|
|
||||||
|
|
||||||
// This file contains a map to redirect dependencies towards sysprop_library.
|
|
||||||
// As sysprop_library has to support both Java and C++, sysprop_library internally
|
|
||||||
// generates cc_library and java_library. For example, the following sysprop_library
|
|
||||||
//
|
|
||||||
// sysprop_library {
|
|
||||||
// name: "foo",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// will internally generate with prefix "lib"
|
|
||||||
//
|
|
||||||
// cc_library {
|
|
||||||
// name: "libfoo",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// When a cc module links against "foo", build system will redirect the
|
|
||||||
// dependency to "libfoo". To do that, SyspropMutator gathers all sysprop_library,
|
|
||||||
// records their cc implementation library names to a map. The map will be used in
|
|
||||||
// cc.Module.DepsMutator.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"android/soong/android"
|
|
||||||
)
|
|
||||||
|
|
||||||
type syspropLibraryInterface interface {
|
|
||||||
BaseModuleName() string
|
|
||||||
CcImplementationModuleName() string
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
syspropImplLibrariesKey = android.NewOnceKey("syspropImplLibirares")
|
|
||||||
syspropImplLibrariesLock sync.Mutex
|
|
||||||
)
|
|
||||||
|
|
||||||
func syspropImplLibraries(config android.Config) map[string]string {
|
|
||||||
return config.Once(syspropImplLibrariesKey, func() interface{} {
|
|
||||||
return make(map[string]string)
|
|
||||||
}).(map[string]string)
|
|
||||||
}
|
|
||||||
|
|
||||||
// gather list of sysprop libraries
|
|
||||||
func SyspropMutator(mctx android.BottomUpMutatorContext) {
|
|
||||||
if m, ok := mctx.Module().(syspropLibraryInterface); ok {
|
|
||||||
syspropImplLibraries := syspropImplLibraries(mctx.Config())
|
|
||||||
syspropImplLibrariesLock.Lock()
|
|
||||||
defer syspropImplLibrariesLock.Unlock()
|
|
||||||
|
|
||||||
// BaseModuleName is the name of sysprop_library
|
|
||||||
// CcImplementationModuleName is the name of cc_library generated by sysprop_library
|
|
||||||
syspropImplLibraries[m.BaseModuleName()] = m.CcImplementationModuleName()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -365,7 +365,10 @@ func (m *syspropLibrary) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
||||||
// sysprop_library creates schematized APIs from sysprop description files (.sysprop).
|
// sysprop_library creates schematized APIs from sysprop description files (.sysprop).
|
||||||
// Both Java and C++ modules can link against sysprop_library, and API stability check
|
// Both Java and C++ modules can link against sysprop_library, and API stability check
|
||||||
// against latest APIs (see build/soong/scripts/freeze-sysprop-api-files.sh)
|
// against latest APIs (see build/soong/scripts/freeze-sysprop-api-files.sh)
|
||||||
// is performed.
|
// is performed. Note that the generated C++ module has its name prefixed with
|
||||||
|
// `lib`, and it is this module that should be depended on from other C++
|
||||||
|
// modules; i.e., if the sysprop_library module is named `foo`, C++ modules
|
||||||
|
// should depend on `libfoo`.
|
||||||
func syspropLibraryFactory() android.Module {
|
func syspropLibraryFactory() android.Module {
|
||||||
m := &syspropLibrary{}
|
m := &syspropLibrary{}
|
||||||
|
|
||||||
|
|
|
@ -209,32 +209,32 @@ func TestSyspropLibrary(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "cc-client-platform",
|
name: "cc-client-platform",
|
||||||
srcs: ["d.cpp"],
|
srcs: ["d.cpp"],
|
||||||
static_libs: ["sysprop-platform"],
|
static_libs: ["libsysprop-platform"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "cc-client-platform-static",
|
name: "cc-client-platform-static",
|
||||||
srcs: ["d.cpp"],
|
srcs: ["d.cpp"],
|
||||||
whole_static_libs: ["sysprop-platform"],
|
whole_static_libs: ["libsysprop-platform"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "cc-client-product",
|
name: "cc-client-product",
|
||||||
srcs: ["d.cpp"],
|
srcs: ["d.cpp"],
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
static_libs: ["sysprop-platform-on-product", "sysprop-vendor-on-product"],
|
static_libs: ["libsysprop-platform-on-product", "libsysprop-vendor-on-product"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "cc-client-vendor",
|
name: "cc-client-vendor",
|
||||||
srcs: ["d.cpp"],
|
srcs: ["d.cpp"],
|
||||||
soc_specific: true,
|
soc_specific: true,
|
||||||
static_libs: ["sysprop-platform", "sysprop-vendor"],
|
static_libs: ["libsysprop-platform", "libsysprop-vendor"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_binary_host {
|
cc_binary_host {
|
||||||
name: "hostbin",
|
name: "hostbin",
|
||||||
static_libs: ["sysprop-platform"],
|
static_libs: ["libsysprop-platform"],
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue