@@ -49,12 +49,24 @@ protected override void WriteSymbols (StreamWriter output)
4949 output . WriteLine ( ) ;
5050 WriteHeaderField ( output , "java_name_width" , mappingData . JavaNameWidth ) ;
5151
52+ bool haveAssemblyNames = mappingData . AssemblyNames . Count > 0 ;
53+ bool haveModules = mappingData . Modules . Count > 0 ;
54+
5255 output . WriteLine ( ) ;
53- output . WriteLine ( $ "{ Indent } .include{ Indent } \" { Path . GetFileName ( SharedIncludeFile ) } \" ") ;
54- output . WriteLine ( $ "{ Indent } .include{ Indent } \" { Path . GetFileName ( TypemapsIncludeFile ) } \" ") ;
56+ if ( haveAssemblyNames ) {
57+ output . WriteLine ( $ "{ Indent } .include{ Indent } \" { Path . GetFileName ( SharedIncludeFile ) } \" ") ;
58+ } else {
59+ WriteCommentLine ( output , $ "No shared data present, { Path . GetFileName ( SharedIncludeFile ) } not generated") ;
60+ }
61+
62+ if ( haveModules ) {
63+ output . WriteLine ( $ "{ Indent } .include{ Indent } \" { Path . GetFileName ( TypemapsIncludeFile ) } \" ") ;
64+ } else {
65+ WriteCommentLine ( output , $ "No modules defined, { Path . GetFileName ( TypemapsIncludeFile ) } not generated") ;
66+ }
5567 output . WriteLine ( ) ;
5668
57- if ( ! sharedBitsWritten ) {
69+ if ( ! sharedBitsWritten && haveAssemblyNames ) {
5870 using ( var fs = File . Open ( SharedIncludeFile , FileMode . Create ) ) {
5971 using ( var sharedOutput = new StreamWriter ( fs , output . Encoding ) ) {
6072 WriteAssemblyNames ( sharedOutput ) ;
@@ -63,9 +75,11 @@ protected override void WriteSymbols (StreamWriter output)
6375 }
6476 }
6577
66- using ( var fs = File . Open ( TypemapsIncludeFile , FileMode . Create ) ) {
67- using ( var mapOutput = new StreamWriter ( fs , output . Encoding ) ) {
68- WriteMapModules ( output , mapOutput , "map_modules" ) ;
78+ if ( haveModules ) {
79+ using ( var fs = File . Open ( TypemapsIncludeFile , FileMode . Create ) ) {
80+ using ( var mapOutput = new StreamWriter ( fs , output . Encoding ) ) {
81+ WriteMapModules ( output , mapOutput , "map_modules" ) ;
82+ }
6983 }
7084 }
7185
0 commit comments