Disable installation for sdk snapshot versioned prebuilts
The sdk snapshot creates two prebuilts for each member one that is versioned and one that is not. If they are both installed then they lead to duplicate rules in make for creating the same installed file. This change adds an installable property to cc modules that will prevent the installation of the file and then adds installable: false on the versioned prebuilt for cc modules. Bug: 142935992 Test: m nothing Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
This commit is contained in:
@@ -409,8 +409,19 @@ type propertyTag struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// A BpPropertyTag to add to a property that contains references to other sdk members.
|
||||
//
|
||||
// This will cause the references to be rewritten to a versioned reference in the version
|
||||
// specific instance of a snapshot module.
|
||||
var sdkMemberReferencePropertyTag = propertyTag{"sdkMemberReferencePropertyTag"}
|
||||
|
||||
// A BpPropertyTag that indicates the property should only be present in the versioned
|
||||
// module.
|
||||
//
|
||||
// This will cause the property to be removed from the unversioned instance of a
|
||||
// snapshot module.
|
||||
var sdkVersionedOnlyPropertyTag = propertyTag{"sdkVersionedOnlyPropertyTag"}
|
||||
|
||||
type unversionedToVersionedTransformation struct {
|
||||
identityTransformation
|
||||
builder *snapshotBuilder
|
||||
@@ -452,6 +463,9 @@ func (t unversionedTransformation) transformModule(module *bpModule) *bpModule {
|
||||
func (t unversionedTransformation) transformProperty(name string, value interface{}, tag android.BpPropertyTag) (interface{}, android.BpPropertyTag) {
|
||||
if tag == sdkMemberReferencePropertyTag {
|
||||
return t.builder.unversionedSdkMemberNames(value.([]string)), tag
|
||||
} else if tag == sdkVersionedOnlyPropertyTag {
|
||||
// The property is not allowed in the unversioned module so remove it.
|
||||
return nil, nil
|
||||
} else {
|
||||
return value, tag
|
||||
}
|
||||
@@ -631,6 +645,13 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
|
||||
}
|
||||
}
|
||||
|
||||
// Disable installation in the versioned module of those modules that are ever installable.
|
||||
if installable, ok := variant.(interface{ EverInstallable() bool }); ok {
|
||||
if installable.EverInstallable() {
|
||||
m.AddPropertyWithTag("installable", false, sdkVersionedOnlyPropertyTag)
|
||||
}
|
||||
}
|
||||
|
||||
s.prebuiltModules[name] = m
|
||||
s.prebuiltOrder = append(s.prebuiltOrder, m)
|
||||
return m
|
||||
|
Reference in New Issue
Block a user