fixes to new project - compile rules and handle notices from compiler
authorAlan <alan@roojs.com>
Wed, 3 Jan 2024 09:45:34 +0000 (17:45 +0800)
committerAlan <alan@roojs.com>
Wed, 3 Jan 2024 09:45:34 +0000 (17:45 +0800)
src/Palete/ValaCompileRequest.vala
src/Palete/ValaSourceCompiler.vala
src/Project/Gtk.vala
src/Project/Project.vala

index f63b4e0..3a5a562 100644 (file)
@@ -111,7 +111,9 @@ namespace Palete {
                {
                        this.queue = queue;
                        if ( this.target() == "") {
+                               GLib.debug("missing target");
                                this.onCompileFail();
+
                                return false;
                        }
                        string[] args = {};
@@ -126,6 +128,7 @@ namespace Palete {
                        if  (this.requestType == ValaCompileRequestType.PROP_CHANGE || this.requestType == ValaCompileRequestType.FILE_CHANGE) {
                                
                                if (!this.generateTempFile()) {
+                                       GLib.debug("failed to make temp file");
                                        this.onCompileFail();
                                        return false;
                                }
@@ -136,9 +139,11 @@ namespace Palete {
                        }
                        var pr = (Project.Gtk)(file.project);
                        try {
+                               pr.makeProjectSubdir("build");
                                this.compiler = new Spawn(pr.path + "/build", args);
                        } catch (GLib.Error e) {
                                GLib.debug("Spawn failed: %s", e.message);
+
                                this.onCompileFail();
                                return false;
                        }
@@ -147,6 +152,7 @@ namespace Palete {
                        try {
                                this.compiler.run(); 
                        } catch (GLib.Error e) {
+                               GLib.debug("Spawn error %s", e.message);
                                this.onCompileFail();
                                return false;
                        }
index 696399e..5462417 100644 (file)
@@ -69,6 +69,20 @@ namespace Palete {
                        //this.line_errors = new Gee.HashMap<int,string> ();
                        //this.notices = new Gee.ArrayList<ValaSourceNotice>();
                }
+                
+               
+               public override void note (Vala.SourceReference? source, string message) {
+                   if (source == null) {
+                               return;
+                               //stderr.printf ("My error: %s\n", message);
+                       }
+                       
+                       if (source.file.filename != this.tmpname) {
+                               this.compile_notice("WARN", source.file.filename , source.begin.line, "Notice: " + message);
+                               return;
+                       }
+                       this.compile_notice("WARN", this.filepath, source.begin.line, "Notice: " +  message);
+               }
                
                public override void warn (Vala.SourceReference? source, string message) {
                         
index 08d6ace..70d5491 100644 (file)
@@ -71,7 +71,7 @@ namespace Project
                        //this.id = gid;
                        this.packages = new Gee.ArrayList<string>();
                        //this.hidden = new Gee.ArrayList<string>();
-                        
+                       this.compilegroups = new  Gee.HashMap<string,GtkValaSettings>();
                
                }
                
@@ -222,7 +222,7 @@ namespace Project
                                 
                                // "json-glib-1.0",
                                 
-                               "libadwaita-1",
+                               //"libadwaita-1",
                                //"libxml-2.0",
                                "posix"
                                 
@@ -249,6 +249,13 @@ namespace Project
                        cg.sources.add("src/%sApplication.vala".printf(this.name));
                        cg.sources.add("src/ui/ui.Window.bjs");
                        // rescan... not needed as it get's selected after initialization.
+                       this.load();
+                       var fn = this.getByPath(this.path + "/src/ui/ui.Window.bjs");
+                       try {
+                               fn.loadItems();
+                       } catch (GLib.Error e) { } // do nothing?
+                       
+                       fn.save();
                        
                        
                        
@@ -325,6 +332,7 @@ namespace Project
  "items" : [
   {
    "$ xns" : "Gtk",
+   "| vid show" : "() { this.el.show(); }",
    "items" : [
     {
      "$ xns" : "Gtk",
index 602bff2..fe034ff 100644 (file)
@@ -613,6 +613,7 @@ namespace Project {
                 
                        // keys are not paths...
                        foreach(var f in this.files.values) {
+                               GLib.debug("check %s = %s ? %s", path, f.path, f.targetName());
                                if (f.path == path || f.targetName() == path) {
                                        return f;
                                }