c0907f191a
A newly introduced sysprop_library soong module will generate a java_sdk_library and a cc_library from .sysprop description files. Both Java modules and C++ modules can link against sysprop_library module, thus giving consistency for using generated sysprop API. As Java controls accessibility of Internal / System properties with @hide and @SystemApi, 2 different header files will be created. And build system will selectively expose depending on the property owner and the place where the client libraries go into. Bug: 80125326 Bug: 122170616 Test: 1) Create sysprop_library module. Test: 2) Create empty txt files under prebuilts/sdk. Test: 3) Create api directory, make update-api, and see changes. Test: 4) Try to link against sysprop_library with various clients. Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags work as intended. Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
// 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
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"android/soong/android"
|
|
)
|
|
|
|
type syspropLibraryInterface interface {
|
|
CcModuleName() 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()
|
|
|
|
syspropImplLibraries[mctx.ModuleName()] = m.CcModuleName()
|
|
}
|
|
}
|