Merge changes I420a5953,I8e2352f3,I7a6bb905

am: 23be383843

Change-Id: Ie35e110f38405cb018a887274c6099456844c454
This commit is contained in:
Logan Chien 2018-07-18 21:22:24 -07:00 committed by android-build-merger
commit 8847412281
2 changed files with 49 additions and 33 deletions

View file

@ -826,37 +826,40 @@ func pathForModule(ctx ModuleContext) OutputPath {
return PathForOutput(ctx, ".intermediates", ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir()) return PathForOutput(ctx, ".intermediates", ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir())
} }
// PathForVndkRefDump returns an OptionalPath representing the path of the reference // PathForVndkRefAbiDump returns an OptionalPath representing the path of the
// abi dump for the given module. This is not guaranteed to be valid. // reference abi dump for the given module. This is not guaranteed to be valid.
func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string, vndkOrNdk, isSourceDump bool) OptionalPath { func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string,
isLlndk, isGzip bool) OptionalPath {
arches := ctx.DeviceConfig().Arches() arches := ctx.DeviceConfig().Arches()
if len(arches) == 0 {
panic("device build with no primary arch")
}
currentArch := ctx.Arch() currentArch := ctx.Arch()
archNameAndVariant := currentArch.ArchType.String() archNameAndVariant := currentArch.ArchType.String()
if currentArch.ArchVariant != "" { if currentArch.ArchVariant != "" {
archNameAndVariant += "_" + currentArch.ArchVariant archNameAndVariant += "_" + currentArch.ArchVariant
} }
var sourceOrBinaryDir string
var vndkOrNdkDir string var dirName string
var ext string if isLlndk {
if isSourceDump { dirName = "ndk"
ext = ".lsdump.gz"
sourceOrBinaryDir = "source-based"
} else { } else {
ext = ".bdump.gz" dirName = "vndk"
sourceOrBinaryDir = "binary-based"
}
if vndkOrNdk {
vndkOrNdkDir = "vndk"
} else {
vndkOrNdkDir = "ndk"
}
if len(arches) == 0 {
panic("device build with no primary arch")
} }
binderBitness := ctx.DeviceConfig().BinderBitness() binderBitness := ctx.DeviceConfig().BinderBitness()
refDumpFileStr := "prebuilts/abi-dumps/" + vndkOrNdkDir + "/" + version + "/" + binderBitness + "/" +
archNameAndVariant + "/" + sourceOrBinaryDir + "/" + fileName + ext var ext string
return ExistentPathForSource(ctx, refDumpFileStr) if isGzip {
ext = ".lsdump.gz"
} else {
ext = ".lsdump"
}
return ExistentPathForSource(ctx, "prebuilts", "abi-dumps", dirName,
version, binderBitness, archNameAndVariant, "source-based",
fileName+ext)
} }
// PathForModuleOut returns a Path representing the paths... under the module's // PathForModuleOut returns a Path representing the paths... under the module's

View file

@ -631,6 +631,27 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
return ret return ret
} }
func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path {
isLlndk := inList(ctx.baseModuleName(), llndkLibraries)
refAbiDumpTextFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndk, false)
refAbiDumpGzipFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndk, true)
if refAbiDumpTextFile.Valid() {
if refAbiDumpGzipFile.Valid() {
ctx.ModuleErrorf(
"Two reference ABI dump files are found: %q and %q. Please delete the stale one.",
refAbiDumpTextFile, refAbiDumpGzipFile)
return nil
}
return refAbiDumpTextFile.Path()
}
if refAbiDumpGzipFile.Valid() {
return UnzipRefDump(ctx, refAbiDumpGzipFile.Path(), fileName)
}
return nil
}
func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) { func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
if len(objs.sAbiDumpFiles) > 0 && ctx.shouldCreateVndkSourceAbiDump() { if len(objs.sAbiDumpFiles) > 0 && ctx.shouldCreateVndkSourceAbiDump() {
vndkVersion := ctx.DeviceConfig().PlatformVndkVersion() vndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
@ -649,22 +670,14 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ") exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags) library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags)
refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, vndkVsNdk(ctx), true) refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
if refSourceDumpFile.Valid() { if refAbiDumpFile != nil {
unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName)
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
unzippedRefDump, fileName, exportedHeaderFlags, ctx.isVndkExt()) refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isVndkExt())
} }
} }
} }
func vndkVsNdk(ctx ModuleContext) bool {
if inList(ctx.baseModuleName(), llndkLibraries) {
return false
}
return true
}
func (library *libraryDecorator) link(ctx ModuleContext, func (library *libraryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path { flags Flags, deps PathDeps, objs Objects) android.Path {