示例#1
0
        /// <summary>
        /// Creates a <see cref="ILibraryExport"/> containing the references necessary
        /// to use the provided <see cref="Library"/> during compilation.
        /// </summary>
        /// <param name="library">The <see cref="Library"/> to export</param>
        /// <returns>A <see cref="ILibraryExport"/> containing the references exported by this library</returns>
        public ILibraryExport ExportLibrary(Library library, DependencyManager dependencies)
        {
            // Check if we have a value cached on the Library
            var export = library.GetItem<ILibraryExport>(LibraryExportLibraryPropertyName);
            if (export != null)
            {
                return export;
            }

            switch (library.Identity.Type)
            {
                case LibraryTypes.Package:
                    export = ExportPackageLibrary(library);
                    break;

                case LibraryTypes.Project:
                    export = ExportProjectLibrary(library, dependencies);
                    break;

                default:
                    export = ExportOtherLibrary(library);
                    break;
            }

            // Cache for later use.
            library[LibraryExportLibraryPropertyName] = export;
            LogExport(library, export);
            return export;
        }
示例#2
0
 public IAssemblyLoader Create(NuGetFramework runtimeFramework, IAssemblyLoadContextAccessor loadContextAccessor, DependencyManager dependencies)
 {
     return new PackageAssemblyLoader(
         runtimeFramework,
         loadContextAccessor,
         dependencies.GetLibraries(LibraryTypes.Package),
         _packagePathResolver);
 }
示例#3
0
        private ILibraryExport ExportProjectLibrary(Library library, DependencyManager dependencies)
        {
            // Yes, this code is useless right now, but it dumps to the console
            // so I'm keeping it for now :)

            // Get dependencies and export them
            var exports = dependencies.EnumerateAllDependencies(library)
                .Select(lib => ExportLibrary(lib, dependencies))
                .ToList();
            return LibraryExport.Empty;
        }