44package genrulebob
55
66import (
7+ "bytes"
78 "fmt"
89 "os"
910 "path/filepath"
@@ -18,8 +19,14 @@ import (
1819 "github.com/ARM-software/bob-build/internal/utils"
1920
2021 "github.com/google/blueprint"
22+ "github.com/google/blueprint/gobtools"
2123)
2224
25+ func init () {
26+ GenruleOutputInfoId = gobtools .RegisterType (func () gobtools.CustomDec { return new (GenruleOutputInfo ) })
27+ GenruleExportInclInfoId = gobtools .RegisterType (func () gobtools.CustomDec { return new (GenruleExportInclInfo ) })
28+ }
29+
2330type commonProps struct {
2431 Srcs []string `android:"path"`
2532 Export_gen_include_dirs []string
@@ -276,6 +283,79 @@ type GenruleOutputInfo struct {
276283 ImplicitOutputs android.Paths
277284}
278285
286+ var GenruleOutputInfoId int16
287+
288+ func (s GenruleOutputInfo ) Encode (ctx gobtools.EncContext , buf * bytes.Buffer ) error {
289+ var err error
290+
291+ // encode s.Outputs length
292+ if err = gobtools .EncodeInt (buf , len (s .Outputs )); err != nil {
293+ return err
294+ }
295+
296+ // encode s.ImplicitOutputs length
297+ if err = gobtools .EncodeInt (buf , len (s .ImplicitOutputs )); err != nil {
298+ return err
299+ }
300+
301+ for _ , path := range s .Outputs {
302+ if err = gobtools .EncodeInterface (ctx , buf , path ); err != nil {
303+ return err
304+ }
305+ }
306+
307+ for _ , path := range s .ImplicitOutputs {
308+ if err = gobtools .EncodeInterface (ctx , buf , path ); err != nil {
309+ return err
310+ }
311+ }
312+
313+ return err
314+ }
315+
316+ func (s GenruleOutputInfo ) GetTypeId () int16 {
317+ return GenruleOutputInfoId
318+ }
319+
320+ func (s * GenruleOutputInfo ) Decode (ctx gobtools.EncContext , buf * bytes.Reader ) error {
321+ var err error
322+ var outputsLen int
323+ var implicitOutputsLen int
324+
325+ if err = gobtools .DecodeInt (buf , & outputsLen ); err != nil {
326+ return err
327+ }
328+
329+ if err = gobtools .DecodeInt (buf , & implicitOutputsLen ); err != nil {
330+ return err
331+ }
332+
333+ s .Outputs = make (android.Paths , outputsLen )
334+ s .ImplicitOutputs = make (android.Paths , implicitOutputsLen )
335+
336+ for i := 0 ; i < outputsLen ; i ++ {
337+ if val , err := gobtools .DecodeInterface (ctx , buf ); err != nil {
338+ return err
339+ } else if val == nil {
340+ s .Outputs [i ] = nil
341+ } else {
342+ s .Outputs [i ] = val .(android.Path )
343+ }
344+ }
345+
346+ for i := 0 ; i < implicitOutputsLen ; i ++ {
347+ if val , err := gobtools .DecodeInterface (ctx , buf ); err != nil {
348+ return err
349+ } else if val == nil {
350+ s .ImplicitOutputs [i ] = nil
351+ } else {
352+ s .ImplicitOutputs [i ] = val .(android.Path )
353+ }
354+ }
355+
356+ return err
357+ }
358+
279359var GenruleOutputInfoProvider = blueprint .NewProvider [GenruleOutputInfo ]()
280360
281361func (m * genrulebobCommon ) getArgs (ctx android.ModuleContext ) (args map [string ]string , dependents []android.Path ) {
@@ -561,6 +641,52 @@ type GenruleExportInclInfo struct {
561641 ExportIncludes android.Paths
562642}
563643
644+ var GenruleExportInclInfoId int16
645+
646+ func (s GenruleExportInclInfo ) Encode (ctx gobtools.EncContext , buf * bytes.Buffer ) error {
647+ var err error
648+
649+ // encode s.ExportIncludes length
650+ if err = gobtools .EncodeInt (buf , len (s .ExportIncludes )); err != nil {
651+ return err
652+ }
653+
654+ for _ , path := range s .ExportIncludes {
655+ if err = gobtools .EncodeInterface (ctx , buf , path ); err != nil {
656+ return err
657+ }
658+ }
659+
660+ return err
661+ }
662+
663+ func (s GenruleExportInclInfo ) GetTypeId () int16 {
664+ return GenruleExportInclInfoId
665+ }
666+
667+ func (s * GenruleExportInclInfo ) Decode (ctx gobtools.EncContext , buf * bytes.Reader ) error {
668+ var err error
669+ var exportIncludesLen int
670+
671+ if err = gobtools .DecodeInt (buf , & exportIncludesLen ); err != nil {
672+ return err
673+ }
674+
675+ s .ExportIncludes = make (android.Paths , exportIncludesLen )
676+
677+ for i := 0 ; i < exportIncludesLen ; i ++ {
678+ if val , err := gobtools .DecodeInterface (ctx , buf ); err != nil {
679+ return err
680+ } else if val == nil {
681+ s .ExportIncludes [i ] = nil
682+ } else {
683+ s .ExportIncludes [i ] = val .(android.Path )
684+ }
685+ }
686+
687+ return err
688+ }
689+
564690var GenruleExportInclInfoProvider = blueprint .NewProvider [GenruleExportInclInfo ]()
565691
566692func (m * genrulebobCommon ) setupBuildActions (ctx android.ModuleContext ) (args map [string ]string , implicits []android.Path ) {
0 commit comments