Merge "Dedup code for generating prebuilt_stubs_sources in snapshot"
This commit is contained in:
@@ -1979,25 +1979,27 @@ func (d *Droidstubs) BuildSnapshot(sdkModuleContext android.ModuleContext, build
|
|||||||
snapshotRelativeDir := filepath.Join("java", d.Name()+"_stubs_sources")
|
snapshotRelativeDir := filepath.Join("java", d.Name()+"_stubs_sources")
|
||||||
builder.UnzipToSnapshot(stubsSrcJar, snapshotRelativeDir)
|
builder.UnzipToSnapshot(stubsSrcJar, snapshotRelativeDir)
|
||||||
|
|
||||||
name := d.Name()
|
d.generatePrebuiltStubsSources(builder, snapshotRelativeDir, true)
|
||||||
bp := builder.AndroidBpFile()
|
|
||||||
bp.Printfln("prebuilt_stubs_sources {")
|
|
||||||
bp.Indent()
|
|
||||||
bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
|
|
||||||
bp.Printfln("sdk_member_name: %q,", name)
|
|
||||||
bp.Printfln("srcs: [%q],", snapshotRelativeDir)
|
|
||||||
bp.Dedent()
|
|
||||||
bp.Printfln("}")
|
|
||||||
bp.Printfln("")
|
|
||||||
|
|
||||||
// This module is for the case when the source tree for the unversioned module
|
// This module is for the case when the source tree for the unversioned module
|
||||||
// doesn't exist (i.e. building in an unbundled tree). "prefer:" is set to false
|
// doesn't exist (i.e. building in an unbundled tree). "prefer:" is set to false
|
||||||
// so that this module does not eclipse the unversioned module if it exists.
|
// so that this module does not eclipse the unversioned module if it exists.
|
||||||
|
d.generatePrebuiltStubsSources(builder, snapshotRelativeDir, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Droidstubs) generatePrebuiltStubsSources(builder android.SnapshotBuilder, snapshotRelativeDir string, versioned bool) {
|
||||||
|
bp := builder.AndroidBpFile()
|
||||||
|
name := d.Name()
|
||||||
bp.Printfln("prebuilt_stubs_sources {")
|
bp.Printfln("prebuilt_stubs_sources {")
|
||||||
bp.Indent()
|
bp.Indent()
|
||||||
|
if versioned {
|
||||||
|
bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
|
||||||
|
bp.Printfln("sdk_member_name: %q,", name)
|
||||||
|
} else {
|
||||||
bp.Printfln("name: %q,", name)
|
bp.Printfln("name: %q,", name)
|
||||||
bp.Printfln("srcs: [%q],", snapshotRelativeDir)
|
|
||||||
bp.Printfln("prefer: false,")
|
bp.Printfln("prefer: false,")
|
||||||
|
}
|
||||||
|
bp.Printfln("srcs: [%q],", snapshotRelativeDir)
|
||||||
bp.Dedent()
|
bp.Dedent()
|
||||||
bp.Printfln("}")
|
bp.Printfln("}")
|
||||||
bp.Printfln("")
|
bp.Printfln("")
|
||||||
|
@@ -515,8 +515,8 @@ prebuilt_stubs_sources {
|
|||||||
|
|
||||||
prebuilt_stubs_sources {
|
prebuilt_stubs_sources {
|
||||||
name: "myjavaapistubs",
|
name: "myjavaapistubs",
|
||||||
srcs: ["java/myjavaapistubs_stubs_sources"],
|
|
||||||
prefer: false,
|
prefer: false,
|
||||||
|
srcs: ["java/myjavaapistubs_stubs_sources"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_prebuilt_library_shared {
|
cc_prebuilt_library_shared {
|
||||||
|
Reference in New Issue
Block a user