Remove support for droidstubs in sdk/module_exports
The droidstubs support in sdk/module_exports was a temporary measure to work around the fact that some APIs were being defined by direct use of droidstubs instead of java_sdk_library. This change removes that support as those APIs have all been switched from droidstubs to use java_sdk_library so droidstubs support is no longer needed. Bug: 168301990 Test: m nothing Change-Id: I3517bed29b030438a0423a6cb8c248992a988222
This commit is contained in:
parent
37fa489a9e
commit
a3cb6cf2e5
|
@ -19,7 +19,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
@ -30,16 +29,6 @@ import (
|
|||
func init() {
|
||||
RegisterDocsBuildComponents(android.InitRegistrationContext)
|
||||
RegisterStubsBuildComponents(android.InitRegistrationContext)
|
||||
|
||||
// Register sdk member type.
|
||||
android.RegisterSdkMemberType(&droidStubsSdkMemberType{
|
||||
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
||||
PropertyName: "stubs_sources",
|
||||
// stubs_sources can be used with sdk to provide the source stubs for APIs provided by
|
||||
// the APEX.
|
||||
SupportsSdk: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func RegisterDocsBuildComponents(ctx android.RegistrationContext) {
|
||||
|
@ -1829,47 +1818,3 @@ func PrebuiltStubsSourcesFactory() android.Module {
|
|||
InitDroiddocModule(module, android.HostAndDeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
||||
type droidStubsSdkMemberType struct {
|
||||
android.SdkMemberTypeBase
|
||||
}
|
||||
|
||||
func (mt *droidStubsSdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
||||
mctx.AddVariationDependencies(nil, dependencyTag, names...)
|
||||
}
|
||||
|
||||
func (mt *droidStubsSdkMemberType) IsInstance(module android.Module) bool {
|
||||
_, ok := module.(*Droidstubs)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (mt *droidStubsSdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
|
||||
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_stubs_sources")
|
||||
}
|
||||
|
||||
func (mt *droidStubsSdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
|
||||
return &droidStubsInfoProperties{}
|
||||
}
|
||||
|
||||
type droidStubsInfoProperties struct {
|
||||
android.SdkMemberPropertiesBase
|
||||
|
||||
StubsSrcJar android.Path
|
||||
}
|
||||
|
||||
func (p *droidStubsInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
||||
droidstubs := variant.(*Droidstubs)
|
||||
p.StubsSrcJar = droidstubs.stubsSrcJar
|
||||
}
|
||||
|
||||
func (p *droidStubsInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||
if p.StubsSrcJar != nil {
|
||||
builder := ctx.SnapshotBuilder()
|
||||
|
||||
snapshotRelativeDir := filepath.Join("java", ctx.Name()+"_stubs_sources")
|
||||
|
||||
builder.UnzipToSnapshot(p.StubsSrcJar, snapshotRelativeDir)
|
||||
|
||||
propertySet.AddProperty("srcs", []string{snapshotRelativeDir})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,148 +619,6 @@ module_exports_snapshot {
|
|||
)
|
||||
}
|
||||
|
||||
func testSdkWithDroidstubs(t *testing.T, bp string) *testSdkResult {
|
||||
t.Helper()
|
||||
|
||||
fs := map[string][]byte{
|
||||
"foo/bar/Foo.java": nil,
|
||||
"stubs-sources/foo/bar/Foo.java": nil,
|
||||
}
|
||||
return testSdkWithFs(t, bp, fs)
|
||||
}
|
||||
|
||||
// Note: This test does not verify that a droidstubs can be referenced, either
|
||||
// directly or indirectly from an APEX as droidstubs can never be a part of an
|
||||
// apex.
|
||||
func TestBasicSdkWithDroidstubs(t *testing.T) {
|
||||
testSdkWithDroidstubs(t, `
|
||||
sdk {
|
||||
name: "mysdk",
|
||||
stubs_sources: ["mystub"],
|
||||
}
|
||||
sdk_snapshot {
|
||||
name: "mysdk@10",
|
||||
stubs_sources: ["mystub_mysdk@10"],
|
||||
}
|
||||
prebuilt_stubs_sources {
|
||||
name: "mystub_mysdk@10",
|
||||
sdk_member_name: "mystub",
|
||||
srcs: ["stubs-sources/foo/bar/Foo.java"],
|
||||
}
|
||||
droidstubs {
|
||||
name: "mystub",
|
||||
srcs: ["foo/bar/Foo.java"],
|
||||
sdk_version: "none",
|
||||
system_modules: "none",
|
||||
}
|
||||
java_library {
|
||||
name: "myjavalib",
|
||||
srcs: [":mystub"],
|
||||
sdk_version: "none",
|
||||
system_modules: "none",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestSnapshotWithDroidstubs(t *testing.T) {
|
||||
result := testSdkWithDroidstubs(t, `
|
||||
module_exports {
|
||||
name: "myexports",
|
||||
stubs_sources: ["myjavaapistubs"],
|
||||
}
|
||||
|
||||
droidstubs {
|
||||
name: "myjavaapistubs",
|
||||
srcs: ["foo/bar/Foo.java"],
|
||||
system_modules: "none",
|
||||
sdk_version: "none",
|
||||
}
|
||||
`)
|
||||
|
||||
result.CheckSnapshot("myexports", "",
|
||||
checkAndroidBpContents(`
|
||||
// This is auto-generated. DO NOT EDIT.
|
||||
|
||||
prebuilt_stubs_sources {
|
||||
name: "myexports_myjavaapistubs@current",
|
||||
sdk_member_name: "myjavaapistubs",
|
||||
visibility: ["//visibility:public"],
|
||||
srcs: ["java/myjavaapistubs_stubs_sources"],
|
||||
}
|
||||
|
||||
prebuilt_stubs_sources {
|
||||
name: "myjavaapistubs",
|
||||
prefer: false,
|
||||
visibility: ["//visibility:public"],
|
||||
srcs: ["java/myjavaapistubs_stubs_sources"],
|
||||
}
|
||||
|
||||
module_exports_snapshot {
|
||||
name: "myexports@current",
|
||||
visibility: ["//visibility:public"],
|
||||
stubs_sources: ["myexports_myjavaapistubs@current"],
|
||||
}
|
||||
|
||||
`),
|
||||
checkAllCopyRules(""),
|
||||
checkMergeZips(".intermediates/myexports/common_os/tmp/java/myjavaapistubs_stubs_sources.zip"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestHostSnapshotWithDroidstubs(t *testing.T) {
|
||||
result := testSdkWithDroidstubs(t, `
|
||||
module_exports {
|
||||
name: "myexports",
|
||||
device_supported: false,
|
||||
host_supported: true,
|
||||
stubs_sources: ["myjavaapistubs"],
|
||||
}
|
||||
|
||||
droidstubs {
|
||||
name: "myjavaapistubs",
|
||||
device_supported: false,
|
||||
host_supported: true,
|
||||
srcs: ["foo/bar/Foo.java"],
|
||||
system_modules: "none",
|
||||
sdk_version: "none",
|
||||
}
|
||||
`)
|
||||
|
||||
result.CheckSnapshot("myexports", "",
|
||||
checkAndroidBpContents(`
|
||||
// This is auto-generated. DO NOT EDIT.
|
||||
|
||||
prebuilt_stubs_sources {
|
||||
name: "myexports_myjavaapistubs@current",
|
||||
sdk_member_name: "myjavaapistubs",
|
||||
visibility: ["//visibility:public"],
|
||||
device_supported: false,
|
||||
host_supported: true,
|
||||
srcs: ["java/myjavaapistubs_stubs_sources"],
|
||||
}
|
||||
|
||||
prebuilt_stubs_sources {
|
||||
name: "myjavaapistubs",
|
||||
prefer: false,
|
||||
visibility: ["//visibility:public"],
|
||||
device_supported: false,
|
||||
host_supported: true,
|
||||
srcs: ["java/myjavaapistubs_stubs_sources"],
|
||||
}
|
||||
|
||||
module_exports_snapshot {
|
||||
name: "myexports@current",
|
||||
visibility: ["//visibility:public"],
|
||||
device_supported: false,
|
||||
host_supported: true,
|
||||
stubs_sources: ["myexports_myjavaapistubs@current"],
|
||||
}
|
||||
`),
|
||||
checkAllCopyRules(""),
|
||||
checkMergeZips(".intermediates/myexports/common_os/tmp/java/myjavaapistubs_stubs_sources.zip"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestSnapshotWithJavaSystemModules(t *testing.T) {
|
||||
result := testSdkWithJava(t, `
|
||||
sdk {
|
||||
|
|
Loading…
Reference in New Issue