Loading android/sdk.go +19 −1 Original line number Diff line number Diff line Loading @@ -677,6 +677,10 @@ type SdkMemberType interface { // SupportedLinkages returns the names of the linkage variants supported by this module. SupportedLinkages() []string // ArePrebuiltsRequired returns true if prebuilts are required in the sdk snapshot, false // otherwise. ArePrebuiltsRequired() bool // AddDependencies adds dependencies from the SDK module to all the module variants the member // type contributes to the SDK. `names` is the list of module names given in the member type // property (as returned by SdkPropertyName()) in the SDK module. The exact set of variants Loading Loading @@ -782,7 +786,12 @@ type SdkMemberTypeBase struct { // If not specified then it is assumed to be available on all targeted build releases. SupportedBuildReleaseSpecification string // Set to true if this must be usable with the sdk/sdk_snapshot module types. Otherwise, it will // only be usable with module_exports/module_exports_snapshots module types. SupportsSdk bool // Set to true if prebuilt host artifacts of this member may be specific to the host OS. Only // applicable to modules where HostSupported() is true. HostOsDependent bool // When set to true UseSourceModuleTypeInSnapshot indicates that the member type creates a source Loading @@ -790,6 +799,11 @@ type SdkMemberTypeBase struct { // code from automatically adding a prefer: true flag. UseSourceModuleTypeInSnapshot bool // Set to proptools.BoolPtr(false) if this member does not generate prebuilts but is only provided // to allow the sdk to gather members from this member's dependencies. If not specified then // defaults to true. PrebuiltsRequired *bool // The list of supported traits. Traits []SdkMemberTrait } Loading @@ -814,6 +828,10 @@ func (b *SdkMemberTypeBase) IsHostOsDependent() bool { return b.HostOsDependent } func (b *SdkMemberTypeBase) ArePrebuiltsRequired() bool { return proptools.BoolDefault(b.PrebuiltsRequired, true) } func (b *SdkMemberTypeBase) UsesSourceModuleTypeInSnapshot() bool { return b.UseSourceModuleTypeInSnapshot } Loading apex/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ bootstrap_go_package { srcs: [ "androidmk.go", "apex.go", "apex_sdk_member.go", "apex_singleton.go", "builder.go", "constants.go", Loading apex/apex.go +15 −2 Original line number Diff line number Diff line Loading @@ -606,6 +606,18 @@ type dependencyTag struct { // replacement. This is needed because some prebuilt modules do not provide all the information // needed by the apex. sourceOnly bool // If not-nil and an APEX is a member of an SDK then dependencies of that APEX with this tag will // also be added as exported members of that SDK. memberType android.SdkMemberType } func (d *dependencyTag) SdkMemberType(_ android.Module) android.SdkMemberType { return d.memberType } func (d *dependencyTag) ExportMember() bool { return true } func (d *dependencyTag) String() string { Loading @@ -617,6 +629,7 @@ func (d *dependencyTag) ReplaceSourceWithPrebuilt() bool { } var _ android.ReplaceSourceWithPrebuilt = &dependencyTag{} var _ android.SdkMemberDependencyTag = &dependencyTag{} var ( androidAppTag = &dependencyTag{name: "androidApp", payload: true} Loading @@ -624,8 +637,8 @@ var ( certificateTag = &dependencyTag{name: "certificate"} executableTag = &dependencyTag{name: "executable", payload: true} fsTag = &dependencyTag{name: "filesystem", payload: true} bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true} sscpfTag = &dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true} bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true, memberType: java.BootclasspathFragmentSdkMemberType} sscpfTag = &dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true, memberType: java.SystemServerClasspathFragmentSdkMemberType} compatConfigTag = &dependencyTag{name: "compatConfig", payload: true, sourceOnly: true} javaLibTag = &dependencyTag{name: "javaLib", payload: true} jniLibTag = &dependencyTag{name: "jniLib", payload: true} Loading apex/apex_sdk_member.go 0 → 100644 +58 −0 Original line number Diff line number Diff line // Copyright (C) 2022 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 apex import ( "android/soong/android" "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) // This file contains support for using apex modules within an sdk. func init() { // Register sdk member types. android.RegisterSdkMemberType(&apexSdkMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "apexes", SupportsSdk: true, // The apexes property does not need to be included in the snapshot as adding an apex to an // sdk does not produce any prebuilts of the apex. PrebuiltsRequired: proptools.BoolPtr(false), }, }) } type apexSdkMemberType struct { android.SdkMemberTypeBase } func (mt *apexSdkMemberType) AddDependencies(ctx android.SdkDependencyContext, dependencyTag blueprint.DependencyTag, names []string) { ctx.AddVariationDependencies(nil, dependencyTag, names...) } func (mt *apexSdkMemberType) IsInstance(module android.Module) bool { _, ok := module.(*apexBundle) return ok } func (mt *apexSdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule { panic("Sdk does not create prebuilts of the apexes in its snapshot") } func (mt *apexSdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties { panic("Sdk does not create prebuilts of the apexes in its snapshot") } java/bootclasspath_fragment.go +10 −6 Original line number Diff line number Diff line Loading @@ -32,12 +32,7 @@ import ( func init() { registerBootclasspathFragmentBuildComponents(android.InitRegistrationContext) android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "bootclasspath_fragments", SupportsSdk: true, }, }) android.RegisterSdkMemberType(BootclasspathFragmentSdkMemberType) } func registerBootclasspathFragmentBuildComponents(ctx android.RegistrationContext) { Loading @@ -46,6 +41,15 @@ func registerBootclasspathFragmentBuildComponents(ctx android.RegistrationContex ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootclasspathFragmentFactory) } // BootclasspathFragmentSdkMemberType is the member type used to add bootclasspath_fragments to // the SDK snapshot. It is exported for use by apex. var BootclasspathFragmentSdkMemberType = &bootclasspathFragmentMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "bootclasspath_fragments", SupportsSdk: true, }, } type bootclasspathFragmentContentDependencyTag struct { blueprint.BaseDependencyTag } Loading Loading
android/sdk.go +19 −1 Original line number Diff line number Diff line Loading @@ -677,6 +677,10 @@ type SdkMemberType interface { // SupportedLinkages returns the names of the linkage variants supported by this module. SupportedLinkages() []string // ArePrebuiltsRequired returns true if prebuilts are required in the sdk snapshot, false // otherwise. ArePrebuiltsRequired() bool // AddDependencies adds dependencies from the SDK module to all the module variants the member // type contributes to the SDK. `names` is the list of module names given in the member type // property (as returned by SdkPropertyName()) in the SDK module. The exact set of variants Loading Loading @@ -782,7 +786,12 @@ type SdkMemberTypeBase struct { // If not specified then it is assumed to be available on all targeted build releases. SupportedBuildReleaseSpecification string // Set to true if this must be usable with the sdk/sdk_snapshot module types. Otherwise, it will // only be usable with module_exports/module_exports_snapshots module types. SupportsSdk bool // Set to true if prebuilt host artifacts of this member may be specific to the host OS. Only // applicable to modules where HostSupported() is true. HostOsDependent bool // When set to true UseSourceModuleTypeInSnapshot indicates that the member type creates a source Loading @@ -790,6 +799,11 @@ type SdkMemberTypeBase struct { // code from automatically adding a prefer: true flag. UseSourceModuleTypeInSnapshot bool // Set to proptools.BoolPtr(false) if this member does not generate prebuilts but is only provided // to allow the sdk to gather members from this member's dependencies. If not specified then // defaults to true. PrebuiltsRequired *bool // The list of supported traits. Traits []SdkMemberTrait } Loading @@ -814,6 +828,10 @@ func (b *SdkMemberTypeBase) IsHostOsDependent() bool { return b.HostOsDependent } func (b *SdkMemberTypeBase) ArePrebuiltsRequired() bool { return proptools.BoolDefault(b.PrebuiltsRequired, true) } func (b *SdkMemberTypeBase) UsesSourceModuleTypeInSnapshot() bool { return b.UseSourceModuleTypeInSnapshot } Loading
apex/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ bootstrap_go_package { srcs: [ "androidmk.go", "apex.go", "apex_sdk_member.go", "apex_singleton.go", "builder.go", "constants.go", Loading
apex/apex.go +15 −2 Original line number Diff line number Diff line Loading @@ -606,6 +606,18 @@ type dependencyTag struct { // replacement. This is needed because some prebuilt modules do not provide all the information // needed by the apex. sourceOnly bool // If not-nil and an APEX is a member of an SDK then dependencies of that APEX with this tag will // also be added as exported members of that SDK. memberType android.SdkMemberType } func (d *dependencyTag) SdkMemberType(_ android.Module) android.SdkMemberType { return d.memberType } func (d *dependencyTag) ExportMember() bool { return true } func (d *dependencyTag) String() string { Loading @@ -617,6 +629,7 @@ func (d *dependencyTag) ReplaceSourceWithPrebuilt() bool { } var _ android.ReplaceSourceWithPrebuilt = &dependencyTag{} var _ android.SdkMemberDependencyTag = &dependencyTag{} var ( androidAppTag = &dependencyTag{name: "androidApp", payload: true} Loading @@ -624,8 +637,8 @@ var ( certificateTag = &dependencyTag{name: "certificate"} executableTag = &dependencyTag{name: "executable", payload: true} fsTag = &dependencyTag{name: "filesystem", payload: true} bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true} sscpfTag = &dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true} bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true, memberType: java.BootclasspathFragmentSdkMemberType} sscpfTag = &dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true, memberType: java.SystemServerClasspathFragmentSdkMemberType} compatConfigTag = &dependencyTag{name: "compatConfig", payload: true, sourceOnly: true} javaLibTag = &dependencyTag{name: "javaLib", payload: true} jniLibTag = &dependencyTag{name: "jniLib", payload: true} Loading
apex/apex_sdk_member.go 0 → 100644 +58 −0 Original line number Diff line number Diff line // Copyright (C) 2022 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 apex import ( "android/soong/android" "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) // This file contains support for using apex modules within an sdk. func init() { // Register sdk member types. android.RegisterSdkMemberType(&apexSdkMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "apexes", SupportsSdk: true, // The apexes property does not need to be included in the snapshot as adding an apex to an // sdk does not produce any prebuilts of the apex. PrebuiltsRequired: proptools.BoolPtr(false), }, }) } type apexSdkMemberType struct { android.SdkMemberTypeBase } func (mt *apexSdkMemberType) AddDependencies(ctx android.SdkDependencyContext, dependencyTag blueprint.DependencyTag, names []string) { ctx.AddVariationDependencies(nil, dependencyTag, names...) } func (mt *apexSdkMemberType) IsInstance(module android.Module) bool { _, ok := module.(*apexBundle) return ok } func (mt *apexSdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule { panic("Sdk does not create prebuilts of the apexes in its snapshot") } func (mt *apexSdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties { panic("Sdk does not create prebuilts of the apexes in its snapshot") }
java/bootclasspath_fragment.go +10 −6 Original line number Diff line number Diff line Loading @@ -32,12 +32,7 @@ import ( func init() { registerBootclasspathFragmentBuildComponents(android.InitRegistrationContext) android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "bootclasspath_fragments", SupportsSdk: true, }, }) android.RegisterSdkMemberType(BootclasspathFragmentSdkMemberType) } func registerBootclasspathFragmentBuildComponents(ctx android.RegistrationContext) { Loading @@ -46,6 +41,15 @@ func registerBootclasspathFragmentBuildComponents(ctx android.RegistrationContex ctx.RegisterModuleType("prebuilt_bootclasspath_fragment", prebuiltBootclasspathFragmentFactory) } // BootclasspathFragmentSdkMemberType is the member type used to add bootclasspath_fragments to // the SDK snapshot. It is exported for use by apex. var BootclasspathFragmentSdkMemberType = &bootclasspathFragmentMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ PropertyName: "bootclasspath_fragments", SupportsSdk: true, }, } type bootclasspathFragmentContentDependencyTag struct { blueprint.BaseDependencyTag } Loading