private static void TestHierarchicalToc(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { if (tocType == CustomTocType.ReferenceRoot) { return; } string libraryDir = Path.Combine(sampleDir, @"SampleHierarchicalToc\"); string outputDir = Path.Combine(libraryDir, @"Output\"); //string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test Hierarchical Toc References", TestGroupIds.TestTocLibGroupId); apiGroup.RunningHeaderText = "Sandcastle Helpers: Test Hierarchical Toc"; apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1"; apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile; if (engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "HierarchicalToc Test References"; } ReferenceContent apiContent = apiGroup.Content; apiGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir, "HierarchicalToc" + BuildFileExts.ReferenceGroupExt)); apiContent.ContentFile = new BuildFilePath(Path.Combine(workingDir, "HierarchicalToc" + BuildFileExts.ReferenceContentExt)); apiContent.FrameworkType = BuildFrameworkType.Framework35; //apiGroup.AddItem(projectDoc, null); apiContent.AddItem(Path.Combine(outputDir, "SampleHierarchicalToc.xml"), Path.Combine(outputDir, "SampleHierarchicalToc.dll")); //apiContent.AddDependency(Path.Combine(outputDir, "TestLibrary.dll")); documenter.AddGroup(apiGroup); }
private static void TestOthers0(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { if (tocType == CustomTocType.ReferenceRoot) { return; } string libraryDir = Path.Combine(sampleDir, @"SampleTestLibraryCLR\"); string outputDir = Path.Combine(libraryDir, @"Output\"); //string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test CPP-CLR Library", Guid.NewGuid().ToString()); apiGroup.RunningHeaderText = "Sandcastle Helpers: C++/CLR Library"; apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile; if (engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "Testing C++/CLR Library"; } ReferenceContent apiContent = apiGroup.Content; apiGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir, "OtherReference" + BuildFileExts.ReferenceGroupExt)); apiContent.ContentFile = new BuildFilePath(Path.Combine(workingDir, "OtherReference" + BuildFileExts.ReferenceContentExt)); apiContent.FrameworkType = BuildFrameworkType.Framework20; //apiGroup.AddItem(projectDoc, null); apiContent.AddItem(Path.Combine(outputDir, "SampleLibraryCLR.xml"), Path.Combine(outputDir, "SampleLibraryCLR.dll")); //apiContent.AddDependency(Path.Combine(outputDir, "")); documenter.AddGroup(apiGroup); }
private static void TestMain(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { // Decide which version information to use... ReferenceVersionType versionType = ReferenceVersionType.Advanced; string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\"); string outputDir = Path.Combine(libraryDir, @"Output\"); string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test API References", TestGroupIds.TestLibGroupId); apiGroup.RunningHeaderText = "Sandcastle Helpers: Test API Reference"; if (engineSettings != null && engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "SampleLibrary Test References"; } ReferenceContent apiContent = apiGroup.Content; apiContent.FrameworkType = BuildFrameworkType.Framework35; apiContent.AddItem(projectDoc, null); apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); apiGroup.AddSnippet(new CodeSnippetContent(Path.Combine( libraryDir, "CodeSnippetSample.snippets"))); string helpTestDir = Path.Combine(sampleDir, @"SampleTopics\"); string mediaLinks = Path.Combine(helpTestDir, "MediaContent.media"); apiGroup.AddMedia(new MediaContent(mediaLinks, Path.Combine(helpTestDir, "Media"))); // Create and add an API filter... ReferenceNamespaceFilter namespaceFilter = new ReferenceNamespaceFilter("TestLibrary", true); namespaceFilter.Add(new ReferenceTypeFilter("Point3D", false, false)); apiContent.TypeFilters.Add(namespaceFilter); documenter.AddGroup(apiGroup); ReferenceVersionInfo versionInfo = null; if (versionType == ReferenceVersionType.Advanced) { libraryDir = Path.Combine(sampleDir, @"SampleLibraryVersion\"); outputDir = Path.Combine(libraryDir, @"Output\"); apiContent = new ReferenceContent(); apiContent.FrameworkType = BuildFrameworkType.Framework20; apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); versionInfo = new ReferenceVersionInfo(); versionInfo.PlatformFilters = true; //versionInfo.PlatformId = "netfw"; versionInfo.PlatformTitle = ".NET Framework"; //versionInfo.VersionId = "netfw20"; versionInfo.VersionLabel = "2.0"; ReferenceVersionSource source = new ReferenceVersionSource(); //source.VersionId = "netfw10"; source.VersionLabel = "1.0"; source.Content = apiContent; versionInfo.AddSource(source); apiGroup.VersionType = versionType; apiGroup.VersionInfo = versionInfo; } if (versionType == ReferenceVersionType.Advanced && versionInfo != null) { libraryDir = Path.Combine(sampleDir, @"SampleLibrarySilverlight\"); outputDir = Path.Combine(libraryDir, @"Output\"); apiContent = new ReferenceContent(); apiContent.FrameworkType = BuildFrameworkType.Silverlight40; apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); ReferenceVersionRelated relatedVersion = new ReferenceVersionRelated(); relatedVersion.PlatformId = "silverlight_mobile"; //relatedVersion.PlatformTitle = "Silverlight for Windows Phone"; ReferenceVersionSource source = new ReferenceVersionSource(); source.VersionId = "silverlight_mobile_v1"; //source.VersionLabel = "Windows Phone OS 7.0"; source.Content = apiContent; relatedVersion.Add(source); versionInfo.AddRelated(relatedVersion); } }
private static void TestSilverlightWPF(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { if (tocType == CustomTocType.ReferenceRoot) { return; } // Decide which Caliburn Micro library to include: Silverlight or WPF bool useSilverlight = true; string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\"); if (useSilverlight) { string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\Silverlight\"); //string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test Silverlight 4", Guid.NewGuid().ToString()); apiGroup.RunningHeaderText = "Sandcastle Helpers: Test Silverlight 4.0"; //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1"; apiGroup.SyntaxType |= BuildSyntaxType.Xaml; apiGroup.EnableXmlnsForXaml = true; if (engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "Caliburn Micro for Silverlight 4.0 v1.0 RTW"; } ReferenceContent apiContent = apiGroup.Content; apiContent.FrameworkType = BuildFrameworkType.Silverlight40; //apiGroup.AddItem(projectDoc, null); //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"), // Path.Combine(outputDir, "Caliburn.Micro.dll")); ReferenceItem refItem = new ReferenceItem( Path.Combine(outputDir, "Caliburn.Micro.xml"), Path.Combine(outputDir, "Caliburn.Micro.dll")); //refItem.XamlSyntax = true; apiContent.Add(refItem); //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll")); documenter.AddGroup(apiGroup); } else { string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\WPF\"); //string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test WPF .NET 4", Guid.NewGuid().ToString()); apiGroup.RunningHeaderText = "Sandcastle Helpers: Test .NET Framework 4.0"; //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1"; apiGroup.SyntaxType |= BuildSyntaxType.Xaml; apiGroup.EnableXmlnsForXaml = true; if (engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "Caliburn Micro for WPF 4.0 v1.0 RTW"; } ReferenceContent apiContent = apiGroup.Content; apiContent.FrameworkType = BuildFrameworkType.Framework40; //apiGroup.AddItem(projectDoc, null); //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"), // Path.Combine(outputDir, "Caliburn.Micro.dll")); ReferenceItem refItem = new ReferenceItem( Path.Combine(outputDir, "Caliburn.Micro.xml"), Path.Combine(outputDir, "Caliburn.Micro.dll")); //refItem.XamlSyntax = true; apiContent.Add(refItem); //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll")); documenter.AddGroup(apiGroup); } }
private static void TestRedirection(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { if (tocType == CustomTocType.ReferenceRoot) { return; } string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\Libraries\"); string outputDir = Path.Combine(libraryDir, @"Redirects\"); string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Testing Redirection", Guid.NewGuid().ToString()); apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection"; apiGroup.SyntaxType |= BuildSyntaxType.Xaml; apiGroup.EnableXmlnsForXaml = true; apiGroup.VersionType = ReferenceVersionType.Assembly; if (engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "Testing Assembly Redirection"; } ReferenceContent apiContent = apiGroup.Content; apiContent.FrameworkType = BuildFrameworkType.Framework40; apiContent.AddItem(projectDoc, null); ReferenceItem refItem = new ReferenceItem( Path.Combine(outputDir, "Tests.Drawings.xml"), Path.Combine(outputDir, "Tests.Drawings.dll")); //refItem.XamlSyntax = true; apiContent.Add(refItem); //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Shapes.dll")); //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Geometries.dll")); documenter.AddGroup(apiGroup); // Testing embedded documents... //apiGroup = new ReferenceGroup( // "Testing Embeddeding", Guid.NewGuid().ToString()); //apiGroup.ExcludeToc = true; //NOTE!!! //apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection"; //apiGroup.SyntaxType |= BuildSyntaxType.Xaml; //apiGroup.EnableXmlnsForXaml = true; //apiGroup.VersionType = ReferenceVersionType.Assembly; //if (engineSettings.RootNamespaceContainer) //{ // apiGroup.RootNamespaceTitle = "Testing Assembly Redirection"; //} //apiContent = apiGroup.Content; //apiContent.FrameworkType = BuildFrameworkType.Framework40; //apiContent.AddItem(projectDoc, null); //apiContent.AddItem(projectDoc, null); //refItem = new ReferenceItem( // Path.Combine(outputDir, "Tests.Shapes.xml"), // Path.Combine(outputDir, "Tests.Shapes.dll")); //refItem.XamlSyntax = true; //apiContent.Add(refItem); //refItem = new ReferenceItem( // Path.Combine(outputDir, "Tests.Geometries.xml"), // Path.Combine(outputDir, "Tests.Geometries.dll")); //refItem.XamlSyntax = true; //apiContent.Add(refItem); //documenter.AddGroup(apiGroup); ReferenceLinkSource linkSource = new ReferenceLinkSource(); refItem = new ReferenceItem(projectDoc, null); //refItem.XamlSyntax = true; linkSource.Add(refItem); refItem = new ReferenceItem( Path.Combine(outputDir, "Tests.Shapes.xml"), Path.Combine(outputDir, "Tests.Shapes.dll")); //refItem.XamlSyntax = true; linkSource.Add(refItem); refItem = new ReferenceItem( Path.Combine(outputDir, "Tests.Geometries.xml"), Path.Combine(outputDir, "Tests.Geometries.dll")); //refItem.XamlSyntax = true; linkSource.Add(refItem); engineSettings.AddLinkSource(linkSource); }
private bool OnExecuteMultiple(BuildContext context) { 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."); } BuildLogger logger = context.Logger; for (int v = 0; v < _listVersions.Count; v++) { ReferenceVersions versions = _listVersions[v]; for (int j = 0; j < versions.Count; j++) { ReferenceVersionSource source = versions[j]; ReferenceGroupContext versionsContext = groupContext.Contexts[source.SourceId]; string workingDir = versionsContext["$WorkingDir"]; ReferenceContent content = source.Content; if (content == null) { if (logger != null) { logger.WriteLine("StepReferenceInit: There is no content associated with the reference group.", BuildLoggerLevel.Error); } return(false); } BuildFrameworkType frameworkType = content.FrameworkType; if (frameworkType == BuildFrameworkType.Null || frameworkType == BuildFrameworkType.None) { if (logger != null) { logger.WriteLine("StepReferenceInit: There is no valid framework type specified for this reference group.", BuildLoggerLevel.Error); } return(false); } BuildFramework framework = BuildFrameworks.GetFramework(frameworkType); if (framework == null) { if (logger != null) { logger.WriteLine("StepReferenceInit: The specified framework type for this reference group is not installed.", BuildLoggerLevel.Error); } return(false); } versionsContext.Framework = framework; string commentDir = versionsContext.CommentFolder; string assemblyDir = versionsContext.AssemblyFolder; if (String.IsNullOrEmpty(commentDir)) { commentDir = "Comments"; } if (!Path.IsPathRooted(commentDir)) { commentDir = Path.Combine(workingDir, commentDir); } if (!Directory.Exists(commentDir)) { Directory.CreateDirectory(commentDir); } if (String.IsNullOrEmpty(assemblyDir)) { assemblyDir = "Assemblies"; } if (!Path.IsPathRooted(assemblyDir)) { assemblyDir = Path.Combine(workingDir, assemblyDir); } if (!Directory.Exists(assemblyDir)) { Directory.CreateDirectory(assemblyDir); } string dependencyDir = versionsContext.DependencyFolder; if (String.IsNullOrEmpty(dependencyDir)) { dependencyDir = "Dependencies"; } if (!Path.IsPathRooted(dependencyDir)) { dependencyDir = Path.Combine(workingDir, dependencyDir); } if (!Directory.Exists(dependencyDir)) { Directory.CreateDirectory(dependencyDir); } versionsContext.CommentDir = commentDir; versionsContext.AssemblyDir = assemblyDir; versionsContext.DependencyDir = dependencyDir; // Copy the comments to the expected directory... int itemCount = content.Count; List <string> commentFiles = new List <string>(itemCount); for (int i = 0; i < itemCount; i++) { ReferenceItem item = content[i]; if (item == null || item.IsEmpty) { continue; } string commentsFile = item.Comments; if (!String.IsNullOrEmpty(commentsFile)) { string fileName = Path.GetFileName(commentsFile); fileName = Path.Combine(commentDir, fileName); if (commentsFile.Length != fileName.Length || String.Equals(commentsFile, fileName, StringComparison.OrdinalIgnoreCase) == false) { File.Copy(commentsFile, fileName, true); File.SetAttributes(fileName, FileAttributes.Normal); commentFiles.Add(fileName); } } string assemblyFile = item.Assembly; if (!String.IsNullOrEmpty(assemblyFile)) { string fileName = Path.GetFileName(assemblyFile); fileName = Path.Combine(assemblyDir, fileName); if (assemblyFile.Length != fileName.Length || String.Equals(assemblyFile, fileName, StringComparison.OrdinalIgnoreCase) == false) { File.Copy(assemblyFile, fileName, true); File.SetAttributes(fileName, FileAttributes.Normal); } } } //TODO--PAUL: Should the project/namespace summary be included? // Finally, store the list of extracted comment file to its context... versionsContext.CommentFiles = commentFiles; // 1. Copy the dependencies to the expected directory... ReferenceProjectVisitor dependencyResolver = new ReferenceProjectVisitor(source.SourceId, content); dependencyResolver.Initialize(context); dependencyResolver.Visit(_group); dependencyResolver.Uninitialize(); } } return(true); }
private bool OnExecuteSingle(BuildContext context) { BuildLogger logger = context.Logger; 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."); } ReferenceContent content = _group.Content; if (content == null) { if (logger != null) { logger.WriteLine("StepReferenceInit: There is no content associated with the reference group.", BuildLoggerLevel.Error); } return(false); } BuildFrameworkType frameworkType = content.FrameworkType; if (frameworkType == BuildFrameworkType.Null || frameworkType == BuildFrameworkType.None) { if (logger != null) { logger.WriteLine("StepReferenceInit: There is no valid framework type specified for this reference group.", BuildLoggerLevel.Error); } return(false); } BuildFramework framework = BuildFrameworks.GetFramework(frameworkType); if (framework == null) { if (logger != null) { logger.WriteLine("StepReferenceInit: The specified framework type for this reference group is not installed.", BuildLoggerLevel.Error); } return(false); } string workingDir = context.WorkingDirectory; groupContext.Framework = framework; string commentDir = groupContext.CommentFolder; string assemblyDir = groupContext.AssemblyFolder; if (String.IsNullOrEmpty(commentDir)) { commentDir = "Comments"; } if (!Path.IsPathRooted(commentDir)) { commentDir = Path.Combine(workingDir, commentDir); } if (!Directory.Exists(commentDir)) { Directory.CreateDirectory(commentDir); } if (String.IsNullOrEmpty(assemblyDir)) { assemblyDir = "Assemblies"; } if (!Path.IsPathRooted(assemblyDir)) { assemblyDir = Path.Combine(workingDir, assemblyDir); } if (!Directory.Exists(assemblyDir)) { Directory.CreateDirectory(assemblyDir); } string dependencyDir = groupContext.DependencyFolder; if (String.IsNullOrEmpty(dependencyDir)) { dependencyDir = "Dependencies"; } if (!Path.IsPathRooted(dependencyDir)) { dependencyDir = Path.Combine(workingDir, dependencyDir); } if (!Directory.Exists(dependencyDir)) { Directory.CreateDirectory(dependencyDir); } groupContext.CommentDir = commentDir; groupContext.AssemblyDir = assemblyDir; groupContext.DependencyDir = dependencyDir; // Copy the comments to the expected directory... int itemCount = content.Count; List <string> commentFiles = new List <string>(itemCount); CommentContent commentContent = content.Comments; if (commentContent != null && !commentContent.IsEmpty) { string commentFile = Path.Combine(commentDir, groupContext["$CommentsFile"]); // If there is a valid file or there is an attached file... BuildFilePath filePath = commentContent.ContentFile; if (filePath != null && filePath.Exists) { if (commentContent.IsLoaded) { commentContent.Save(); } File.Copy(filePath.Path, commentFile); } else { commentContent.SaveCopyAs(commentFile); } File.SetAttributes(commentFile, FileAttributes.Normal); commentFiles.Add(commentFile); } for (int i = 0; i < itemCount; i++) { ReferenceItem item = content[i]; if (item == null || item.IsEmpty) { continue; } string commentsFile = item.Comments; if (!String.IsNullOrEmpty(commentsFile)) { string fileName = Path.GetFileName(commentsFile); fileName = Path.Combine(commentDir, fileName); if (commentsFile.Length != fileName.Length || String.Equals(commentsFile, fileName, StringComparison.OrdinalIgnoreCase) == false) { File.Copy(commentsFile, fileName, true); File.SetAttributes(fileName, FileAttributes.Normal); commentFiles.Add(fileName); } } string assemblyFile = item.Assembly; if (!String.IsNullOrEmpty(assemblyFile)) { string fileName = Path.GetFileName(assemblyFile); fileName = Path.Combine(assemblyDir, fileName); if (assemblyFile.Length != fileName.Length || String.Equals(assemblyFile, fileName, StringComparison.OrdinalIgnoreCase) == false) { File.Copy(assemblyFile, fileName, true); File.SetAttributes(fileName, FileAttributes.Normal); } } } // Finally, store the list of extracted comment file to its context... groupContext.CommentFiles = commentFiles; // 1. Copy the dependencies to the expected directory... ReferenceProjectVisitor dependencyResolver = new ReferenceProjectVisitor(); dependencyResolver.Initialize(context); dependencyResolver.Visit(_group); dependencyResolver.Uninitialize(); return(true); }