Merge changes I4c8cd544,I62d4d43d,I0ae667d4,Id357adc0,I1ff87134
* changes: Don't create version variations of sdk modules Create fewer empty version variants Don't make SplitPerApiLevel imply UseSdk Remove vendor crt special case Fix apex_test.go and add it to Android.bp
This commit is contained in:
commit
ac0cd89283
|
@ -63,6 +63,7 @@ bootstrap_go_package {
|
||||||
testSrcs: [
|
testSrcs: [
|
||||||
"android_test.go",
|
"android_test.go",
|
||||||
"androidmk_test.go",
|
"androidmk_test.go",
|
||||||
|
"apex_test.go",
|
||||||
"arch_test.go",
|
"arch_test.go",
|
||||||
"config_test.go",
|
"config_test.go",
|
||||||
"csuite_config_test.go",
|
"csuite_config_test.go",
|
||||||
|
|
|
@ -42,7 +42,7 @@ type ApexInfo struct {
|
||||||
InApexes []string
|
InApexes []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i ApexInfo) mergedName(ctx EarlyModuleContext) string {
|
func (i ApexInfo) mergedName(ctx PathContext) string {
|
||||||
name := "apex" + strconv.Itoa(i.MinSdkVersion(ctx).FinalOrFutureInt())
|
name := "apex" + strconv.Itoa(i.MinSdkVersion(ctx).FinalOrFutureInt())
|
||||||
for _, sdk := range i.RequiredSdks {
|
for _, sdk := range i.RequiredSdks {
|
||||||
name += "_" + sdk.Name + "_" + sdk.Version
|
name += "_" + sdk.Name + "_" + sdk.Version
|
||||||
|
@ -50,7 +50,7 @@ func (i ApexInfo) mergedName(ctx EarlyModuleContext) string {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ApexInfo) MinSdkVersion(ctx EarlyModuleContext) ApiLevel {
|
func (this *ApexInfo) MinSdkVersion(ctx PathContext) ApiLevel {
|
||||||
return ApiLevelOrPanic(ctx, this.MinSdkVersionStr)
|
return ApiLevelOrPanic(ctx, this.MinSdkVersionStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ func (a byApexName) Less(i, j int) bool { return a[i].ApexVariationName < a[j].A
|
||||||
// mergeApexVariations deduplicates APEX variations that would build identically into a common
|
// mergeApexVariations deduplicates APEX variations that would build identically into a common
|
||||||
// variation. It returns the reduced list of variations and a list of aliases from the original
|
// variation. It returns the reduced list of variations and a list of aliases from the original
|
||||||
// variation names to the new variation names.
|
// variation names to the new variation names.
|
||||||
func mergeApexVariations(ctx EarlyModuleContext, apexVariations []ApexInfo) (merged []ApexInfo, aliases [][2]string) {
|
func mergeApexVariations(ctx PathContext, apexVariations []ApexInfo) (merged []ApexInfo, aliases [][2]string) {
|
||||||
sort.Sort(byApexName(apexVariations))
|
sort.Sort(byApexName(apexVariations))
|
||||||
seen := make(map[string]int)
|
seen := make(map[string]int)
|
||||||
for _, apexInfo := range apexVariations {
|
for _, apexInfo := range apexVariations {
|
||||||
|
|
|
@ -29,10 +29,10 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "single",
|
name: "single",
|
||||||
in: []ApexInfo{
|
in: []ApexInfo{
|
||||||
{"foo", 10000, false, nil, []string{"foo"}},
|
{"foo", "current", false, nil, []string{"foo"}},
|
||||||
},
|
},
|
||||||
wantMerged: []ApexInfo{
|
wantMerged: []ApexInfo{
|
||||||
{"apex10000", 10000, false, nil, []string{"foo"}},
|
{"apex10000", "current", false, nil, []string{"foo"}},
|
||||||
},
|
},
|
||||||
wantAliases: [][2]string{
|
wantAliases: [][2]string{
|
||||||
{"foo", "apex10000"},
|
{"foo", "apex10000"},
|
||||||
|
@ -41,11 +41,11 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "merge",
|
name: "merge",
|
||||||
in: []ApexInfo{
|
in: []ApexInfo{
|
||||||
{"foo", 10000, false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
{"foo", "current", false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
||||||
{"bar", 10000, false, SdkRefs{{"baz", "1"}}, []string{"bar"}},
|
{"bar", "current", false, SdkRefs{{"baz", "1"}}, []string{"bar"}},
|
||||||
},
|
},
|
||||||
wantMerged: []ApexInfo{
|
wantMerged: []ApexInfo{
|
||||||
{"apex10000_baz_1", 10000, false, SdkRefs{{"baz", "1"}}, []string{"bar", "foo"}},
|
{"apex10000_baz_1", "current", false, SdkRefs{{"baz", "1"}}, []string{"bar", "foo"}},
|
||||||
},
|
},
|
||||||
wantAliases: [][2]string{
|
wantAliases: [][2]string{
|
||||||
{"bar", "apex10000_baz_1"},
|
{"bar", "apex10000_baz_1"},
|
||||||
|
@ -55,12 +55,12 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "don't merge version",
|
name: "don't merge version",
|
||||||
in: []ApexInfo{
|
in: []ApexInfo{
|
||||||
{"foo", 10000, false, nil, []string{"foo"}},
|
{"foo", "current", false, nil, []string{"foo"}},
|
||||||
{"bar", 30, false, nil, []string{"bar"}},
|
{"bar", "30", false, nil, []string{"bar"}},
|
||||||
},
|
},
|
||||||
wantMerged: []ApexInfo{
|
wantMerged: []ApexInfo{
|
||||||
{"apex30", 30, false, nil, []string{"bar"}},
|
{"apex30", "30", false, nil, []string{"bar"}},
|
||||||
{"apex10000", 10000, false, nil, []string{"foo"}},
|
{"apex10000", "current", false, nil, []string{"foo"}},
|
||||||
},
|
},
|
||||||
wantAliases: [][2]string{
|
wantAliases: [][2]string{
|
||||||
{"bar", "apex30"},
|
{"bar", "apex30"},
|
||||||
|
@ -70,11 +70,11 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "merge updatable",
|
name: "merge updatable",
|
||||||
in: []ApexInfo{
|
in: []ApexInfo{
|
||||||
{"foo", 10000, false, nil, []string{"foo"}},
|
{"foo", "current", false, nil, []string{"foo"}},
|
||||||
{"bar", 10000, true, nil, []string{"bar"}},
|
{"bar", "current", true, nil, []string{"bar"}},
|
||||||
},
|
},
|
||||||
wantMerged: []ApexInfo{
|
wantMerged: []ApexInfo{
|
||||||
{"apex10000", 10000, true, nil, []string{"bar", "foo"}},
|
{"apex10000", "current", true, nil, []string{"bar", "foo"}},
|
||||||
},
|
},
|
||||||
wantAliases: [][2]string{
|
wantAliases: [][2]string{
|
||||||
{"bar", "apex10000"},
|
{"bar", "apex10000"},
|
||||||
|
@ -84,12 +84,12 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "don't merge sdks",
|
name: "don't merge sdks",
|
||||||
in: []ApexInfo{
|
in: []ApexInfo{
|
||||||
{"foo", 10000, false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
{"foo", "current", false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
||||||
{"bar", 10000, false, SdkRefs{{"baz", "2"}}, []string{"bar"}},
|
{"bar", "current", false, SdkRefs{{"baz", "2"}}, []string{"bar"}},
|
||||||
},
|
},
|
||||||
wantMerged: []ApexInfo{
|
wantMerged: []ApexInfo{
|
||||||
{"apex10000_baz_2", 10000, false, SdkRefs{{"baz", "2"}}, []string{"bar"}},
|
{"apex10000_baz_2", "current", false, SdkRefs{{"baz", "2"}}, []string{"bar"}},
|
||||||
{"apex10000_baz_1", 10000, false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
{"apex10000_baz_1", "current", false, SdkRefs{{"baz", "1"}}, []string{"foo"}},
|
||||||
},
|
},
|
||||||
wantAliases: [][2]string{
|
wantAliases: [][2]string{
|
||||||
{"bar", "apex10000_baz_2"},
|
{"bar", "apex10000_baz_2"},
|
||||||
|
@ -99,7 +99,9 @@ func Test_mergeApexVariations(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
gotMerged, gotAliases := mergeApexVariations(tt.in)
|
config := TestConfig(buildDir, nil, "", nil)
|
||||||
|
ctx := &configErrorWrapper{config: config}
|
||||||
|
gotMerged, gotAliases := mergeApexVariations(ctx, tt.in)
|
||||||
if !reflect.DeepEqual(gotMerged, tt.wantMerged) {
|
if !reflect.DeepEqual(gotMerged, tt.wantMerged) {
|
||||||
t.Errorf("mergeApexVariations() gotMerged = %v, want %v", gotMerged, tt.wantMerged)
|
t.Errorf("mergeApexVariations() gotMerged = %v, want %v", gotMerged, tt.wantMerged)
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ var FirstNonLibAndroidSupportVersion = uncheckedFinalApiLevel(21)
|
||||||
// * "30" -> "30"
|
// * "30" -> "30"
|
||||||
// * "R" -> "30"
|
// * "R" -> "30"
|
||||||
// * "S" -> "S"
|
// * "S" -> "S"
|
||||||
func ReplaceFinalizedCodenames(ctx EarlyModuleContext, raw string) string {
|
func ReplaceFinalizedCodenames(ctx PathContext, raw string) string {
|
||||||
num, ok := getFinalCodenamesMap(ctx.Config())[raw]
|
num, ok := getFinalCodenamesMap(ctx.Config())[raw]
|
||||||
if !ok {
|
if !ok {
|
||||||
return raw
|
return raw
|
||||||
|
@ -175,7 +175,7 @@ func ReplaceFinalizedCodenames(ctx EarlyModuleContext, raw string) string {
|
||||||
//
|
//
|
||||||
// Inputs that are not "current", known previews, or convertible to an integer
|
// Inputs that are not "current", known previews, or convertible to an integer
|
||||||
// will return an error.
|
// will return an error.
|
||||||
func ApiLevelFromUser(ctx EarlyModuleContext, raw string) (ApiLevel, error) {
|
func ApiLevelFromUser(ctx PathContext, raw string) (ApiLevel, error) {
|
||||||
if raw == "" {
|
if raw == "" {
|
||||||
panic("API level string must be non-empty")
|
panic("API level string must be non-empty")
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ func ApiLevelFromUser(ctx EarlyModuleContext, raw string) (ApiLevel, error) {
|
||||||
// Converts an API level string `raw` into an ApiLevel in the same method as
|
// Converts an API level string `raw` into an ApiLevel in the same method as
|
||||||
// `ApiLevelFromUser`, but the input is assumed to have no errors and any errors
|
// `ApiLevelFromUser`, but the input is assumed to have no errors and any errors
|
||||||
// will panic instead of returning an error.
|
// will panic instead of returning an error.
|
||||||
func ApiLevelOrPanic(ctx EarlyModuleContext, raw string) ApiLevel {
|
func ApiLevelOrPanic(ctx PathContext, raw string) ApiLevel {
|
||||||
value, err := ApiLevelFromUser(ctx, raw)
|
value, err := ApiLevelFromUser(ctx, raw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
|
|
|
@ -40,19 +40,14 @@ type binarySdkMemberType struct {
|
||||||
|
|
||||||
func (mt *binarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
func (mt *binarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
||||||
targets := mctx.MultiTargets()
|
targets := mctx.MultiTargets()
|
||||||
for _, lib := range names {
|
for _, bin := range names {
|
||||||
for _, target := range targets {
|
for _, target := range targets {
|
||||||
name, version := StubsLibNameAndVersion(lib)
|
|
||||||
if version == "" {
|
|
||||||
version = "latest"
|
|
||||||
}
|
|
||||||
variations := target.Variations()
|
variations := target.Variations()
|
||||||
if mctx.Device() {
|
if mctx.Device() {
|
||||||
variations = append(variations,
|
variations = append(variations,
|
||||||
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation},
|
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
||||||
blueprint.Variation{Mutator: "version", Variation: version})
|
|
||||||
}
|
}
|
||||||
mctx.AddFarVariationDependencies(variations, dependencyTag, name)
|
mctx.AddFarVariationDependencies(variations, dependencyTag, bin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
cc/cc.go
11
cc/cc.go
|
@ -697,6 +697,9 @@ func (c *Module) MinSdkVersion() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) SplitPerApiLevel() bool {
|
func (c *Module) SplitPerApiLevel() bool {
|
||||||
|
if !c.canUseSdk() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if linker, ok := c.linker.(*objectLinker); ok {
|
if linker, ok := c.linker.(*objectLinker); ok {
|
||||||
return linker.isCrt()
|
return linker.isCrt()
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1029,7 @@ func (c *Module) canUseSdk() bool {
|
||||||
|
|
||||||
func (c *Module) UseSdk() bool {
|
func (c *Module) UseSdk() bool {
|
||||||
if c.canUseSdk() {
|
if c.canUseSdk() {
|
||||||
return String(c.Properties.Sdk_version) != "" || c.SplitPerApiLevel()
|
return String(c.Properties.Sdk_version) != ""
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -1868,7 +1871,7 @@ func (c *Module) addSharedLibDependenciesWithVersions(ctx android.BottomUpMutato
|
||||||
|
|
||||||
variations = append([]blueprint.Variation(nil), variations...)
|
variations = append([]blueprint.Variation(nil), variations...)
|
||||||
|
|
||||||
if version != "" && VersionVariantAvailable(c) {
|
if version != "" && CanBeOrLinkAgainstVersionVariants(c) {
|
||||||
// Version is explicitly specified. i.e. libFoo#30
|
// Version is explicitly specified. i.e. libFoo#30
|
||||||
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
||||||
depTag.explicitlyVersioned = true
|
depTag.explicitlyVersioned = true
|
||||||
|
@ -1883,7 +1886,7 @@ func (c *Module) addSharedLibDependenciesWithVersions(ctx android.BottomUpMutato
|
||||||
// If the version is not specified, add dependency to all stubs libraries.
|
// If the version is not specified, add dependency to all stubs libraries.
|
||||||
// The stubs library will be used when the depending module is built for APEX and
|
// The stubs library will be used when the depending module is built for APEX and
|
||||||
// the dependent module is not in the same APEX.
|
// the dependent module is not in the same APEX.
|
||||||
if version == "" && VersionVariantAvailable(c) {
|
if version == "" && CanBeOrLinkAgainstVersionVariants(c) {
|
||||||
if dep, ok := deps[0].(*Module); ok {
|
if dep, ok := deps[0].(*Module); ok {
|
||||||
for _, ver := range dep.AllStubsVersions() {
|
for _, ver := range dep.AllStubsVersions() {
|
||||||
// Note that depTag.ExplicitlyVersioned is false in this case.
|
// Note that depTag.ExplicitlyVersioned is false in this case.
|
||||||
|
@ -2489,7 +2492,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
|
|
||||||
if ccDep.CcLibrary() && !libDepTag.static() {
|
if ccDep.CcLibrary() && !libDepTag.static() {
|
||||||
depIsStubs := ccDep.BuildStubs()
|
depIsStubs := ccDep.BuildStubs()
|
||||||
depHasStubs := VersionVariantAvailable(c) && ccDep.HasStubsVariants()
|
depHasStubs := CanBeOrLinkAgainstVersionVariants(c) && ccDep.HasStubsVariants()
|
||||||
depInSameApexes := android.DirectlyInAllApexes(c.InApexes(), depName)
|
depInSameApexes := android.DirectlyInAllApexes(c.InApexes(), depName)
|
||||||
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
|
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
|
||||||
|
|
||||||
|
|
|
@ -1541,18 +1541,33 @@ func createVersionVariations(mctx android.BottomUpMutatorContext, versions []str
|
||||||
mctx.CreateAliasVariation("latest", latestVersion)
|
mctx.CreateAliasVariation("latest", latestVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func VersionVariantAvailable(module interface {
|
func CanBeOrLinkAgainstVersionVariants(module interface {
|
||||||
Host() bool
|
Host() bool
|
||||||
InRamdisk() bool
|
InRamdisk() bool
|
||||||
InRecovery() bool
|
InRecovery() bool
|
||||||
|
UseSdk() bool
|
||||||
}) bool {
|
}) bool {
|
||||||
return !module.Host() && !module.InRamdisk() && !module.InRecovery()
|
return !module.Host() && !module.InRamdisk() && !module.InRecovery() && !module.UseSdk()
|
||||||
|
}
|
||||||
|
|
||||||
|
func CanBeVersionVariant(module interface {
|
||||||
|
Host() bool
|
||||||
|
InRamdisk() bool
|
||||||
|
InRecovery() bool
|
||||||
|
UseSdk() bool
|
||||||
|
CcLibraryInterface() bool
|
||||||
|
Shared() bool
|
||||||
|
Static() bool
|
||||||
|
}) bool {
|
||||||
|
return CanBeOrLinkAgainstVersionVariants(module) &&
|
||||||
|
module.CcLibraryInterface() && (module.Shared() || module.Static())
|
||||||
}
|
}
|
||||||
|
|
||||||
// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions,
|
// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions,
|
||||||
// and propagates the value from implementation libraries to llndk libraries with the same name.
|
// and propagates the value from implementation libraries to llndk libraries with the same name.
|
||||||
func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
|
func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
|
||||||
if library, ok := mctx.Module().(LinkableInterface); ok && VersionVariantAvailable(library) {
|
if library, ok := mctx.Module().(LinkableInterface); ok && CanBeVersionVariant(library) {
|
||||||
|
|
||||||
if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 &&
|
if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 &&
|
||||||
!library.IsSdkVariant() {
|
!library.IsSdkVariant() {
|
||||||
|
|
||||||
|
@ -1582,7 +1597,7 @@ func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
|
||||||
// versionMutator splits a module into the mandatory non-stubs variant
|
// versionMutator splits a module into the mandatory non-stubs variant
|
||||||
// (which is unnamed) and zero or more stubs variants.
|
// (which is unnamed) and zero or more stubs variants.
|
||||||
func versionMutator(mctx android.BottomUpMutatorContext) {
|
func versionMutator(mctx android.BottomUpMutatorContext) {
|
||||||
if library, ok := mctx.Module().(LinkableInterface); ok && VersionVariantAvailable(library) {
|
if library, ok := mctx.Module().(LinkableInterface); ok && CanBeVersionVariant(library) {
|
||||||
createVersionVariations(mctx, library.AllStubsVersions())
|
createVersionVariations(mctx, library.AllStubsVersions())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,11 @@ func (mt *librarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorCont
|
||||||
variations := target.Variations()
|
variations := target.Variations()
|
||||||
if mctx.Device() {
|
if mctx.Device() {
|
||||||
variations = append(variations,
|
variations = append(variations,
|
||||||
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation},
|
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
||||||
blueprint.Variation{Mutator: "version", Variation: version})
|
if mt.linkTypes != nil {
|
||||||
|
variations = append(variations,
|
||||||
|
blueprint.Variation{Mutator: "version", Variation: version})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if mt.linkTypes == nil {
|
if mt.linkTypes == nil {
|
||||||
mctx.AddFarVariationDependencies(variations, dependencyTag, name)
|
mctx.AddFarVariationDependencies(variations, dependencyTag, name)
|
||||||
|
|
|
@ -63,6 +63,8 @@ type LinkableInterface interface {
|
||||||
ToolchainLibrary() bool
|
ToolchainLibrary() bool
|
||||||
NdkPrebuiltStl() bool
|
NdkPrebuiltStl() bool
|
||||||
StubDecorator() bool
|
StubDecorator() bool
|
||||||
|
|
||||||
|
SplitPerApiLevel() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -96,11 +96,6 @@ func (object *objectLinker) linkerProps() []interface{} {
|
||||||
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
|
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
|
||||||
|
|
||||||
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
if ctx.useVndk() && ctx.toolchain().Bionic() {
|
|
||||||
// Needed for VNDK builds where bionic headers aren't automatically added.
|
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc")
|
|
||||||
}
|
|
||||||
|
|
||||||
deps.HeaderLibs = append(deps.HeaderLibs, object.Properties.Header_libs...)
|
deps.HeaderLibs = append(deps.HeaderLibs, object.Properties.Header_libs...)
|
||||||
deps.ObjFiles = append(deps.ObjFiles, object.Properties.Objs...)
|
deps.ObjFiles = append(deps.ObjFiles, object.Properties.Objs...)
|
||||||
return deps
|
return deps
|
||||||
|
|
|
@ -32,11 +32,11 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
|
||||||
switch m := ctx.Module().(type) {
|
switch m := ctx.Module().(type) {
|
||||||
case LinkableInterface:
|
case LinkableInterface:
|
||||||
if m.AlwaysSdk() {
|
if m.AlwaysSdk() {
|
||||||
if !m.UseSdk() {
|
if !m.UseSdk() && !m.SplitPerApiLevel() {
|
||||||
ctx.ModuleErrorf("UseSdk() must return true when AlwaysSdk is set, did the factory forget to set Sdk_version?")
|
ctx.ModuleErrorf("UseSdk() must return true when AlwaysSdk is set, did the factory forget to set Sdk_version?")
|
||||||
}
|
}
|
||||||
ctx.CreateVariations("sdk")
|
ctx.CreateVariations("sdk")
|
||||||
} else if m.UseSdk() {
|
} else if m.UseSdk() || m.SplitPerApiLevel() {
|
||||||
modules := ctx.CreateVariations("", "sdk")
|
modules := ctx.CreateVariations("", "sdk")
|
||||||
modules[0].(*Module).Properties.Sdk_version = nil
|
modules[0].(*Module).Properties.Sdk_version = nil
|
||||||
modules[1].(*Module).Properties.IsSdkVariant = true
|
modules[1].(*Module).Properties.IsSdkVariant = true
|
||||||
|
|
12
rust/rust.go
12
rust/rust.go
|
@ -221,6 +221,10 @@ func (mod *Module) IsSdkVariant() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) SplitPerApiLevel() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) ToolchainLibrary() bool {
|
func (mod *Module) ToolchainLibrary() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -995,11 +999,7 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
deps := mod.deps(ctx)
|
deps := mod.deps(ctx)
|
||||||
commonDepVariations := []blueprint.Variation{}
|
var commonDepVariations []blueprint.Variation
|
||||||
if cc.VersionVariantAvailable(mod) {
|
|
||||||
commonDepVariations = append(commonDepVariations,
|
|
||||||
blueprint.Variation{Mutator: "version", Variation: ""})
|
|
||||||
}
|
|
||||||
if !mod.Host() {
|
if !mod.Host() {
|
||||||
commonDepVariations = append(commonDepVariations,
|
commonDepVariations = append(commonDepVariations,
|
||||||
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
||||||
|
@ -1055,7 +1055,7 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
blueprint.Variation{Mutator: "link", Variation: "static"}),
|
blueprint.Variation{Mutator: "link", Variation: "static"}),
|
||||||
cc.StaticDepTag(), deps.StaticLibs...)
|
cc.StaticDepTag(), deps.StaticLibs...)
|
||||||
|
|
||||||
crtVariations := append(cc.GetCrtVariations(ctx, mod), commonDepVariations...)
|
crtVariations := cc.GetCrtVariations(ctx, mod)
|
||||||
if deps.CrtBegin != "" {
|
if deps.CrtBegin != "" {
|
||||||
actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag, deps.CrtBegin)
|
actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag, deps.CrtBegin)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue