2019-10-18 23:18:45 +02:00
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"android/soong/android"
|
2020-07-28 06:26:48 +02:00
|
|
|
|
|
|
|
"github.com/google/blueprint"
|
2019-10-18 23:18:45 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type LinkableInterface interface {
|
|
|
|
Module() android.Module
|
|
|
|
CcLibrary() bool
|
|
|
|
CcLibraryInterface() bool
|
|
|
|
|
|
|
|
OutputFile() android.OptionalPath
|
2020-04-09 15:56:02 +02:00
|
|
|
CoverageFiles() android.Paths
|
2019-10-18 23:18:45 +02:00
|
|
|
|
2019-11-21 21:30:50 +01:00
|
|
|
NonCcVariants() bool
|
|
|
|
|
2020-10-02 00:58:11 +02:00
|
|
|
StubsVersions(android.BaseMutatorContext) []string
|
2019-10-18 23:49:46 +02:00
|
|
|
BuildStubs() bool
|
2019-10-18 23:18:45 +02:00
|
|
|
SetBuildStubs()
|
2020-08-19 03:35:15 +02:00
|
|
|
SetStubsVersion(string)
|
2020-02-26 14:45:42 +01:00
|
|
|
StubsVersion() string
|
2020-08-19 03:35:15 +02:00
|
|
|
SetAllStubsVersions([]string)
|
|
|
|
AllStubsVersions() []string
|
2019-10-18 23:49:46 +02:00
|
|
|
HasStubsVariants() bool
|
|
|
|
SelectedStl() string
|
|
|
|
ApiLevel() string
|
2019-10-18 23:18:45 +02:00
|
|
|
|
|
|
|
BuildStaticVariant() bool
|
|
|
|
BuildSharedVariant() bool
|
|
|
|
SetStatic()
|
|
|
|
SetShared()
|
2019-10-18 23:49:46 +02:00
|
|
|
Static() bool
|
|
|
|
Shared() bool
|
|
|
|
Toc() android.OptionalPath
|
|
|
|
|
2020-04-10 05:57:24 +02:00
|
|
|
Host() bool
|
|
|
|
|
2020-01-22 00:53:22 +01:00
|
|
|
InRamdisk() bool
|
|
|
|
OnlyInRamdisk() bool
|
|
|
|
|
2019-10-18 23:49:46 +02:00
|
|
|
InRecovery() bool
|
|
|
|
OnlyInRecovery() bool
|
|
|
|
|
2020-04-07 18:50:32 +02:00
|
|
|
UseSdk() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
UseVndk() bool
|
|
|
|
MustUseVendorVariant() bool
|
|
|
|
IsVndk() bool
|
|
|
|
HasVendorVariant() bool
|
|
|
|
|
|
|
|
SdkVersion() string
|
2020-04-07 18:50:32 +02:00
|
|
|
AlwaysSdk() bool
|
Don't create version variants for SDK variants
When a lib has sdk_version set, an SDK variant and a platform variant
are created by the sdkMutator. Then by the versionMutator, if the
library had 'stubs.versions' property, one or more versioned variants
and one impl variant are created for each of the two (SDK and platform)
variants. As a concrete example,
cc_library {
name: "foo",
sdk_version: "current",
stubs: { versions: ["1", "2"], },
}
would create 6 variants:
1) (sdk: "", version: "")
2) (sdk: "", version: "1")
3) (sdk: "", version: "2")
4) (sdk: "sdk", version: "")
5) (sdk: "sdk", version: "1")
6) (sdk: "sdk", version: "2")
This is somewhat uncessary because the need for the SDK mutator is to
have the platform variant (sdk:"") of a lib where sdk_version is unset,
which actually makes sens for the impl variant (version:""), but not
the versioned variants (version:"1" or version:"2").
This is not only unncessary, but also causes duplicate module
definitions in the Make side when doing an unbundled build. Specifically,
The #1 and #4 above both are emitted to Make and get the same name
"foo".
To fix the problem and not to create unnecessary variants, the versioned
variants are no longer created for the sdk variant. So, foo now has
the following variants only.
1) (sdk: "", version: "") // not emitted to Make (by versionMutator)
2) (sdk: "", version: "1") // not emitted to Make (by versionMutator)
3) (sdk: "", version: "2") // emitted to Make (by versionMutator)
4) (sdk: "sdk", version: "") // not emitted to Make (by versionMutator)
Bug: 159106705
Test: Add sdk_version:"minimum" to libnativehelper in libnativehelper/Android.bp.
m SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true libnativehelper
Change-Id: I6f02f4189e5504286174ccff1642166da82d00c9
2020-06-16 14:58:53 +02:00
|
|
|
IsSdkVariant() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
|
|
|
|
ToolchainLibrary() bool
|
|
|
|
NdkPrebuiltStl() bool
|
|
|
|
StubDecorator() bool
|
2020-10-01 22:37:16 +02:00
|
|
|
|
|
|
|
SplitPerApiLevel() bool
|
2019-10-18 23:18:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2020-07-28 06:26:48 +02:00
|
|
|
CrtBeginDepTag = dependencyTag{name: "crtbegin"}
|
|
|
|
CrtEndDepTag = dependencyTag{name: "crtend"}
|
|
|
|
CoverageDepTag = dependencyTag{name: "coverage"}
|
|
|
|
)
|
2019-10-18 23:18:45 +02:00
|
|
|
|
2020-07-28 06:26:48 +02:00
|
|
|
func SharedDepTag() blueprint.DependencyTag {
|
|
|
|
return libraryDependencyTag{Kind: sharedLibraryDependency}
|
|
|
|
}
|
shared_lib dependency from a static lib crosses the APEX boundary
cc_library_static {
name: "libfoo",
shared_libs: ["libbar"],
}
cc_library {
name: "libbar",
}
If libfoo is part of an APEX, then libbar is no longer considered as a
member of the APEX, because it isn't actually linked to libfoo.
To distinguish such a shared lib dependency from a static library from a
shared lib dependency from a shared library, a new dep type
SharedFromStaticDepTag is introduced. It is treated exactly the same as
SharedDepTag, except when we determine whether a dependency is crossing
the APEX boundary or not.
This allows us to check the apex_available property more correctly.
Previously, modules were incorrectly considered as being used for an
APEX due to the shared lib dependency from a static lib.
As a good side effect, this also reduces the number of APEX variants.
Specifically, on aosp_arm64, the number of the generated modules were
reduced from 44745 to 44180.
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 147671264
Test: m
Merged-In: I899ccb9eae1574effef77ca1bc3a0df145983861
(cherry picked from commit 931b676a69c092451ed25a5dda67accf90ce6457)
Change-Id: I899ccb9eae1574effef77ca1bc3a0df145983861
2020-01-16 09:14:23 +01:00
|
|
|
|
2020-07-28 06:26:48 +02:00
|
|
|
func StaticDepTag() blueprint.DependencyTag {
|
|
|
|
return libraryDependencyTag{Kind: staticLibraryDependency}
|
|
|
|
}
|
2020-09-18 23:15:30 +02:00
|
|
|
|
|
|
|
type SharedLibraryInfo struct {
|
|
|
|
SharedLibrary android.Path
|
|
|
|
UnstrippedSharedLibrary android.Path
|
|
|
|
|
|
|
|
TableOfContents android.OptionalPath
|
|
|
|
CoverageSharedLibrary android.OptionalPath
|
|
|
|
|
|
|
|
StaticAnalogue *StaticLibraryInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{})
|
|
|
|
|
|
|
|
type SharedLibraryImplementationStubsInfo struct {
|
|
|
|
SharedLibraryStubsInfos []SharedLibraryStubsInfo
|
|
|
|
|
|
|
|
IsLLNDK bool
|
|
|
|
}
|
|
|
|
|
|
|
|
var SharedLibraryImplementationStubsInfoProvider = blueprint.NewProvider(SharedLibraryImplementationStubsInfo{})
|
|
|
|
|
|
|
|
type SharedLibraryStubsInfo struct {
|
|
|
|
Version string
|
|
|
|
SharedLibraryInfo SharedLibraryInfo
|
|
|
|
FlagExporterInfo FlagExporterInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
var SharedLibraryStubsInfoProvider = blueprint.NewProvider(SharedLibraryStubsInfo{})
|
|
|
|
|
|
|
|
type StaticLibraryInfo struct {
|
|
|
|
StaticLibrary android.Path
|
|
|
|
Objects Objects
|
|
|
|
ReuseObjects Objects
|
|
|
|
|
|
|
|
// This isn't the actual transitive DepSet, shared library dependencies have been
|
|
|
|
// converted into static library analogues. It is only used to order the static
|
|
|
|
// library dependencies that were specified for the current module.
|
|
|
|
TransitiveStaticLibrariesForOrdering *android.DepSet
|
|
|
|
}
|
|
|
|
|
|
|
|
var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{})
|
|
|
|
|
|
|
|
type FlagExporterInfo struct {
|
|
|
|
IncludeDirs android.Paths
|
|
|
|
SystemIncludeDirs android.Paths
|
|
|
|
Flags []string
|
|
|
|
Deps android.Paths
|
|
|
|
GeneratedHeaders android.Paths
|
|
|
|
}
|
|
|
|
|
|
|
|
var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{})
|