ExpandFileMapping() public static method

public static ExpandFileMapping ( string baseDirectory, FileMapping fileMapping ) : FileMapping
baseDirectory string
fileMapping FileMapping
return FileMapping
Exemplo n.º 1
0
        private static DocumentBuildParameters ConfigToParameter(BuildJsonConfig config)
        {
            var parameters    = new DocumentBuildParameters();
            var baseDirectory = config.BaseDirectory ?? Environment.CurrentDirectory;

            parameters.OutputBaseDir = Path.Combine(baseDirectory, "obj");
            if (config.GlobalMetadata != null)
            {
                parameters.Metadata = config.GlobalMetadata.ToImmutableDictionary();
            }
            if (config.FileMetadata != null)
            {
                parameters.FileMetadata = ConvertToFileMetadataItem(baseDirectory, config.FileMetadata);
            }
            parameters.ExternalReferencePackages = GetFilesFromFileMapping(GlobUtility.ExpandFileMapping(baseDirectory, config.ExternalReference)).ToImmutableArray();
            parameters.Files = GetFileCollectionFromFileMapping(baseDirectory,
                                                                Tuple.Create(DocumentType.Article, GlobUtility.ExpandFileMapping(baseDirectory, config.Content)),
                                                                Tuple.Create(DocumentType.Override, GlobUtility.ExpandFileMapping(baseDirectory, config.Overwrite)),
                                                                Tuple.Create(DocumentType.Resource, GlobUtility.ExpandFileMapping(baseDirectory, config.Resource)));
            return(parameters);
        }
Exemplo n.º 2
0
        private ExtractMetadataInputModel ConvertToInputModel(MetadataJsonItemConfig configModel)
        {
            var projects = configModel.Source;
            // If Root Output folder is specified from command line, use it instead of the base directory
            var outputFolder = Path.Combine(Config.OutputFolder ?? Config.BaseDirectory ?? string.Empty, configModel.Destination ?? Constants.DefaultMetadataOutputFolderName);
            var inputModel   = new ExtractMetadataInputModel
            {
                PreserveRawInlineComments = configModel.Raw,
                ForceRebuild  = configModel.Force,
                ApiFolderName = string.Empty,
            };

            var expandedFileMapping = GlobUtility.ExpandFileMapping(Config.BaseDirectory, projects);

            inputModel.Items = new Dictionary <string, List <string> >
            {
                [outputFolder] = expandedFileMapping.Items.SelectMany(s => s.Files).ToList(),
            };

            return(inputModel);
        }