Пример #1
0
        public bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            // If not showing the logo and/or eliminating header feedback, then
            // there is nothing to configure...
            if (!_logoEnabled && _feedbackType != BuildFeedbackType.None)
            {
                return(true);
            }

            writer.WriteStartElement("header");  //start: header
            if (_feedbackType == BuildFeedbackType.None)
            {
                // If no feedback is requested, then remove it from the header...
                writer.WriteAttributeString("feedback", "False");
            }

            if (_logoEnabled && !String.IsNullOrEmpty(_logoImage))
            {
                string imagePath = Path.GetFullPath(_logoImage);
                if (File.Exists(imagePath))
                {
                    writer.WriteStartElement("logo");  //start: logo
                    if (_logoWidth > 0 && _logoHeight > 0)
                    {
                        writer.WriteAttributeString("width", _logoWidth.ToString());
                        writer.WriteAttributeString("height", _logoHeight.ToString());
                    }
                    if (_logoPadding >= 0)
                    {
                        writer.WriteAttributeString("padding", _logoPadding.ToString());
                    }

                    writer.WriteStartElement("image");  //start: image
                    writer.WriteAttributeString("path", imagePath);
                    writer.WriteAttributeString("altText", _logoText);
                    writer.WriteEndElement();           //end: image

                    if (!String.IsNullOrEmpty(_logoLink))
                    {
                        writer.WriteStartElement("link");   //start: link
                        writer.WriteAttributeString("uri", _logoLink);
                        writer.WriteEndElement();           //end: link
                    }

                    writer.WriteStartElement("position");   //start: position
                    writer.WriteAttributeString("placement", _logoPlacement.ToString());
                    writer.WriteAttributeString("alignment", _logoAlignment.ToString());
                    writer.WriteEndElement();          //end: position

                    writer.WriteEndElement();          //end: logo
                }
            }

            writer.WriteEndElement();            //end: header

            return(true);
        }
Пример #2
0
        public bool ShouldBuildGroup(object o, out BuildGroup group)
        {
            buildGroups ??= new List <BuildGroup>();
            buildGroupsIndex++;
            BuildGroup current;

            if (buildGroups.Count > buildGroupsIndex)
            {
                current = buildGroups[buildGroupsIndex];
                if (current.CanSkip(o))
                {
                    current.Skip();
                    group = null;
                    return(false);
                }
            }
            else
            {
                current = new BuildGroup(this);
                buildGroups.Add(current);
            }
            current.Update(o);
            group = current;
            return(true);
        }
Пример #3
0
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            string outputDir = "Intellisense";

            if (String.IsNullOrEmpty(_workingDir))
            {
                outputDir = Path.Combine(_outputDir, outputDir);
            }
            else
            {
                outputDir = _workingDir;
            }
            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }

            writer.WriteStartElement("output");  //start: output
            writer.WriteAttributeString("directory", outputDir);
            writer.WriteEndElement();            //end: output

            return(true);
        }
Пример #4
0
        protected BuildGroupContext(BuildGroup group)
            : this()
        {
            BuildExceptions.NotNull(group, "group");

            _group = group;
        }
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            BuildGroupContext groupContext = _context.GroupContexts[group.Id];

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

            // <autoDocument enabled="true" warn="true" constructors="true"
            //   disposeMethods="true"/>
            // Or
            //<autoDocument enabled="true" warn="true">
            //    <constructors enabled="true">
            //        <normalSummary comment=""/>
            //        <staticSummary comment=""/>
            //    </constructors>
            //    <disposeMethods enabled="true">
            //        <withoutParamSummary comment=""/>
            //        <withParamSummary comment=""/>
            //        <boolParam comment=""/>
            //    </disposeMethods>
            //</autoDocument>

            bool   notApplicable = false;
            string embeddedText  = groupContext["$IsEmbeddedGroup"];

            if (!String.IsNullOrEmpty(embeddedText) &&
                embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
            {
                notApplicable = true;
            }

            writer.WriteComment(" Start: Automatic documentation options ");
            writer.WriteStartElement("autoDocument");   //start: autoDocument
            if (notApplicable)
            {
                writer.WriteAttributeString("enabled", "false");
            }
            else
            {
                writer.WriteAttributeString("enabled", this.Enabled.ToString());
            }
            writer.WriteAttributeString("warn", _warn.ToString());
            writer.WriteAttributeString("constructors", _constructors.ToString());
            writer.WriteAttributeString("disposeMethods", _disposeMethods.ToString());
            writer.WriteEndElement();                   //end: autoDocument
            writer.WriteComment(" End: Automatic documentation options ");

            return(true);
        }
        public virtual void Configure(BuildGroup buildGroup,
                                      string sourceFile, string destFile)
        {
            BuildExceptions.NotNull(buildGroup, "buildGroup");
            BuildExceptions.PathMustExist(sourceFile, "sourceFile");
            BuildExceptions.NotNullNotEmpty(destFile, "destFile");

            if (this.IsInitialized == false)
            {
                throw new BuildException("The configurator is not initialized.");
            }
            if (_dicConfigMap == null || _configContent == null)
            {
                throw new BuildException("There is not initialization.");
            }

            _group      = buildGroup;
            _sourceFile = sourceFile;
            _destFile   = destFile;
            string destDir = Path.GetDirectoryName(destFile);

            if (Directory.Exists(destDir) == false)
            {
                Directory.CreateDirectory(destDir);
            }
        }
Пример #7
0
        public void Return_Core_build_group_when_mvc_web_project_is_constructor_argument()
        {
            var buildGroup = new BuildGroup("MvcWebProject_Build_CoreBuildRelease");

            Assert.That(buildGroup.BuildTypeGroup, Is.EqualTo("Core"));
            Assert.That(buildGroup.BuildTypeGroupDisplay, Is.EqualTo("Core"));
        }
Пример #8
0
        protected BuildGroupContext(BuildGroup group, string contextId)
            : this()
        {
            BuildExceptions.NotNull(group, "group");

            _group     = group;
            _contextId = contextId;
        }
Пример #9
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            writer.WriteStartElement(TagName);  // start - TagName
            writer.WriteAttributeString("version", _version.ToString(2));

            //  1. Documentation: Settings of the documentation
            writer.WriteComment(" 1. Documentation: Settings of the documentation ");
            if (_settings != null)
            {
                _settings.WriteXml(writer);
            }

            // 2. Documentation: Group sources of the documentation
            writer.WriteComment(" 2. Documentation: Group sources of the documentation ");
            writer.WriteStartElement("documentSources"); // start - documentSources
            if (_listSources != null && _listSources.Count != 0)
            {
                for (int i = 0; i < _listSources.Count; i++)
                {
                    _listSources[i].WriteXml(writer);
                }
            }
            writer.WriteEndElement();                    // end - documentSources

            // 3. Documentation: Groups of the documentation
            writer.WriteComment(" 3. Documentation: Groups of the documentation ");
            writer.WriteStartElement("documentGroups"); // start - documentGroups
            if (_listGroups != null && _listGroups.Count != 0)
            {
                BuildPathResolver resolver = BuildPathResolver.Resolver;
                Debug.Assert(resolver != null && resolver.Id == _documentId);

                for (int i = 0; i < _listGroups.Count; i++)
                {
                    BuildGroup group = _listGroups[i];

                    BuildFilePath filePath = group.ContentFile;
                    if (filePath != null && filePath.IsValid)
                    {
                        writer.WriteStartElement(BuildGroup.TagName);
                        writer.WriteAttributeString("type", group.GroupType.ToString());
                        writer.WriteAttributeString("source", resolver.ResolveRelative(filePath));
                        writer.WriteEndElement();

                        group.Save();
                    }
                    else
                    {
                        group.WriteXml(writer);
                    }
                }
            }
            writer.WriteEndElement();           // end - documentGroups

            writer.WriteEndElement();           // end - TagName
        }
Пример #10
0
        public bool ContainsGroup(BuildGroup group)
        {
            if (group == null || _listGroups == null || _listGroups.Count == 0)
            {
                return(false);
            }

            return(_listGroups.Contains(group));
        }
Пример #11
0
        public void Return_builds_by_build_group()
        {
            var buildGroup = new BuildGroup("buildType1_A");

            var builds = new FilterBuilds(GetBuilds()).GetBuildsFor(buildGroup);

            Assert.That(builds.All(b => b.BuildTypeId.Equals("buildType1_A", StringComparison.InvariantCultureIgnoreCase)));
            Assert.That(builds.Count, Is.EqualTo(10));
        }
Пример #12
0
        public void RemoveGroup(BuildGroup group)
        {
            BuildExceptions.NotNull(group, "group");

            if (_listGroups == null || _listGroups.Count == 0)
            {
                return;
            }

            _listGroups.Remove(group);
        }
Пример #13
0
        public void AddGroup(BuildGroup group)
        {
            BuildExceptions.NotNull(group, "group");

            if (_listGroups == null)
            {
                _listGroups = new BuildKeyedList <BuildGroup>();
            }

            _listGroups.Add(group);
        }
Пример #14
0
        /// <overloads>
        /// Applies the processing operations defined by this reference visitor
        /// to the specified build group.
        /// </overloads>
        /// <summary>
        /// Applies the processing operations defined by this visitor to the
        /// specified build group.
        /// </summary>
        /// <param name="group">
        /// The <see cref="BuildGroup">build group</see> to which the processing
        /// operations defined by this visitor will be applied.
        /// </param>
        /// <remarks>
        /// The visitor must be initialized before any call this method.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="group"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If the specified <paramref name="group"/> is not of reference type.
        /// </exception>
        public override void Visit(BuildGroup group)
        {
            BuildExceptions.NotNull(group, "group");

            if (group.GroupType == BuildGroupType.Reference)
            {
                this.OnVisit((ReferenceGroup)group);
            }
            else
            {
                throw new ArgumentException(
                          "ReferenceGroupVisitor: The group visitor can only process reference group.");
            }
        }
Пример #15
0
        public virtual void Initialize(BuildFormat format,
                                       BuildSettings settings, BuildGroup group)
        {
            BuildExceptions.NotNull(format, "format");
            BuildExceptions.NotNull(settings, "group");
            BuildExceptions.NotNull(group, "group");

            if (this.IsInitialized)
            {
                return;
            }

            _group    = group;
            _format   = format;
            _settings = settings;
        }
        public void Return_collection_of_distinct_build_type_ids()
        {
            var builds = GetBuilds("BuildType1_1");

            builds.AddRange(GetBuilds("BuildType2_1"));

            _build.GetBuilds().Returns(builds);

            var buildTypes = new BuildGroup(_build).GetDistinctBuildGroups();

            Assert.That(buildTypes.Count, Is.EqualTo(2));
            Assert.That(buildTypes.First().BuildTypeGroup, Is.EqualTo("BuildType1"));
            Assert.That(buildTypes.First().BuildTypeGroupDisplay, Is.EqualTo("Build Type1"));
            Assert.That(buildTypes.Last().BuildTypeGroup, Is.EqualTo("BuildType2"));
            Assert.That(buildTypes.Last().BuildTypeGroupDisplay, Is.EqualTo("Build Type2"));
        }
Пример #17
0
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// is created as a new child specifically for this object, and will not
        /// be passed onto other configuration objects.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            string outputDir = "Intellisense";

            if (String.IsNullOrEmpty(_workingDir))
            {
                outputDir = Path.Combine(_outputDir, outputDir);
            }
            else
            {
                outputDir = _workingDir;
            }
            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }

            writer.WriteStartElement("output");      // start: output
            writer.WriteAttributeString("directory", outputDir);
            writer.WriteEndElement();                // end: output

            writer.WriteStartElement("expressions"); // start: expressions
            writer.WriteAttributeString("root", _rootExpression);
            writer.WriteAttributeString("assembly", _assemblyExpression);
            writer.WriteAttributeString("summary", _summaryExpression);
            writer.WriteAttributeString("parameters", _parametersExpression);
            writer.WriteAttributeString("parameterContent", _parameterContentExpression);
            writer.WriteAttributeString("templates", _templatesExpression);
            writer.WriteAttributeString("templateContent", _templateContentExpression);
            writer.WriteAttributeString("returns", _returnsExpression);
            writer.WriteAttributeString("exception", _exceptionExpression);
            writer.WriteAttributeString("exceptionCref", _exceptionCrefExpression);
            writer.WriteAttributeString("enumeration", _enumerationExpression);
            writer.WriteAttributeString("enumerationApi", _enumerationApiExpression);
            writer.WriteAttributeString("memberSummary", _memberSummaryExpression);
            writer.WriteEndElement();                 // end: expressions

            return(true);
        }
Пример #18
0
        public override BuildStep CreateFinalSteps(BuildGroup group)
        {
            if (group.GroupType != BuildGroupType.Reference)
            {
                throw new BuildException("The build engine requires reference group.");
            }

            BuildContext  context  = this.Context;
            BuildSettings settings = this.Settings;

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

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

            string reflectionFile = groupContext["$ReflectionFile"];
            string manifestFile   = groupContext["$ManifestFile"];
            string configFile     = groupContext["$ConfigurationFile"];
            string tocFile        = groupContext["$TocFile"];

            string sandcastleDir = context.StylesDirectory;

            BuildStyleType outputStyle = settings.Style.StyleType;
            string         workingDir  = context.WorkingDirectory;

            // Assemble the help files using the BuildAssembler
            // BuildAssembler.exe /config:Project.config manifest.xml
            string application = Path.Combine(context.SandcastleToolsDirectory,
                                              "BuildAssembler.exe");
            string arguments = String.Format(" /config:{0} {1}",
                                             configFile, manifestFile);
            StepAssembler buildAssProcess = new StepAssembler(workingDir,
                                                              application, arguments);

            buildAssProcess.Group           = group;
            buildAssProcess.LogTitle        = String.Empty;
            buildAssProcess.Message         = "For the group: " + group.Name;
            buildAssProcess.CopyrightNotice = 2;

            return(buildAssProcess);
        }
Пример #19
0
        /// <overloads>
        /// Applies the processing operations defined by this conceptual visitor
        /// to the specified build group.
        /// </overloads>
        /// <summary>
        /// Applies the processing operations defined by this visitor to the
        /// specified build group.
        /// </summary>
        /// <param name="group">
        /// The <see cref="BuildGroup">build group</see> to which the processing
        /// operations defined by this visitor will be applied.
        /// </param>
        /// <remarks>
        /// The visitor must be initialized before any call this method.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="group"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If the specified <paramref name="group"/> is not of conceptual type.
        /// </exception>
        public override void Visit(BuildGroup group)
        {
            BuildExceptions.NotNull(group, "group");

            if (!this.IsInitialized)
            {
                throw new BuildException(
                          "The visitor must initialized before performing this operation.");
            }

            if (group.GroupType == BuildGroupType.Conceptual)
            {
                this.OnVisit((ConceptualGroup)group);
            }
            else
            {
                throw new ArgumentException(
                          "ReferenceGroupVisitor: The group visitor can only process conceptual group.");
            }
        }
Пример #20
0
        public async Task <ActionResult> ViewGroup(uint major, uint minor, uint number, uint?revision = null)
        {
            BuildGroup bg = new BuildGroup
            {
                Major    = major,
                Minor    = minor,
                Build    = number,
                Revision = revision
            };

            List <Build> builds = await _bModel.SelectGroup(bg);

            return(builds.Count == 1
                ? RedirectToAction(nameof(ViewBuild),
                                   new
            {
                id = builds.Single().Id
            }) as ActionResult
                : View(new Tuple <BuildGroup, List <Build> >(bg, builds)));
        }
        public override void Initialize(BuildFormat format,
                                        BuildSettings settings, BuildGroup group)
        {
            base.Initialize(format, settings, group);

            if (!this.IsInitialized)
            {
                return;
            }

            _engineSettings = settings.EngineSettings[
                BuildEngineType.Conceptual] as ConceptualEngineSettings;
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                this.IsInitialized = false;
                return;
            }
        }
Пример #22
0
    public static void AddAllBuilds()
    {
        Reset();

        foreach (KeyValuePair<BuildGroups, string> kv in BuildGroupXMLDict)
        {
            if (!BuildGroupDict.ContainsKey(kv.Key))
            {
                BuildGroup sb = new BuildGroup(kv.Key.ToString());
                BuildGroupDict.Add(kv.Key, sb);
            }

            string text;
            using (StreamReader sr = new StreamReader(kv.Value))
            {
                text = sr.ReadToEnd();
            }

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(text);
            XmlElement allBuilds = doc.DocumentElement;
            for (int i = 0; i < allBuilds.ChildNodes.Count; i++)
            {
                XmlNode buildInfoNode = allBuilds.ChildNodes.Item(i);
                BuildInfo buildInfo = BuildInfo.GetBuildInfoFromXML(buildInfoNode, out bool needRefresh, BuildCards.DefaultCardLimitNumTypes.BasedOnCardBaseInfoLimitNum);
                NeedReload |= needRefresh;
                BuildStoryDatabase.Instance.AddOrModifyBuild(kv.Key.ToString(), buildInfo);
                BuildGroupDict[kv.Key].AddBuild(buildInfo.BuildName, buildInfo);
            }
        }

        //If any problem, refresh XML and reload
        if (NeedReload)
        {
            NeedReload = false;
            RefreshAllBuildXML();
            ReloadBuildXML();
        }
    }
Пример #23
0
        protected static IList <CodeSnippetContent> GetSnippetContents(BuildGroup group)
        {
            if (group == null)
            {
                return(null);
            }

            IList <CodeSnippetContent> listSnippets = group.SnippetContents;

            if (listSnippets == null || listSnippets.Count == 0)
            {
                return(null);
            }

            int itemCount = listSnippets.Count;
            List <CodeSnippetContent> validSnippets = new List <CodeSnippetContent>(
                itemCount);

            for (int i = 0; i < itemCount; i++)
            {
                CodeSnippetContent content = listSnippets[i];
                if (content != null && content.IsEmpty == false)
                {
                    if (content.Count == 0)
                    {
                        validSnippets.Add(content);
                    }
                    else
                    {
                        //TODO: Grab the items and serialize them to a file...
                    }
                }
            }

            return(validSnippets);
        }
Пример #24
0
    void Start()
    {
#if !RECOURCE_CLIENT
        foreach (ChannelConfig cc in sChannelConfigs.GetUnits().Values)
        {
            BuildPlatform bp = BuildPlatform.Windows;
            if (cc.Platform == "android")
            {
                bp = BuildPlatform.Android;
            }
            else if (cc.Platform == "ios")
            {
                bp = BuildPlatform.Ios;
            }

            BuildGroup bg    = sBuildSettings.BuildGroups[(int)bp];
            bool       exist = false;
            foreach (BuildChannel bc in bg.Channels)
            {
                if (bc.ChannelName == cc.ChannelName)
                {
                    exist = true;
                    break;
                }
            }
            if (!exist)
            {
                BuildChannel bc = new BuildChannel();
                bc.ChannelName = cc.ChannelName;
                bg.Channels.Add(bc);
            }
        }
#endif
        var a = sBuildSettings;
        SaveSettings();
    }
Пример #25
0
 public virtual void Uninitialize()
 {
     _group    = null;
     _format   = null;
     _settings = null;
 }
 public void UnionWith(BuildGroup other)
 {
     this.set.UnionWith(other.set);
     this.Weight += other.Weight;
 }
        public BuildJob[] BuildJobs(int nJobs, string output, BuildAssetBundleOptions options, BuildTarget target)
        {
            Assert.IsTrue(nJobs > 0);

            BuildDependency();

            HashSet <BuildGroup>          groups = new HashSet <BuildGroup>();
            Func <BundleNode, BuildGroup> lookUp = (BundleNode node) =>
            {
                foreach (var group in groups)
                {
                    if (group.Contains(node))
                    {
                        return(group);
                    }
                }
                return(null);
            };
            Action <BundleNode, BundleNode> merge = (a, b) =>
            {
                var group1 = lookUp(a);
                var group2 = lookUp(b);
                if (group1 != group2)
                {
                    group1.UnionWith(group2);
                    groups.Remove(group2);
                }
            };

            foreach (var bundle in bundleNodes.Values)
            {
                var group = new BuildGroup();
                group.Add(bundle);
                groups.Add(group);
            }

            foreach (var bundle in bundleNodes.Values)
            {
                foreach (var dep in bundle.deps)
                {
                    merge(bundle, dep);
                }
            }

            while (groups.Count > nJobs)
            {
                List <BuildGroup> sortedGroups = new List <BuildGroup>(groups);
                sortedGroups.Sort((a, b) => { return(a.Weight.CompareTo(b.Weight)); });

                var g1 = sortedGroups[0];
                var g2 = sortedGroups[1];
                g1.UnionWith(g2);
                groups.Remove(g2);
            }

            List <BuildJob> jobs = new List <BuildJob>();

            foreach (var group in groups)
            {
                BuildJob job = new BuildJob();
                job.output  = output;
                job.slaveID = jobs.Count;
                job.options = (int)options;
                job.target  = (int)target;
                List <BuildJob.AssetBundleBuild> jobBuilds = new List <BuildJob.AssetBundleBuild>();
                foreach (BundleNode bn in group)
                {
                    var jobBuild = new BuildJob.AssetBundleBuild();
                    jobBuild.assetBundleName = bn.bundleName;
                    jobBuild.assetNames      = new List <string>(bn.assets.Keys).ToArray();
                    jobBuild.weight          = bn.weight;
                    job.weight += bn.weight;
                    jobBuilds.Add(jobBuild);
                }
                job.builds = jobBuilds.ToArray();
                jobs.Add(job);
            }
            return(jobs.ToArray());
        }
Пример #28
0
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            Debug.Assert(_settings != null, "The settings object is required.");
            if (_settings == null || _context == null)
            {
                return(false);
            }

            BuildGroupContext groupContext = _context.GroupContexts[group.Id];

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

            //<component type="Sandcastle.Components.ReferencePostTransComponent" assembly="$(SandAssistComponent)">
            //    <paths outputPath=".\Output\"/>
            //    <attributes>
            //        <attribute name="DocSet" value="NETFramework" />
            //        <attribute name="DocSet" value="NETCompactFramework"/>
            //    </attributes>
            //    <scripts>
            //        <IncludeItem item="assistScripts" />
            //    </scripts>
            //    <styles>
            //        <!-- Include the various styles used by the Sandcastle Assist -->
            //        <IncludeItem item="codeStyle" />
            //        <IncludeItem item="assistStyle" />
            //    </styles>
            //    <header>
            //        <!-- Include the logo image support -->
            //        <IncludeItem item="logoImage" />
            //        <!--<tables>
            //            <table name="" operation="" />
            //        </tables>-->
            //    </header>
            //</component>

            BuildFeedback feeback = _settings.Feedback;

            Debug.Assert(feeback != null, "Feedback object cannot be null (or Nothing).");
            if (feeback == null)
            {
                return(false);
            }
            BuildStyle buildStyle = _settings.Style;

            Debug.Assert(buildStyle != null, "The style object cannot be null (or Nothing).");
            if (buildStyle == null)
            {
                return(false);
            }

            writer.WriteStartElement("paths");  //start: paths
            writer.WriteAttributeString("outputPath", @".\Output\");
            writer.WriteEndElement();           //end: paths

            AttributeContent attributes = _settings.Attributes;

            if (attributes != null && attributes.Count != 0)
            {
                writer.WriteStartElement("attributes");  //start: attributes
                for (int i = 0; i < attributes.Count; i++)
                {
                    AttributeItem attribute = attributes[i];
                    if (attribute.IsEmpty)
                    {
                        continue;
                    }

                    writer.WriteStartElement("attribute");  //start: attribute
                    writer.WriteAttributeString("name", attribute.Name);
                    writer.WriteAttributeString("value", attribute.Value);
                    writer.WriteEndElement();            //end: attribute
                }
                writer.WriteEndElement();                //end: attributes
            }

            writer.WriteStartElement("scripts");  //start: scripts
            ScriptContent scriptContent = buildStyle.Scripts;

            if (scriptContent != null && !scriptContent.IsEmpty)
            {
                for (int i = 0; i < scriptContent.Count; i++)
                {
                    ScriptItem scriptItem = scriptContent[i];
                    // a. Empty item is no use.
                    // b. Overriding scripts are added to the documentation
                    //    by the transform.
                    if (scriptItem.IsEmpty || scriptItem.Overrides)
                    {
                        continue;
                    }

                    writer.WriteStartElement("script");  //start: script
                    writer.WriteAttributeString("file", scriptItem.ScriptFile);
                    writer.WriteAttributeString("condition", scriptItem.Condition);
                    writer.WriteEndElement();            //end: script
                }
            }
            writer.WriteEndElement();            //end: scripts

            writer.WriteStartElement("styles");  //start: styles
            StyleSheetContent styleContent = buildStyle.StyleSheets;

            if (styleContent != null && !styleContent.IsEmpty)
            {
                for (int i = 0; i < styleContent.Count; i++)
                {
                    StyleSheetItem styleItem = styleContent[i];
                    // a. Empty item is no use.
                    // b. Overriding styles are added to the documentation
                    //    by the transform.
                    if (styleItem.IsEmpty || styleItem.Overrides)
                    {
                        continue;
                    }

                    writer.WriteStartElement("style");  //start: style
                    writer.WriteAttributeString("file", styleItem.StyleFile);
                    writer.WriteAttributeString("condition", styleItem.Condition);
                    writer.WriteEndElement();           //end: style
                }
            }
            writer.WriteEndElement();            //end: styles

            // Let the Feedback option object configure itself...
            feeback.Configure(group, writer);

            // Write roots to namespaces conversion handler...
            writer.WriteStartElement("rootNamespaces"); // start: rootNamespaces
            writer.WriteAttributeString("id", group.Id);

            string rootNamespacesFile = Path.Combine(_context.WorkingDirectory,
                                                     groupContext["$RootNamespaces"]);

            if (File.Exists(rootNamespacesFile))
            {
                writer.WriteAttributeString("source", rootNamespacesFile);
            }
            writer.WriteEndElement();                   //end: rootNamespaces

            return(true);
        }
Пример #29
0
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            Debug.Assert(_settings != null, "The settings object is required.");
            if (_settings == null || _context == null)
            {
                return(false);
            }
            BuildStyle buildStyle = _settings.Style;

            Debug.Assert(buildStyle != null, "The style object cannot be null (or Nothing).");
            if (buildStyle == null)
            {
                return(false);
            }

            //<component type="Sandcastle.Components.ReferenceCodeComponent" assembly="$(SandAssistComponent)">
            //    <options mode="IndirectIris" tabSize="4" lineNumbers="true" outlining="false" storage="Sqlite" separator="..."/>
            //
            //    <!--The following options are for processing codeReference tags in the
            //    reference help.
            //    It is a replacement of the ExampleComponent, providing better coloring,
            //    minimum memory usage etc.
            //
            //    $codeSnippets
            //      @storage: * Indicates where the code snippets should be stored after loading
            //                * Possible values are
            //                     - Memory: the snippets are stored in memory similar to
            //                               the ExampleComponent.
            //                     - Database: the snippets are stored in Sqlite database.
            //                * Default: Database
            //      @separator: * For multi-parts snippets, this defines the separator...
            //                  * Default: ...-->
            //
            //    <!--<codeSnippets>
            //        <codeSnippet source=".\CodeSnippetSample.xml" format="Sandcastle" />
            //    </codeSnippets>-->
            //    <SandcastleItem name="%CodeSnippets%" />
            //</component>

            writer.WriteStartElement("options");  //start: options
            writer.WriteAttributeString("mode", _highlightMode);
            writer.WriteAttributeString("tabSize", _tabSize.ToString());
            writer.WriteAttributeString("lineNumbers", _showLineNumbers.ToString());
            writer.WriteAttributeString("outlining", _showOutlining.ToString());
            writer.WriteAttributeString("storage", _snippetStorage.ToString());
            writer.WriteAttributeString("separator", _snippetSeparator);
            writer.WriteEndElement();             //end: options

            IList <CodeSnippetContent> listSnippets = group.SnippetContents;

            if (listSnippets != null && listSnippets.Count != 0)
            {
                writer.WriteStartElement("codeSnippets");  // start - codeSnippets

                int contentCount = listSnippets.Count;
                for (int i = 0; i < contentCount; i++)
                {
                    CodeSnippetContent snippetContent = listSnippets[i];
                    if (snippetContent == null || snippetContent.IsEmpty)
                    {
                        continue;
                    }
                    writer.WriteStartElement("codeSnippet"); // start - codeSnippet
                    writer.WriteAttributeString("source", snippetContent.ContentFile);
                    writer.WriteAttributeString("format", "Sandcastle");
                    writer.WriteEndElement();                // end - codeSnippet
                }

                writer.WriteEndElement();                  // end - codeSnippets
            }

            SnippetContent snippets = buildStyle.Snippets;

            if (snippets != null && snippets.Count != 0)
            {
                writer.WriteStartElement("codeSources");  // start - codeSources

                for (int i = 0; i < snippets.Count; i++)
                {
                    SnippetItem snippetItem = snippets[i];
                    if (snippetItem == null || snippetItem.IsEmpty)
                    {
                        continue;
                    }
                    writer.WriteStartElement("codeSource"); // start - codeSource
                    writer.WriteAttributeString("source", snippetItem.Source);
                    writer.WriteAttributeString("format", "Sandcastle");
                    writer.WriteEndElement();                // end - codeSource
                }

                // The excludedUnits is required by the SnippetComponent,
                // we maintain that...
                writer.WriteStartElement("excludedUnits"); // start - excludedUnits
                IList <string> excludedUnits = snippets.ExcludedUnitFolders;
                if (excludedUnits != null && excludedUnits.Count != 0)
                {
                    for (int i = 0; i < excludedUnits.Count; i++)
                    {
                        string unitFolder = excludedUnits[i];
                        if (String.IsNullOrEmpty(unitFolder))
                        {
                            continue;
                        }
                        writer.WriteStartElement("unitFolder"); // start - unitFolder
                        writer.WriteAttributeString("name", unitFolder);
                        writer.WriteEndElement();               // end - unitFolder
                    }
                }
                writer.WriteEndElement();              // end - excludedUnits

                writer.WriteStartElement("languages"); // start - languages
                IList <SnippetLanguage> languages = snippets.Languages;
                if (languages != null && languages.Count != 0)
                {
                    for (int i = 0; i < languages.Count; i++)
                    {
                        SnippetLanguage language = languages[i];
                        if (!language.IsValid)
                        {
                            continue;
                        }
                        writer.WriteStartElement("language"); // start - language
                        writer.WriteAttributeString("unit", language.Unit);
                        writer.WriteAttributeString("languageId", language.LanguageId);
                        writer.WriteAttributeString("extension", language.Extension);
                        writer.WriteEndElement();               // end - language
                    }
                }
                writer.WriteEndElement();              // end - languages

                writer.WriteEndElement();              // end - codeSources
            }

            return(true);
        }
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// is created as a new child specifically for this object, and will not
        /// be passed onto other configuration objects.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            Debug.Assert(_settings != null, "The settings object is required.");
            if (_settings == null || _context == null)
            {
                return(false);
            }

            //<component type="Sandcastle.Components.ConceptualPreTransComponent" assembly="$(SandAssistComponent)">
            //    <!-- Replaces <token>autoOutline</token> with an <autoOutline xmlns=""/> node. -->
            //    <autoOutline enabled="true" depth="3" />
            //</component>

            writer.WriteComment(" Resolve tokens, <ddue:token>...</ddue:token>, removing any an used token. ");
            writer.WriteStartElement("resolveTokens");  //start: resolveTokens
            writer.WriteAttributeString("enabled", _resolveTokens.ToString());

            writer.WriteComment(" Replaces <token>autoOutline</token> with an <autoOutline xmlns=\"\"/> node. ");
            writer.WriteStartElement("autoOutline");  //start: autoOutline
            writer.WriteAttributeString("enabled", _outlineTokens.ToString());
            if (_outlineDepth > 0)
            {
                writer.WriteAttributeString("depth", _outlineDepth.ToString());
            }
            writer.WriteEndElement();                 //end: autoOutline

            writer.WriteStartElement("lineBreak");    //start: lineBreak
            writer.WriteAttributeString("enabled", _lineBreakTokens.ToString());
            writer.WriteEndElement();                 //end: lineBreak

            writer.WriteStartElement("iconColumn");   //start: iconColumn
            writer.WriteAttributeString("enabled", _tableIconColumnTokens.ToString());
            writer.WriteEndElement();                 //end: iconColumn

            writer.WriteEndElement();                 //end: resolveTokens

            BuildGroupContext groupContext = _context.GroupContexts[group.Id];

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

            string workingDir = _context.WorkingDirectory;
            string indexFile  = Path.Combine(workingDir, groupContext["$IndexFile"]);

            if (String.IsNullOrEmpty(indexFile) || !File.Exists(indexFile))
            {
                return(true);
            }

            string linkResolverPrefix = groupContext["$LinkResolverPrefix"];
            string linkResolverName   = groupContext["$LinkResolverName"];
            string linkResolverValue  = groupContext["$LinkResolverValue"];

            if (!String.IsNullOrEmpty(linkResolverPrefix) &&
                !String.IsNullOrEmpty(linkResolverName) &&
                !String.IsNullOrEmpty(linkResolverValue))
            {
                writer.WriteStartElement("linkResolver");
                writer.WriteAttributeString("indexFile", indexFile);
                writer.WriteAttributeString("topicType",
                                            groupContext["$LinkResolverTopicType"]);

                writer.WriteStartElement("xpath");
                writer.WriteAttributeString("value", linkResolverValue);
                writer.WriteAttributeString("name", linkResolverName);
                writer.WriteAttributeString("prefix", linkResolverPrefix);
                writer.WriteEndElement();

                writer.WriteEndElement();
            }

            return(true);
        }