Esempio n. 1
0
        public override void BeginSources(BuildContext context)
        {
            base.BeginSources(context);

            string workingDir = context.WorkingDirectory;

            if (!Directory.Exists(workingDir))
            {
                // If the base directory does not exists for some reason, we
                // create that first...
                string baseDir = context.BaseDirectory;
                if (!Directory.Exists(baseDir))
                {
                    Directory.CreateDirectory(baseDir);
                }
                Directory.CreateDirectory(workingDir);
            }

            if (_topicSource != null && _topicSource.IsValid)
            {
                BuildGroupContext groupContext = context.GroupContexts[this.Id];
                if (groupContext == null)
                {
                    throw new BuildException(
                              "The group context is not provided, and it is required by the build system.");
                }

                string ddueMediaDir = Path.Combine(workingDir, groupContext["$DdueMedia"]);

                BuildSourceContext sourceContext = new BuildSourceContext();
                sourceContext.AssembliesDir = Path.Combine(workingDir,
                                                           groupContext["$AssembliesFolder"]);
                sourceContext.CommentsDir = Path.Combine(workingDir,
                                                         groupContext["$CommentsFolder"]);
                sourceContext.DependenciesDir = Path.Combine(workingDir,
                                                             groupContext["$DependenciesFolder"]);
                sourceContext.MediaDir  = ddueMediaDir;
                sourceContext.MediaFile = Path.Combine(workingDir,
                                                       groupContext["$MediaFile"]);

                sourceContext.Initialize(this.Name, workingDir, false);

                _topicSource.Initialize(sourceContext);
                _topicContent = _topicSource.Create(groupContext);
                _topicSource.Uninitialize();

                if (_topicContent == null)
                {
                    throw new BuildException(String.Format(
                                                 "The creation of the content for '{0}' failed.", this.Name));
                }
            }
        }
Esempio n. 2
0
        public override void BeginSources(BuildContext context)
        {
            base.BeginSources(context);

            BuildGroupContext groupContext = context.GroupContexts[this.Id];

            if (groupContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            string workingDir = context.WorkingDirectory;

            if (!Directory.Exists(workingDir))
            {
                // If the base directory does not exists for some reason, we
                // create that first...
                string baseDir = context.BaseDirectory;
                if (!Directory.Exists(baseDir))
                {
                    Directory.CreateDirectory(baseDir);
                }
                Directory.CreateDirectory(workingDir);
            }

            BuildSettings settings = context.Settings;

            _projectTitle = settings.HelpTitle;
            _projectName  = settings.HelpName;

            string ddueXmlDir  = Path.Combine(workingDir, groupContext["$DdueXmlDir"]);
            string ddueCompDir = Path.Combine(workingDir, groupContext["$DdueXmlCompDir"]);
            string ddueHtmlDir = Path.Combine(workingDir, groupContext["$DdueHtmlDir"]);

            if (!Directory.Exists(ddueXmlDir))
            {
                Directory.CreateDirectory(ddueXmlDir);
            }
            if (!Directory.Exists(ddueCompDir))
            {
                Directory.CreateDirectory(ddueCompDir);
            }
            if (!Directory.Exists(ddueHtmlDir))
            {
                Directory.CreateDirectory(ddueHtmlDir);
            }

            if (_topicSource != null && _topicSource.IsValid)
            {
                string ddueMediaDir = Path.Combine(workingDir, groupContext["$DdueMedia"]);
                if (!Directory.Exists(ddueMediaDir))
                {
                    Directory.CreateDirectory(ddueMediaDir);
                }

                BuildSourceContext sourceContext = new BuildSourceContext();
                sourceContext.TopicsDir          = ddueXmlDir;
                sourceContext.TopicsCompanionDir = ddueCompDir;
                sourceContext.TopicsFile         = Path.Combine(workingDir,
                                                                groupContext["$ContentsFile"]);
                sourceContext.MediaDir  = ddueMediaDir;
                sourceContext.MediaFile = Path.Combine(workingDir,
                                                       groupContext["$MediaFile"]);

                sourceContext.Initialize(this.Name, workingDir, false);

                _topicSource.Initialize(sourceContext);
                _topicContent = _topicSource.Create(groupContext);
                _topicSource.Uninitialize();

                if (_topicContent == null)
                {
                    throw new BuildException(String.Format(
                                                 "The creation of the content for '{0}' failed.", this.Name));
                }

                groupContext["$OutputTopics"]  = Boolean.FalseString;
                groupContext["$ApplyVisitors"] = Boolean.FalseString;
            }
            else
            {
                groupContext["$OutputTopics"]  = Boolean.TrueString;
                groupContext["$ApplyVisitors"] = Boolean.TrueString;
            }
        }