Beispiel #1
0
    // Config

    bool ConfigOperation(WrenchProject proj, BuildServices bs)
    {
        Result res = bs.GetValue().Result;

        if (res == null)
        {
            return(true);
        }

        // prompt
        Result rprompt;

        if (bs.GetTag("prompt", out rprompt))
        {
            return(true);
        }

        string prompt;

        if (rprompt == null)
        {
            log.PushLocation(bs.FullName);
            log.Warning(2017, "This configurable option does not have a \'prompt\' tag.", null);
            log.PopLocation();
            prompt = String.Format("Set value of {0}:", bs.FullName);
        }
        else
        {
            // TODO: i18n
            prompt = ((MBString)rprompt).Value;
        }

        if (res is MBBool)
        {
            DoConfigBool(prompt, (MBBool)res);
        }
        else if (res is MBString)
        {
            DoConfigString(prompt, (MBString)res);
        }
        else if (res is MBDirectory)
        {
            DoConfigDirectory(prompt, (MBDirectory)res);
        }
        else
        {
            string s = String.Format("Current value is {0}", res);
            log.PushLocation(bs.FullName);
            log.Error(2018, "Don't know how to configure this option.", s);
            log.PopLocation();
            return(true);
        }

        bs.FixValue(res);
        return(false);
    }
Beispiel #2
0
    bool ExportAsXml(WrenchProject proj, BuildServices bs)
    {
        Result r = WrenchOperations.BuildValue(proj, bs).Result;

        if (r == null)
        {
            return(true);
        }

        r.ExportXml(export_writer, bs.FullName);
        return(false);
    }
Beispiel #3
0
	protected BuildfileLoader LoadChildFile (string file, WrenchProject proj) {
	    if (!File.Exists (file)) {
		//throw new Exception ("Expected but didn't find buildfile at " + file);
		proj.Log.Error (2005, "Expected but didn't find a buildfile at " + file + ".", null);
		return null;
	    }
	    
	    BuildfileLoader bp = new BuildfileLoader (file, proj.Log);
	    
	    if (bp.ParseErrors > 0)
		return null;
	    return bp;
	}
Beispiel #4
0
    // util

    string GuessDistDir(WrenchProject proj)
    {
        string[]    names = new string[] { "/project/name", "/project/version" };
        BuiltItem[] vals  = proj.EvaluateTargets(names);

        if (vals == null)
        {
            return(null);
        }

        return(String.Format("{0}-{1}",
                             (vals[0].Result as MBString).Value,
                             (vals[1].Result as MBString).Value));
    }
Beispiel #5
0
    // basic operations

    bool ShowOperation(WrenchProject proj, BuildServices bs)
    {
        Result res = bs.GetValue().Result;

        if (res != null)
        {
            Console.WriteLine("{0} = {1}", bs.FullName, res);
        }
        else
        {
            Console.WriteLine("{0} couldn't be evaluated.", bs.FullName);
        }

        return(false);
    }
Beispiel #6
0
        protected BuildfileLoader LoadChildFile(string file, WrenchProject proj)
        {
            if (!File.Exists(file))
            {
                //throw new Exception ("Expected but didn't find buildfile at " + file);
                proj.Log.Error(2005, "Expected but didn't find a buildfile at " + file + ".", null);
                return(null);
            }

            BuildfileLoader bp = new BuildfileLoader(file, proj.Log);

            if (bp.ParseErrors > 0)
            {
                return(null);
            }
            return(bp);
        }
Beispiel #7
0
    bool DescribeInstall(WrenchProject proj, BuildServices bs)
    {
        IResultInstaller iri;
        Result           res;

        if (WrenchOperations.GetInstallerAndResult(proj, bs, out iri, out res))
        {
            return(true);
        }

        if (iri == null)
        {
            return(false);
        }

        Console.WriteLine(" + {0}", iri.DescribeAction(res, bs.Context));
        return(false);
    }
Beispiel #8
0
        public BuildfileLoader LoadChildProvider(WrenchProject proj, string basis,
                                                 string subbasis, out bool pub)
        {
            // well, this is just a pain in the ass

            string path;
            string file;

            if (parser.ManualLoads != null)
            {
                if (parser.ManualLoads.Contains(subbasis))
                {
                    string me = basis.Substring(0, basis.Length - subbasis.Length);
                    path = proj.PathToBasisSource(me);
                    file = Path.Combine(path, (string)parser.ManualLoads[subbasis]);

                    pub = true;
                    return(LoadChildFile(file, proj));
                }
            }

            pub = false;

            if (parser.InsideNameContext != null)
            {
                for (int i = 0; i < parser.WhereInside.Length; i++)
                {
                    if (subbasis == parser.WhereInside[i])
                    {
                        WrenchProvider wp = new WrenchProvider();
                        wp.NameContext = (NameLookupContext)parser.InsideNameContext.Clone();
                        return(wp);
                    }
                }
            }

            path = proj.PathToBasisSource(basis);
            file = Path.Combine(path, proj.Info.BuildfileName);

            return(LoadChildFile(file, proj));
        }
Beispiel #9
0
    public MainWindow(WrenchProject project)
    {
        this.project = project;

        ui = new Glade.XML(null, "mb-gtkconfig.glade", "main_window", null);
        ui.Autoconnect(this);

        main_window.Title = project.Info.Name + " " +
                            project.Info.Version + " - Build Configuration";

        group_menu = new Menu();
        group_menu.Show();
        group_option.Menu = group_menu;

        // kill the default page that glade forces us to have
        notebook.RemovePage(0);
        AddNewGroup(DefaultGroupName);
        group_option.SetHistory(0);

        LoadConfigItems();
    }
Beispiel #10
0
    bool DoRemoteInstall(WrenchProject proj, BuildServices bs)
    {
        IResultInstaller iri;
        Result           res;

        if (WrenchOperations.GetInstallerAndResult(proj, bs, out iri, out res))
        {
            return(true);
        }

        if (iri == null)
        {
            return(false);
        }

        bs.Logger.Log("operation.install", bs.FullName);
        Console.WriteLine(" + {0}", bs.FullName);

        return(install_svc.Install((Result)iri, res, install_is_uninstall,
                                   new BuildContextProxy(bs.Context)));
    }
Beispiel #11
0
    bool LoadConfigItem(WrenchProject proj, BuildServices bs)
    {
        string prompt, group;
        string target = bs.FullName;
        Result res    = bs.GetValue().Result;

        if (res == null)
        {
            return(true);
        }

        Result tag;

        if (bs.GetTag("prompt", out tag))
        {
            return(true);
        }

        MBString rstr = tag as MBString;

        if (rstr == null)
        {
            // FIXME
            Console.Error.WriteLine("Configurable option " + target + " does not have a string \'prompt\' tag.");
            prompt = target;
        }
        else
        {
            // TODO: i18n
            prompt = rstr.Value;
        }

        if (bs.GetTag("config_group", out tag))
        {
            return(true);
        }

        rstr = tag as MBString;

        if (rstr == null)
        {
            group = DefaultGroupName;
        }
        else
        {
            // TODO: i18n
            group = rstr.Value;
        }

        Widget widget = null;

        if (res is MBBool)
        {
            widget = MakeBoolItem(bs, prompt, (MBBool)res);
        }
        else if (res is MBString)
        {
            widget = MakeStringItem(bs, prompt, (MBString)res);
        }
        else
        {
            // FIXME
            Console.Error.WriteLine("Don't know how to configure the option {0}.", target);
            return(true);
        }

        AddGuiItem(group, widget);
        return(false);
    }
Beispiel #12
0
 bool BeforeDistributeEvent(WrenchProject proj, BuildServices bs)
 {
     Console.WriteLine(" + {0}", bs.FullName);
     numdisted++;
     return(false);
 }
Beispiel #13
0
 bool BeforeInstallEvent(WrenchProject proj, BuildServices bs)
 {
     Console.WriteLine(" + {0}", bs.FullName);
     numinstalled++;
     return(false);
 }
Beispiel #14
0
 bool BeforeSkipEvent(WrenchProject proj, BuildServices bs)
 {
     numskipped++;
     return(false);
 }
Beispiel #15
0
    // WrenchOperations events

    bool BeforeBuildEvent(WrenchProject proj, BuildServices bs)
    {
        Console.WriteLine("Building `{0}\' ...", bs.FullName);
        numbuilt++;
        return(false);
    }
Beispiel #16
0
	public BuildfileLoader LoadChildProvider (WrenchProject proj, string basis, 
						  string subbasis, out bool pub) {
	    // well, this is just a pain in the ass
	    
	    string path;
	    string file;
	    
	    if (parser.ManualLoads != null) {
		if (parser.ManualLoads.Contains (subbasis)) {
		    string me = basis.Substring (0, basis.Length - subbasis.Length);
		    path = proj.PathToBasisSource (me);
		    file = Path.Combine (path, (string) parser.ManualLoads[subbasis]);
		    
		    pub = true;
		    return LoadChildFile (file, proj);
		}
	    }
	    
	    pub = false;
	    
	    if (parser.InsideNameContext != null) {
		for (int i = 0; i < parser.WhereInside.Length; i++) {
		    if (subbasis == parser.WhereInside[i]) {
			WrenchProvider wp = new WrenchProvider ();
			wp.NameContext = (NameLookupContext) parser.InsideNameContext.Clone ();
			return wp;
		    }
		}
	    }
	    
	    path = proj.PathToBasisSource (basis);
	    file = Path.Combine (path, proj.Info.BuildfileName);
	    
	    return LoadChildFile (file, proj);
	}
Beispiel #17
0
 bool PrintOperation(WrenchProject proj, BuildServices bs)
 {
     Console.WriteLine("{0}", bs.FullName);
     return(false);
 }