diff options
| author | 2020-05-05 17:11:39 +0000 | |
|---|---|---|
| committer | 2020-05-05 17:11:39 +0000 | |
| commit | 39298b3598eae7b5f9fb746fc078abf276a948f0 (patch) | |
| tree | 8fd1d3fea7fe434b551491eb92fad98710c660ac | |
| parent | e7fe2527f61b90e68895d53bbb3735cc605b2152 (diff) | |
| parent | 712993cf0ceb6db1afbdf831b18f1121dd4758e8 (diff) | |
Merge "Improve error messages when output file is invalid"
| -rw-r--r-- | cc/binary_sdk_member.go | 2 | ||||
| -rw-r--r-- | cc/library_sdk_member.go | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/cc/binary_sdk_member.go b/cc/binary_sdk_member.go index 1d9cc54f8..88ac51349 100644 --- a/cc/binary_sdk_member.go +++ b/cc/binary_sdk_member.go @@ -111,7 +111,7 @@ func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberCo ccModule := variant.(*Module) p.archType = ccModule.Target().Arch.ArchType.String() - p.outputFile = ccModule.OutputFile().Path() + p.outputFile = getRequiredMemberOutputFile(ctx, ccModule) if ccModule.linker != nil { specifiedDeps := specifiedDeps{} diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go index 953e85fd7..2c8e31158 100644 --- a/cc/library_sdk_member.go +++ b/cc/library_sdk_member.go @@ -354,7 +354,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte // If the library has some link types then it produces an output binary file, otherwise it // is header only. if !p.memberType.noOutputFiles { - p.outputFile = ccModule.OutputFile().Path() + p.outputFile = getRequiredMemberOutputFile(ctx, ccModule) } // Separate out the generated include dirs (which are arch specific) from the @@ -388,6 +388,17 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte } } +func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path { + var path android.Path + outputFile := ccModule.OutputFile() + if outputFile.Valid() { + path = outputFile.Path() + } else { + ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", ccModule) + } + return path +} + func (p *nativeLibInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) { addPossiblyArchSpecificProperties(ctx.SdkModuleContext(), ctx.SnapshotBuilder(), p, propertySet) } |