Dedup code for generating java_import in snapshot am: 50e7900744
am: 82b6fe6f2c
am: bf88789520
Change-Id: Iddbe068271e82603584cbca4ed19bb95f6bd9d90
This commit is contained in:
26
java/java.go
26
java/java.go
@@ -1691,25 +1691,27 @@ func (j *Library) BuildSnapshot(sdkModuleContext android.ModuleContext, builder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
name := j.Name()
|
j.generateJavaImport(builder, snapshotRelativeJavaLibPath, true)
|
||||||
bp := builder.AndroidBpFile()
|
|
||||||
bp.Printfln("java_import {")
|
|
||||||
bp.Indent()
|
|
||||||
bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
|
|
||||||
bp.Printfln("sdk_member_name: %q,", name)
|
|
||||||
bp.Printfln("jars: [%q],", snapshotRelativeJavaLibPath)
|
|
||||||
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.
|
||||||
|
j.generateJavaImport(builder, snapshotRelativeJavaLibPath, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *Library) generateJavaImport(builder android.SnapshotBuilder, snapshotRelativeJavaLibPath string, versioned bool) {
|
||||||
|
bp := builder.AndroidBpFile()
|
||||||
|
name := j.Name()
|
||||||
bp.Printfln("java_import {")
|
bp.Printfln("java_import {")
|
||||||
bp.Indent()
|
bp.Indent()
|
||||||
bp.Printfln("name: %q,", name)
|
if versioned {
|
||||||
|
bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
|
||||||
|
bp.Printfln("sdk_member_name: %q,", name)
|
||||||
|
} else {
|
||||||
|
bp.Printfln("name: %q,", name)
|
||||||
|
bp.Printfln("prefer: false,")
|
||||||
|
}
|
||||||
bp.Printfln("jars: [%q],", snapshotRelativeJavaLibPath)
|
bp.Printfln("jars: [%q],", snapshotRelativeJavaLibPath)
|
||||||
bp.Printfln("prefer: false,")
|
|
||||||
bp.Dedent()
|
bp.Dedent()
|
||||||
bp.Printfln("}")
|
bp.Printfln("}")
|
||||||
bp.Printfln("")
|
bp.Printfln("")
|
||||||
|
Reference in New Issue
Block a user