only run C complier if we are doing a full run.
authorAlan Knowles <alan@roojs.com>
Sun, 3 Jul 2022 03:05:58 +0000 (11:05 +0800)
committerAlan Knowles <alan@roojs.com>
Sun, 3 Jul 2022 03:05:58 +0000 (11:05 +0800)
src/Palete/ValaSourceCompiler.vala

index de68482..57dcde5 100644 (file)
@@ -283,15 +283,15 @@ namespace Palete {
 #endif
                        var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
                        context.root.add_using_directive (ns_ref);
-
-                       var source_file = new Vala.SourceFile (
-                               context, 
-                               Vala.SourceFileType.SOURCE, 
-                                       this.filepath 
-                       );
-                       source_file.add_using_directive (ns_ref);
-                       context.add_source_file (source_file);
-                       
+                       if (this.filepath != "") { 
+                               var source_file = new Vala.SourceFile (
+                                               context, 
+                                               Vala.SourceFileType.SOURCE, 
+                                               this.filepath 
+                                       );
+                               source_file.add_using_directive (ns_ref);
+                               context.add_source_file (source_file);
+                       }       
                // add all the files (except the current one) - this.file.path
                var pr = this.project;
 
@@ -428,23 +428,25 @@ namespace Palete {
                        
                        /* --- - only if we are actually doing a full build.- no added benifet for inline complier
                        on my laptop a 5s upto here.. then 40+s doing this.. - no additional warnings really (although if we are using 'C' code it maight be usefull
-                       
-                       var ccompiler = new Vala.CCodeCompiler ();
-                       var cc_command = Environment.get_variable ("CC");
-                       
-                       
-                       string [] cc_options = { "-lm", "-pg" };
-                       valac += " -X -lm -X -pg";
+                       */
+                       if (this.filepath == "") { 
+                               var ccompiler = new Vala.CCodeCompiler ();
+                               var cc_command = Environment.get_variable ("CC");
+                               
+                               
+                               string [] cc_options = { "-lm", "-pg" };
+                               valac += " -X -lm -X -pg";
 
-#if VALA_0_56
-                       ccompiler.compile (context, cc_command, cc_options);                    
-#elif VALA_0_36
-                       var pkg_config_command = Environment.get_variable ("PKG_CONFIG");
-                       ccompiler.compile (context, cc_command, cc_options, pkg_config_command);
-                       // newer ones got rid fo pkg config command? not sure why.
+       #if VALA_0_56
+                               ccompiler.compile (context, cc_command, cc_options);                    
+       #elif VALA_0_36
+                               var pkg_config_command = Environment.get_variable ("PKG_CONFIG");
+                               ccompiler.compile (context, cc_command, cc_options, pkg_config_command);
+                               // newer ones got rid fo pkg config command? not sure why.
+                               
+       #endif
+                       }
                        
-#endif
-               */
                        //print("%s\n", valac);
                        Vala.CodeContext.pop ();