public void Initial()
        {
            if (!TargetsPageViewModel.IsEdit)   //make start settings
            {
                ReturnedTarget = new TargetBuilder();
                IfCreate();
            }
            else
            {
                ReturnedTarget = new TargetBuilder(TargetsPageViewModel.SelectedTarget);

                if (ReturnedTarget.Id == 0)
                {
                    IfCreate();
                }
                else
                {
                    IfEdit();
                }
            }
            _timePriority = false;

            NotifyPropertyChanged("TimePriority");
            NotifyPropertyChanged("TargetName");
            NotifyPropertyChanged("TotalSum");
            NotifyPropertyChanged("CurrentSum");
            NotifyPropertyChanged("Spend");
            NotifyPropertyChanged("TargetTime");
            NotifyPropertyChanged("TargetNameError");
            NotifyPropertyChanged("TotalSumError");
            NotifyPropertyChanged("CurrentSumError");
            NotifyPropertyChanged("SpendError");
            NotifyPropertyChanged("TargetTimeError");
        }
        // Response files

        void LoadResponseFile(TargetBuilder tb, string arg, string file)
        {
            string path = AddResourceFile(file);

            using (Stream stream = File.OpenRead(path)) {
                StreamReader reader = new StreamReader(stream);

                string line;

                while ((line = reader.ReadLine()) != null)
                {
                    // FIXME: enforce line chomping? ... sure!
                    line = line.Trim();

                    if (line == "" || line[0] == '#')
                    {
                        continue;
                    }

                    if (arg != null)
                    {
                        tb.AddDep(arg, line);
                    }
                    else
                    {
                        tb.AddDep(line);
                    }
                }
            }
        }
            public void DecodeInto(TargetBuilder tb, IWarningLogger log)
            {
                // This limitation is only because I am lazy and want one character
                // per BooleanHelper command.

                if (targets.Length > 10)
                {
                    throw new InvalidOperationException("Limited to 10 or fewer boolean operands");
                }

                for (int i = 0; i < targets.Length; i++)
                {
                    tb.AddDefaultOrdered(targets[i]);
                }

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < commands.Length; i++)
                {
                    switch (commands[i])
                    {
                    case (int)OpCode.Not: sb.Append('!'); break;

                    case (int)OpCode.And: sb.Append('&'); break;

                    case (int)OpCode.Or: sb.Append('|'); break;

                    case 0: sb.Append('0'); break;

                    case 1: sb.Append('1'); break;

                    case 2: sb.Append('2'); break;

                    case 3: sb.Append('3'); break;

                    case 4: sb.Append('4'); break;

                    case 5: sb.Append('5'); break;

                    case 6: sb.Append('6'); break;

                    case 7: sb.Append('7'); break;

                    case 8: sb.Append('8'); break;

                    case 9: sb.Append('9'); break;

                    default:
                        throw new ArgumentException("Don't know how to handle boolean ops command " +
                                                    commands[i].ToString());
                    }
                }

                tb.AddDep(new MBString(sb.ToString()));
            }
Beispiel #4
0
        private void Build()
        {
            BuildDomain domain = null;

            BuildTarget[] targets = Check.NotEmpty(_config.Targets);

            try
            {
                foreach (BuildTarget target in targets)
                {
                    if (!String.IsNullOrEmpty(_groups))
                    {
                        if (_groups.IndexOf(target.GroupName, StringComparison.OrdinalIgnoreCase) < 0 &&
                            target.GroupName.IndexOf(_groups, StringComparison.OrdinalIgnoreCase) < 0)
                        {
                            continue;
                        }
                    }

                    using (Log.Start("Target {0}, {1}, {2}", target.Toolset, target.Configuration, target.Platform))
                    {
                        if (domain == null || domain.ToolsVersion != target.Toolset)
                        {
                            if (domain != null)
                            {
                                domain.Dispose();
                            }
                            domain = BuildDomain.CreateInstance(target.Toolset, _propertySets);
                        }

                        _errors += domain.Perform(new BuildTasks.SetContinue(_config.Options.ContinueOnError));
                        if (_verbosity.HasValue)
                        {
                            _errors += domain.Perform(new BuildTasks.ConsoleOutput(_verbosity.Value));
                        }

                        TargetBuilder build = new TargetBuilder(_config, target, _propertySets, _targetNames);
                        _errors += domain.Perform(build);
                        _errors += domain.Perform(new UnloadAll());
                    }

                    if (_errors > 0 && !_config.Options.ContinueOnError)
                    {
                        break;
                    }
                }
            }
            finally
            {
                if (domain != null)
                {
                    domain.Dispose();
                }
            }
        }
Beispiel #5
0
        internal void AddTarget(TargetBuilder tb)
        {
            int id = ((WrenchTarget)tb).Id;

            if (targs_by_id.ContainsKey(id))
            {
                throw ExHelp.App("Somehow got a dup target id? ({0:x})", id);
            }

            targs_by_id[id] = tb;
        }
Beispiel #6
0
 private static CommandAction GetCommand(TargetBuilder builder, string command)
 {
     switch (command.ToLower()) {
         case "build":
             return new CommandAction {Action = builder.Build, Command = BounceCommand.Build};
         case "clean":
             return new CommandAction { Action = builder.Clean, Command = BounceCommand.Clean };
         default:
             throw new ConfigurationException(String.Format("no such command {0}, try build or clean", command));
     }
 }
        void ApplyTemplate(string name)
        {
            if (CheckTargetName(name))
            {
                return;
            }
            if (cur_apply_name == null)
            {
                throw ExHelp.App("Trying to apply template without having set template name??");
            }

            TargetBuilder tb = wp.DefineTarget(name, log);

            tb.TemplateName = cur_apply_name;
        }
        string AddResourceFile(string name)
        {
            string srcrel = Path.Combine(resource_subdir, name);
            string path   = Path.Combine(topsrc, srcrel);

            ((GraphBuilder)wp.Owner).AddDependentFile(srcrel, path);

            string target = ResourceTarget + nresource.ToString();

            nresource++;

            TargetBuilder tb = wp.DefineTarget(target, log);

            tb.RuleType = typeof(SourcefileRule);
            tb.AddDep(new MBString(name));   // override the name

            return(path);
        }
Beispiel #9
0
        ///////////////////////////////////////////
        // Target Requests

#if LATER
        public int RequestTarget(string name)
        {
            int    i        = name.LastIndexOf('/');
            string basename = name.Substring(i + 1);
            string basis    = name.Substring(0, i + 1); // include trailing slash

            ProviderBuilder pb = GetProvider(basis);
            TargetBuilder   tb = pb.GetTarget(basename);

            if (tb == null)
            {
                tb = pb.RequestTarget(basename);
            }
            else
            {
                return(((WrenchTarget)tb).Id);
            }
        }
Beispiel #10
0
        private void ctrlPack_Click(object sender, EventArgs e)
        {
            String filename = this.apkList[0].Fullname;
            Regex  regex    = new Regex(@"_([0-9a-zA-Z]+)_g_\w+.apk$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
            Match  match    = regex.Match(filename);
            String commitID;

            if (match.Success)
            {
                commitID = match.Groups[1].Value;
            }
            else
            {
                commitID = String.Empty;
            }
            using (FormPack fp = FormPack.Create(currentVersionName, currentVersionCode, commitID)) {
                if (fp.ShowDialog(this) == DialogResult.OK)
                {
                    TargetBuilder.Execute(this, currentVersionName, currentVersionCode, fp.CommitID);
                }
            }
        }
        /// <summary>
        /// Provides the components required by the tests
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
            case BuildComponentType.RequestBuilder:
                RequestBuilder requestBuilder = new RequestBuilder();
                return((IBuildComponent)requestBuilder);

            case BuildComponentType.TaskBuilder:
                QAMockTaskBuilder taskBuilder = new QAMockTaskBuilder();
                return((IBuildComponent)taskBuilder);

            case BuildComponentType.TargetBuilder:
                TargetBuilder targetBuilder = new TargetBuilder();
                return((IBuildComponent)targetBuilder);

            case BuildComponentType.ResultsCache:
                return((IBuildComponent)_resultsCache);

            default:
                throw new ArgumentException("Unexpected type requested. Type = " + type.ToString());
            }
        }
Beispiel #12
0
	// Response files

	void LoadResponseFile (TargetBuilder tb, string arg, string file) 
	{
	    string path = AddResourceFile (file);

	    using (Stream stream = File.OpenRead (path)) {
		StreamReader reader = new StreamReader (stream);

		string line;

		while ((line = reader.ReadLine ()) != null) {
		    // FIXME: enforce line chomping? ... sure!
		    line = line.Trim ();

		    if (line == "" || line[0] == '#')
			continue;

		    if (arg != null)
			tb.AddDep (arg, line);
		    else
			tb.AddDep (line);
		}
	    }
	}
Beispiel #13
0
        private void BuildTargets(string command, IEnumerable<string> targetsToBuild, Dictionary<string, ITask> targets)
        {
            var builder = new TargetBuilder(_bounce);
            CommandAction commandAction = GetCommand(builder, command);

            foreach(var targetName in targetsToBuild) {
                BuildTarget(targets, targetName, commandAction);
            }
        }
Beispiel #14
0
	void AddDictionaryValue (TargetBuilder tb, string key, SingleValue<string> val)
	{
	    cur_constructed.tb.AddDep ("keys", new MBString (key));
	    cur_constructed.tb.AddDep ("vals", val);
	}
Beispiel #15
0
	    public void DecodeInto (TargetBuilder tb, IWarningLogger log)
	    {
		// This limitation is only because I am lazy and want one character
		// per BooleanHelper command.

		if (targets.Length > 10)
		    throw new InvalidOperationException ("Limited to 10 or fewer boolean operands");

		for (int i = 0; i < targets.Length; i++) 
		    tb.AddDefaultOrdered (targets[i]);

		StringBuilder sb = new StringBuilder ();

		for (int i = 0; i < commands.Length; i++) {
		    switch (commands[i]) {
		    case (int) OpCode.Not: sb.Append ('!'); break;
		    case (int) OpCode.And: sb.Append ('&'); break;
		    case (int) OpCode.Or: sb.Append ('|'); break;
		    case 0: sb.Append ('0'); break;
		    case 1: sb.Append ('1'); break;
		    case 2: sb.Append ('2'); break;
		    case 3: sb.Append ('3'); break;
		    case 4: sb.Append ('4'); break;
		    case 5: sb.Append ('5'); break;
		    case 6: sb.Append ('6'); break;
		    case 7: sb.Append ('7'); break;
		    case 8: sb.Append ('8'); break;
		    case 9: sb.Append ('9'); break;
		    default:
			throw new ArgumentException ("Don't know how to handle boolean ops command " +
						     commands[i].ToString ());
		    }
		}

		tb.AddDep (new MBString (sb.ToString ()));
	    }
Beispiel #16
0
 public override void ApplyTemplate(TargetBuilder tb)
 {
     tb.RuleType = rtype;
 }
Beispiel #17
0
 void AddDictionaryValue(TargetBuilder tb, string key, SingleValue <string> val)
 {
     cur_constructed.tb.AddDep("keys", new MBString(key));
     cur_constructed.tb.AddDep("vals", val);
 }
Beispiel #18
0
            public bool Define(BuildfileParser bp, IWarningLogger log)
            {
                this.tb = bp.wp.DefineTarget(GenTargetName(bp), log);

                return(tb == null);
            }
Beispiel #19
0
	internal void AddTarget (TargetBuilder tb)
	{
	    int id = ((WrenchTarget) tb).Id;

	    if (targs_by_id.ContainsKey (id))
		throw ExHelp.App ("Somehow got a dup target id? ({0:x})", id);

	    targs_by_id[id] = tb;
	}
Beispiel #20
0
	// We can inherit easily in bundles using this class. 
	// No TargetBuilder Add* methods can raise an error,
	// so we don't have a log argument or a bool return
	// value.

	public virtual void ApplyTemplate (TargetBuilder tb)
	{
	}
Beispiel #21
0
	    public bool Define (BuildfileParser bp, IWarningLogger log)
	    {
		this.tb = bp.wp.DefineTarget (GenTargetName (bp), log);

		return tb == null;
	    }
Beispiel #22
0
        // We can inherit easily in bundles using this class.
        // No TargetBuilder Add* methods can raise an error,
        // so we don't have a log argument or a bool return
        // value.

        public virtual void ApplyTemplate(TargetBuilder tb)
        {
        }
Beispiel #23
0
	    public override void ApplyTemplate (TargetBuilder tb)
	    {
		tb.RuleType = rtype;
	    }