bf37d165f0
platform. The NOTICE file generation depends on the NOTICE targets for all static library dependencies. If such a dependency didn't have //apex_available:platform it didn't get any AndroidMk entry and hence no NOTICE target via soong_cc_prebuilt.mk. If it was then depended upon by a binary or library that is accessible to platform, the NOTICE dependency failed. Normally such a dependency is invalid, but there are corner cases where binaries go neither into platform nor any APEX module, and they can legitimately have such dependencies (cf. b/152241137). With this CL requests to skip installation of such a static libraries are ignored so that they get AndroidMk entries, which will always have LOCAL_UNINSTALLABLE_MODULE set. Test: "m simpleperf_ndk" with https://r.android.com/1273016, which removes //apex_available:platform from libs that simpleperf_ndk depends on statically. Bug: 152241137 Bug: 149217815 Change-Id: If36e85dd16ade56d4ec1d6744811df5a15b6242c
112 lines
3.1 KiB
Go
112 lines
3.1 KiB
Go
// Copyright 2016 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.
|
|
|
|
package cc
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"android/soong/android"
|
|
)
|
|
|
|
// This file handles installing files into their final location
|
|
|
|
type InstallerProperties struct {
|
|
// install to a subdirectory of the default install path for the module
|
|
Relative_install_path *string `android:"arch_variant"`
|
|
}
|
|
|
|
type installLocation int
|
|
|
|
const (
|
|
InstallInSystem installLocation = 0
|
|
InstallInData = iota
|
|
InstallInSanitizerDir = iota
|
|
)
|
|
|
|
func NewBaseInstaller(dir, dir64 string, location installLocation) *baseInstaller {
|
|
return &baseInstaller{
|
|
dir: dir,
|
|
dir64: dir64,
|
|
location: location,
|
|
}
|
|
}
|
|
|
|
type baseInstaller struct {
|
|
Properties InstallerProperties
|
|
|
|
dir string
|
|
dir64 string
|
|
subDir string
|
|
relative string
|
|
location installLocation
|
|
|
|
path android.InstallPath
|
|
}
|
|
|
|
var _ installer = (*baseInstaller)(nil)
|
|
|
|
func (installer *baseInstaller) installerProps() []interface{} {
|
|
return []interface{}{&installer.Properties}
|
|
}
|
|
|
|
func (installer *baseInstaller) installDir(ctx ModuleContext) android.InstallPath {
|
|
dir := installer.dir
|
|
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
|
|
dir = installer.dir64
|
|
}
|
|
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
|
dir = filepath.Join(dir, ctx.Target().NativeBridgeRelativePath)
|
|
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
|
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
|
}
|
|
if installer.location == InstallInData && ctx.useVndk() {
|
|
if ctx.inProduct() {
|
|
dir = filepath.Join(dir, "product")
|
|
} else {
|
|
dir = filepath.Join(dir, "vendor")
|
|
}
|
|
}
|
|
return android.PathForModuleInstall(ctx, dir, installer.subDir,
|
|
installer.relativeInstallPath(), installer.relative)
|
|
}
|
|
|
|
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
|
installer.path = ctx.InstallFile(installer.installDir(ctx), file.Base(), file)
|
|
}
|
|
|
|
func (installer *baseInstaller) everInstallable() bool {
|
|
// Most cc modules are installable.
|
|
return true
|
|
}
|
|
|
|
func (installer *baseInstaller) inData() bool {
|
|
return installer.location == InstallInData
|
|
}
|
|
|
|
func (installer *baseInstaller) inSanitizerDir() bool {
|
|
return installer.location == InstallInSanitizerDir
|
|
}
|
|
|
|
func (installer *baseInstaller) hostToolPath() android.OptionalPath {
|
|
return android.OptionalPath{}
|
|
}
|
|
|
|
func (installer *baseInstaller) relativeInstallPath() string {
|
|
return String(installer.Properties.Relative_install_path)
|
|
}
|
|
|
|
func (installer *baseInstaller) skipInstall(mod *Module) {
|
|
mod.ModuleBase.SkipInstall()
|
|
}
|