예제 #1
0
파일: Target.cs 프로젝트: mdae/MonoRT
        bool Build(string built_targets_key, out bool executeOnErrors)
        {
            bool result = false;

            executeOnErrors = false;

            // built targets are keyed by the particular set of global
            // properties. So, a different set could allow a target
            // to run again
            built_targets_key = project.GetKeyForTarget(Name);
            ITaskItem[] outputs;
            if (project.ParentEngine.BuiltTargetsOutputByName.ContainsKey(built_targets_key))
            {
                LogTargetSkipped();
                return(true);
            }

            if (!ConditionParser.ParseAndEvaluate(Condition, Project))
            {
                LogMessage(MessageImportance.Low,
                           "Target {0} skipped due to false condition: {1}",
                           Name, Condition);
                return(true);
            }

            try {
                buildState = BuildState.Started;
                result     = BuildDependencies(GetDependencies(), out executeOnErrors);

                if (!result && executeOnErrors)
                {
                    ExecuteOnErrors();
                }

                if (result)
                {
                    // deps built fine, do main build
                    result = DoBuild(out executeOnErrors);
                }

                buildState = BuildState.Finished;
            } catch (Exception e) {
                LogError("Error building target {0}: {1}", Name, e.ToString());
                return(false);
            }

            project.ParentEngine.BuiltTargetsOutputByName [built_targets_key] = (ITaskItem[])Outputs.Clone();
            project.BuiltTargetKeys.Add(built_targets_key);

            return(result);
        }