コード例 #1
0
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            _notApplicable = false;

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

            if (groupContext != null)
            {
                // We do not have to spell check embedded documents...
                string embeddedText = groupContext["$IsEmbeddedGroup"];
                if (!String.IsNullOrEmpty(embeddedText) &&
                    embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
                {
                    _notApplicable = true;
                    return;
                }
            }

            if (this.IsInitialized)
            {
                if (_visibility == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _visibility = engineSettings.Visibility;
                    Debug.Assert(_visibility != null);
                    if (_visibility == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferenceVisibilityConfiguration"/> class
        /// with parameters copied from the specified instance of the
        /// <see cref="ReferenceVisibilityConfiguration"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="ReferenceVisibilityConfiguration"/> class from which the
        /// initialization parameters or values will be copied.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the parameter <paramref name="source"/> is <see langword="null"/>.
        /// </exception>
        public ReferenceVisibilityConfiguration(ReferenceVisibilityConfiguration source)
            : base(source)
        {
            _attributeInfo            = source._attributeInfo;
            _explicitInterfaceMembers = source._explicitInterfaceMembers;
            _emptyNamespaces          = source._emptyNamespaces;

            _frameworkInheritedMembers         = source._frameworkInheritedMembers;
            _frameworkInheritedInternalMembers = source._frameworkInheritedInternalMembers;
            _frameworkInheritedPrivateMembers  = source._frameworkInheritedPrivateMembers;

            _privateFields    = source._privateFields;
            _inheritedMembers = source._inheritedMembers;
            _internalMembers  = source._internalMembers;
            _privateMembers   = source._privateMembers;

            _protectedMembers = source._protectedMembers;
            _protectedInternalsAsProtectedMembers = source._protectedInternalsAsProtectedMembers;
            _sealedProtectedMembers = source._sealedProtectedMembers;
            _attributesToKeep       = source._attributesToKeep;
        }
コード例 #3
0
        /// <summary>
        /// This creates a new build object that is a deep copy of the current
        /// instance.
        /// </summary>
        /// <returns>
        /// A new build object that is a deep copy of this instance.
        /// </returns>
        public override BuildConfiguration Clone()
        {
            ReferenceVisibilityConfiguration options = new ReferenceVisibilityConfiguration(this);

            return(options);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferenceEngineSettings"/> class
        /// with the default parameters.
        /// </summary>
        public ReferenceEngineSettings()
            : base("Sandcastle.References.ReferenceEngineSettings", BuildEngineType.Reference)
        {
            _webMvcSdkType                  = BuildSpecialSdkType.Null;
            _rootContainer                  = false;
            _embedScriptSharp               = true;
            _includeAllMembersTopic         = true;
            _includeInheritedOverloadTopics = true;
            _refNamer  = ReferenceNamer.Orcas;
            _refNaming = ReferenceNamingMethod.Guid;

            IBuildNamedList <BuildConfiguration> configurations = this.Configurations;

            if (configurations != null)
            {
                // For the ReferenceVisitors...
                ReferenceCommentConfiguration comments =
                    new ReferenceCommentConfiguration();

                ReferenceSpellCheckConfiguration spellCheck =
                    new ReferenceSpellCheckConfiguration();

                ReferenceVisibilityConfiguration documentVisibility =
                    new ReferenceVisibilityConfiguration();

                ReferenceXPathConfiguration pathDocumentVisibility =
                    new ReferenceXPathConfiguration();
                pathDocumentVisibility.Enabled = false;

                // For the ReferenceTocVistors...
                ReferenceTocExcludeConfiguration excludeToc =
                    new ReferenceTocExcludeConfiguration();
                ReferenceTocLayoutConfiguration layoutToc =
                    new ReferenceTocLayoutConfiguration();

                configurations.Add(comments);
                configurations.Add(documentVisibility);
                configurations.Add(pathDocumentVisibility);
                configurations.Add(spellCheck);

                configurations.Add(excludeToc);
                configurations.Add(layoutToc);
            }

            IBuildNamedList <BuildComponentConfiguration> componentConfigurations
                = this.ComponentConfigurations;

            if (componentConfigurations != null)
            {
                ReferencePreTransConfiguration preTrans =
                    new ReferencePreTransConfiguration();

                ReferenceMissingTagsConfiguration missingTags =
                    new ReferenceMissingTagsConfiguration();

                ReferenceAutoDocConfiguration autoDocument =
                    new ReferenceAutoDocConfiguration();

                ReferenceIntelliSenseConfiguration intelliSense =
                    new ReferenceIntelliSenseConfiguration();

                ReferencePlatformsConfiguration platforms =
                    new ReferencePlatformsConfiguration();

                ReferenceCloneConfiguration cloneDocument =
                    new ReferenceCloneConfiguration();

                ReferencePostTransConfiguration postTrans =
                    new ReferencePostTransConfiguration();

                ReferenceCodeConfiguration codeComponent =
                    new ReferenceCodeConfiguration();

                ReferenceMathConfiguration mathComponent =
                    new ReferenceMathConfiguration();

                ReferenceMediaConfiguration mediaComponent =
                    new ReferenceMediaConfiguration();

                ReferenceLinkConfiguration linkComponent =
                    new ReferenceLinkConfiguration();

                ReferenceSharedConfiguration sharedComponent =
                    new ReferenceSharedConfiguration();

                componentConfigurations.Add(preTrans);
                componentConfigurations.Add(autoDocument);
                componentConfigurations.Add(missingTags);
                componentConfigurations.Add(intelliSense);
                componentConfigurations.Add(platforms);
                componentConfigurations.Add(cloneDocument);
                componentConfigurations.Add(postTrans);
                componentConfigurations.Add(codeComponent);
                componentConfigurations.Add(mathComponent);
                componentConfigurations.Add(mediaComponent);
                componentConfigurations.Add(linkComponent);
                componentConfigurations.Add(sharedComponent);
            }
        }
コード例 #5
0
        private void CreateReflectionSteps(BuildMultiStep listSteps,
                                           ReferenceGroup group, string sandcastleDir, string helpStyle)
        {
            Debug.Assert(_engineSettings != null);
            if (_engineSettings == null)
            {
                return;
            }

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

            ReferenceGroupContext groupContext =
                context.GroupContexts[group.Id] as ReferenceGroupContext;

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

            string workingDir = context.WorkingDirectory;

            ReferenceContent content       = group.Content;
            string           assemblyDir   = Path.Combine(workingDir, groupContext.AssemblyFolder);
            string           dependencyDir = Path.Combine(workingDir, groupContext.DependencyFolder);

            DependencyContent dependencies = content.Dependencies;

            string reflectionFile = groupContext["$ReflectionFile"];
            string manifestFile   = groupContext["$ManifestFile"];
            string refBuilderFile = groupContext["$ReflectionBuilderFile"];
            string tocFile        = groupContext["$TocFile"];

            BuildStyleType outputStyle = settings.Style.StyleType;

            string tempText = null;

            string arguments   = null;
            string application = null;

            bool ripOldApis = true;

            string assemblyFiles     = null;
            string dependencyFiles   = null;
            string outputFile        = null;
            string configurationFile = null;

            ReferenceVisibilityConfiguration visibility =
                _engineSettings.Visibility;

            Debug.Assert(visibility != null);
            // 1. Create the reflection and the manifest
            StringBuilder textBuilder = new StringBuilder();

            if (group.IsSingleVersion)
            {
                // Call MRefBuilder to generate the reflection...
                // MRefBuilder Assembly.dll
                // /out:reflection.org /config:MRefBuilder.config
                //   /internal-
                application = Path.Combine(context.SandcastleToolsDirectory,
                                           "MRefBuilder.exe");

                assemblyFiles     = String.Format(@"{0}\*.*", assemblyDir);
                dependencyFiles   = String.Format(@"{0}\*.*", dependencyDir);
                outputFile        = Path.ChangeExtension(reflectionFile, ".ver");
                configurationFile = Path.Combine(workingDir, refBuilderFile);

                textBuilder.Append(assemblyFiles);
                textBuilder.Append(" /dep:" + dependencyFiles);

                textBuilder.AppendFormat(" /out:{0} /config:{1}",
                                         outputFile, refBuilderFile);
                if (visibility != null && visibility.IncludeInternalsMembers)
                {
                    textBuilder.Append(" /internal+");
                }
                else
                {
                    textBuilder.Append(" /internal-");
                }

                arguments = textBuilder.ToString();

                outputFile = Path.Combine(workingDir, outputFile);
            }
            else
            {
                // Call the VersionBuilder to create the combined reflection file...
                application = Path.Combine(context.SandcastleToolsDirectory,
                                           "VersionBuilder.exe");

                textBuilder.AppendFormat(" /config:{0} /out:{1}",
                                         groupContext["$ApiVersionsBuilderFile"],
                                         Path.ChangeExtension(reflectionFile, ".org"));

                configurationFile = Path.Combine(workingDir,
                                                 groupContext["$ApiVersionsBuilderFile"]);

                ReferenceVersionInfo versionInfo = group.VersionInfo;
                ripOldApis = versionInfo.RipOldApis;
                if (ripOldApis)
                {
                    textBuilder.Append(" /rip+");
                }
                else
                {
                    textBuilder.Append(" /rip-");
                }

                arguments = textBuilder.ToString();
            }
            StepReflectionBuilder refBuilder = new StepReflectionBuilder(workingDir,
                                                                         application, arguments);

            refBuilder.Group           = group;
            refBuilder.LogTitle        = String.Empty;
            refBuilder.Message         = "Creating XML-formatted reflection information.";
            refBuilder.CopyrightNotice = 2;

            // For the direct use of the Sandcastle library, we need the
            // following parameters...
            refBuilder.RipOldApis        = ripOldApis;
            refBuilder.DocumentInternals =
                (visibility != null && visibility.IncludeInternalsMembers);
            refBuilder.ConfigurationFile = configurationFile;
            refBuilder.ReflectionFile    = outputFile;
            refBuilder.AssemblyFiles.Add(assemblyFiles);
            refBuilder.DependencyFiles.Add(dependencyFiles);

            listSteps.Add(refBuilder);

            textBuilder.Length = 0;

            // 2. Create the reflection and comment refining step...
            StepReferenceRefine referenceRefine =
                new StepReferenceRefine(workingDir);

            referenceRefine.LogTitle = String.Empty;
            referenceRefine.Message  = "Refining the reflection files - filtering and cleaning";
            referenceRefine.Group    = group;

            listSteps.Add(referenceRefine);

            textBuilder.Length = 0;

            // 3. Apply Transforms
            // XslTransform.exe
            // /xsl:"%DXROOT%\ProductionTransforms\ApplyVSDocModel.xsl"
            //    reflection.org
            //    /xsl:"%DXROOT%\ProductionTransforms\AddFriendlyFilenames.xsl"
            //    /out:reflection.xml /arg:IncludeAllMembersTopic=true
            //    /arg:IncludeInheritedOverloadTopics=true /arg:project=Project
            application = Path.Combine(context.SandcastleToolsDirectory,
                                       "XslTransform.exe");
            string prodPath = Path.Combine(sandcastleDir, "ProductionTransforms");
            string textTemp = String.Empty;

            if (group.EnableXmlnsForXaml)
            {
                textTemp = Path.Combine(prodPath, "AddXamlSyntaxData.xsl");
                if (!String.IsNullOrEmpty(textTemp))
                {
                    textBuilder.AppendFormat(" /xsl:\"{0}\"", textTemp);
                    textTemp = String.Empty;
                }
            }

            if (outputStyle == BuildStyleType.ClassicWhite ||
                outputStyle == BuildStyleType.ClassicBlue)
            {
                textTemp = Path.Combine(prodPath, "ApplyVSDocModel.xsl");
            }
            else if (outputStyle == BuildStyleType.Lightweight)
            {
            }
            else if (outputStyle == BuildStyleType.ScriptFree)
            {
            }
            if (!String.IsNullOrEmpty(textTemp))
            {
                textBuilder.AppendFormat(" /xsl:\"{0}\"", textTemp);
                textTemp = String.Empty;
            }

            ReferenceNamingMethod namingMethod = _engineSettings.Naming;

            if (namingMethod == ReferenceNamingMethod.Guid)
            {
                textTemp = Path.Combine(prodPath, "AddGuidFilenames.xsl");
            }
            else if (namingMethod == ReferenceNamingMethod.MemberName)
            {
                textTemp = Path.Combine(prodPath, "AddFriendlyFilenames.xsl");
            }
            else
            {
                textTemp = Path.Combine(prodPath, "AddGuidFilenames.xsl");
            }
            if (!String.IsNullOrEmpty(textTemp))
            {
                textBuilder.AppendFormat(" /xsl:\"{0}\"", textTemp);
                textTemp = String.Empty;
            }

            textBuilder.Append(" " + Path.ChangeExtension(reflectionFile, ".org"));
            textBuilder.AppendFormat(" /out:{0}", reflectionFile);
            textBuilder.AppendFormat(" /arg:IncludeAllMembersTopic={0}",
                                     _engineSettings.IncludeAllMembersTopic ? "true" : "false");
            textBuilder.AppendFormat(" /arg:IncludeInheritedOverloadTopics={0}",
                                     _engineSettings.IncludeInheritedOverloadTopics ? "true" : "false");

            bool   rootContainer = _engineSettings.RootNamespaceContainer;
            string rootTitle     = group.RootNamespaceTitle;

            if (rootContainer && !String.IsNullOrEmpty(rootTitle))
            {
                textBuilder.Append(" /arg:project=Project");
                // Indicate that this reference group is rooted...
                groupContext["$IsRooted"] = Boolean.TrueString;
            }
            arguments = textBuilder.ToString();
            StepReferenceModel applyDocProcess = new StepReferenceModel(
                workingDir, application, arguments);

            applyDocProcess.Group           = group;
            applyDocProcess.LogTitle        = String.Empty;
            applyDocProcess.Message         = "Xsl Transformation - Applying model and adding filenames";
            applyDocProcess.CopyrightNotice = 2;

            listSteps.Add(applyDocProcess);

            textBuilder.Length = 0;

            // 4. and finally the manifest...
            // XslTransform.exe
            // /xsl:"%DXROOT%\ProductionTransforms\ReflectionToManifest.xsl"
            //   reflection.xml /out:manifest.xml
            application = Path.Combine(context.SandcastleToolsDirectory,
                                       "XslTransform.exe");
            textTemp = Path.Combine(prodPath, "ReflectionToManifest.xsl");
            textBuilder.AppendFormat(" /xsl:\"{0}\"", textTemp);
            textBuilder.AppendFormat(" {0} /out:{1}", reflectionFile, manifestFile);
            arguments = textBuilder.ToString();
            StepReferenceManifest manifestProcess = new StepReferenceManifest(
                workingDir, application, arguments);

            manifestProcess.Group           = group;
            manifestProcess.LogTitle        = String.Empty;
            manifestProcess.Message         = "Xsl Transformation - Reflection to Manifest";
            manifestProcess.CopyrightNotice = 2;

            listSteps.Add(manifestProcess);

            // 5. Create the reflection table of contents
            // XslTransform.exe
            // /xsl:"%DXROOT%\ProductionTransforms\createvstoc.xsl"
            //    reflection.xml /out:ApiToc.xml
            application = Path.Combine(context.SandcastleToolsDirectory,
                                       "XslTransform.exe");
            if (outputStyle == BuildStyleType.ClassicWhite ||
                outputStyle == BuildStyleType.ClassicBlue)
            {
                tempText = Path.Combine(sandcastleDir,
                                        @"ProductionTransforms\CreateVSToc.xsl");
            }
            else if (outputStyle == BuildStyleType.Lightweight)
            {
            }
            else if (outputStyle == BuildStyleType.ScriptFree)
            {
            }
            arguments = String.Format("/xsl:\"{0}\" {1} /out:{2}",
                                      tempText, reflectionFile, tocFile);
            StepReferenceToc tocProcess = new StepReferenceToc(workingDir,
                                                               application, arguments);

            tocProcess.LogTitle        = String.Empty;
            tocProcess.Message         = "Xsl Transformation - Creating References TOC";
            tocProcess.Group           = group;
            tocProcess.CopyrightNotice = 2;

            listSteps.Add(tocProcess);
        }
コード例 #6
0
 public ReferenceVisibilityVisitor(ReferenceVisibilityConfiguration configuration)
     : base(VisitorName, configuration)
 {
     _visibility = configuration;
 }