1+ using System ;
12using System . Text ;
23
34namespace ApplicationUtility ;
@@ -17,7 +18,24 @@ public SharedLibraryReporter (SharedLibrary library, MarkdownDocument doc)
1718 this . library = library ;
1819 }
1920
20- protected override void DoReport ( )
21+ protected override void DoReport ( ReportForm form )
22+ {
23+ switch ( form ) {
24+ case ReportForm . Standalone :
25+ DoStandaloneReport ( ) ;
26+ break ;
27+
28+ case ReportForm . SimpleList :
29+ DoListReport ( ) ;
30+ break ;
31+
32+ default :
33+ throw new NotSupportedException ( $ "Unsupported report form '{ form } '") ;
34+ }
35+ }
36+
37+ // TODO: migrate to Markdown
38+ void DoStandaloneReport ( )
2139 {
2240 WriteAspectDesc ( LibraryKind ) ;
2341
@@ -37,6 +55,61 @@ protected override void DoReport ()
3755 }
3856 }
3957
58+ void DoListReport ( )
59+ {
60+ ReportDoc . BeginList ( ) ;
61+ AddNativeArchListItem ( library . TargetArchitecture ) ;
62+ if ( library . HasSoname ) {
63+ ReportDoc . AddLabeledListItem ( "Soname" , ValueOrNone ( library . Soname ) ) ;
64+ }
65+ AddBuildId ( ) ;
66+ AddSize ( ) ;
67+ AddAlignment ( ) ;
68+ AddDebugInfo ( ) ;
69+ AddAndroidIdent ( appendLine : false ) ;
70+
71+ ReportDoc . EndList ( ) . EndListItem ( ) ;
72+ }
73+
74+ void AddSoname ( )
75+ {
76+ if ( ! library . HasSoname ) {
77+ return ;
78+ }
79+
80+ ReportDoc . AddLabeledListItem ( "Soname" , ValueOrNone ( library . Soname ) ) ;
81+ }
82+
83+ void AddBuildId ( bool appendLine = true )
84+ {
85+ ReportDoc . AddLabeledListItem ( "Build ID" , ValueOrNone ( library . BuildID ) , appendLine : appendLine ) ;
86+ }
87+
88+ void AddAlignment ( bool appendLine = true )
89+ {
90+ ReportDoc . AddLabeledListItem ( "Alignment" , $ "{ library . Alignment } ", appendLine : appendLine ) ;
91+ }
92+
93+ void AddDebugInfo ( bool appendLine = true )
94+ {
95+ ReportDoc . AddLabeledListItem ( "Debug info" , $ "{ YesNo ( library . HasDebugInfo ) } ", appendLine : appendLine ) ;
96+ }
97+
98+ void AddSize ( bool appendLine = true )
99+ {
100+ ReportDoc . AddLabeledListItem ( "Size" , $ "{ library . Size } ", appendLine : appendLine ) ;
101+ }
102+
103+ void AddAndroidIdent ( bool appendLine = true )
104+ {
105+ if ( ! library . HasAndroidIdent ) {
106+ return ;
107+ }
108+
109+ // TODO: fix output, currently produces gibberish
110+ ReportDoc . AddLabeledListItem ( "Android ident" , "FIXME" /* ValueOrNone (library.AndroidIdent) */ ) ;
111+ }
112+
40113 protected void WriteDebugInfoDesc ( )
41114 {
42115 WriteItem ( "Has debug info" , YesNo ( library . HasDebugInfo ) ) ;
0 commit comments