Loading linkerconfig/linkerconfig.go +15 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package linkerconfig import ( "android/soong/android" "android/soong/etc" "fmt" "github.com/google/blueprint/proptools" ) Loading Loading @@ -68,6 +69,17 @@ func (l *linkerConfig) OutputFile() android.OutputPath { return l.outputFilePath } var _ android.OutputFileProducer = (*linkerConfig)(nil) func (l *linkerConfig) OutputFiles(tag string) (android.Paths, error) { switch tag { case "": return android.Paths{l.outputFilePath}, nil default: return nil, fmt.Errorf("unsupported module reference tag %q", tag) } } func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { inputFile := android.PathForModuleSrc(ctx, android.String(l.properties.Src)) l.outputFilePath = android.PathForModuleOut(ctx, "linker.config.pb").OutputPath Loading @@ -81,9 +93,10 @@ func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { linkerConfigRule.Build("conv_linker_config", "Generate linker config protobuf "+l.outputFilePath.String()) if proptools.BoolDefault(l.properties.Installable, true) { ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath) if !proptools.BoolDefault(l.properties.Installable, true) { l.SkipInstall() } ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath) } // linker_config generates protobuf file from json file. This protobuf file will be used from Loading scripts/conv_linker_config.py +24 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,14 @@ def Append(args): with open(args.output, 'wb') as f: f.write(pb.SerializeToString()) def Merge(args): pb = linker_config_pb2.LinkerConfig() for other in args.input: with open(other, 'rb') as f: pb.MergeFromString(f.read()) with open(args.out, 'wb') as f: f.write(pb.SerializeToString()) def GetArgParser(): parser = argparse.ArgumentParser() Loading Loading @@ -161,6 +169,22 @@ def GetArgParser(): help='Values of the libraries to append. If there are more than one it should be separated by empty space') append.set_defaults(func=Append) append = subparsers.add_parser( 'merge', help='Merge configurations') append.add_argument( '-o', '--out', required=True, type=str, help='Ouptut linker configuration file to write in protobuf.') append.add_argument( '-i', '--input', nargs='+', type=str, help='Linker configuration files to merge.') append.set_defaults(func=Merge) return parser Loading Loading
linkerconfig/linkerconfig.go +15 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package linkerconfig import ( "android/soong/android" "android/soong/etc" "fmt" "github.com/google/blueprint/proptools" ) Loading Loading @@ -68,6 +69,17 @@ func (l *linkerConfig) OutputFile() android.OutputPath { return l.outputFilePath } var _ android.OutputFileProducer = (*linkerConfig)(nil) func (l *linkerConfig) OutputFiles(tag string) (android.Paths, error) { switch tag { case "": return android.Paths{l.outputFilePath}, nil default: return nil, fmt.Errorf("unsupported module reference tag %q", tag) } } func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { inputFile := android.PathForModuleSrc(ctx, android.String(l.properties.Src)) l.outputFilePath = android.PathForModuleOut(ctx, "linker.config.pb").OutputPath Loading @@ -81,9 +93,10 @@ func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { linkerConfigRule.Build("conv_linker_config", "Generate linker config protobuf "+l.outputFilePath.String()) if proptools.BoolDefault(l.properties.Installable, true) { ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath) if !proptools.BoolDefault(l.properties.Installable, true) { l.SkipInstall() } ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath) } // linker_config generates protobuf file from json file. This protobuf file will be used from Loading
scripts/conv_linker_config.py +24 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,14 @@ def Append(args): with open(args.output, 'wb') as f: f.write(pb.SerializeToString()) def Merge(args): pb = linker_config_pb2.LinkerConfig() for other in args.input: with open(other, 'rb') as f: pb.MergeFromString(f.read()) with open(args.out, 'wb') as f: f.write(pb.SerializeToString()) def GetArgParser(): parser = argparse.ArgumentParser() Loading Loading @@ -161,6 +169,22 @@ def GetArgParser(): help='Values of the libraries to append. If there are more than one it should be separated by empty space') append.set_defaults(func=Append) append = subparsers.add_parser( 'merge', help='Merge configurations') append.add_argument( '-o', '--out', required=True, type=str, help='Ouptut linker configuration file to write in protobuf.') append.add_argument( '-i', '--input', nargs='+', type=str, help='Linker configuration files to merge.') append.set_defaults(func=Merge) return parser Loading