Exemplo n.º 1
0
        /// <summary>
        /// Constructs a new NugetAnalyzed Package.
        /// </summary>
        /// <remarks>
        /// In case of failure it will log a detailed message and return null.
        /// </remarks>
        public static NugetAnalyzedPackage TryAnalyzeNugetPackage(
            FrontEndContext context,
            NugetFrameworkMonikers nugetFrameworkMonikers,
            XDocument nuSpec,
            PackageOnDisk packageOnDisk,
            Dictionary <string, INugetPackage> packagesOnConfig,
            bool doNotEnforceDependencyVersions)
        {
            Contract.Requires(context != null);
            Contract.Requires(nuSpec != null);
            Contract.Requires(packageOnDisk != null);
            Contract.Requires(packageOnDisk.NuSpecFile.IsValid);

            var analyzedPackage = new NugetAnalyzedPackage(context, nugetFrameworkMonikers, nuSpec, packageOnDisk,
                                                           packagesOnConfig, doNotEnforceDependencyVersions);

            if (!analyzedPackage.TryParseDependenciesFromNuSpec())
            {
                return(null);
            }

            analyzedPackage.ParseManagedSemantics();
            analyzedPackage.UpdateForMissingQualifierConversionFunction();

            return(analyzedPackage);
        }
Exemplo n.º 2
0
        /// <nodoc />
        public NugetSpecGenerator(PathTable pathTable, NugetAnalyzedPackage analyzedPackage)
        {
            m_pathTable       = pathTable;
            m_analyzedPackage = analyzedPackage;
            m_packageOnDisk   = analyzedPackage.PackageOnDisk;

            m_xmlExtension = PathAtom.Create(pathTable.StringTable, ".xml");
            m_pdbExtension = PathAtom.Create(pathTable.StringTable, ".pdb");
        }
Exemplo n.º 3
0
 /// <nodoc/>
 private NugetAnalyzedPackage(
     FrontEndContext context,
     NugetFrameworkMonikers nugetFrameworkMonikers,
     XDocument nuSpec,
     PackageOnDisk packageOnDisk,
     Dictionary <string, INugetPackage> packagesOnConfig,
     bool doNotEnforceDependencyVersions)
 {
     m_context                        = context;
     m_nuSpec                         = nuSpec;
     PackageOnDisk                    = packageOnDisk;
     NugetFrameworkMonikers           = nugetFrameworkMonikers;
     m_packagesOnConfig               = packagesOnConfig;
     m_doNotEnforceDependencyVersions = doNotEnforceDependencyVersions;
     TargetFrameworkWithFallbacks     = new MultiValueDictionary <Moniker, Moniker>();
 }
Exemplo n.º 4
0
 /// <nodoc/>
 private NugetAnalyzedPackage(
     FrontEndContext context,
     NugetFrameworkMonikers nugetFrameworkMonikers,
     PackageOnDisk packageOnDisk,
     Dictionary <string, INugetPackage> packagesOnConfig,
     bool doNotEnforceDependencyVersions)
 {
     m_context                        = context;
     PackageOnDisk                    = packageOnDisk;
     NugetFrameworkMonikers           = nugetFrameworkMonikers;
     m_packagesOnConfig               = packagesOnConfig;
     m_doNotEnforceDependencyVersions = doNotEnforceDependencyVersions;
     TargetFrameworks                 = new List <Moniker>();
     References                       = new MultiValueDictionary <NugetTargetFramework, RelativePath>();
     Libraries                        = new MultiValueDictionary <NugetTargetFramework, RelativePath>();
     AssemblyToTargetFramework        = new MultiValueDictionary <PathAtom, NugetTargetFramework>();
     m_dependencies                   = new List <INugetPackage>();
     DependenciesPerFramework         = new MultiValueDictionary <PathAtom, INugetPackage>();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Constructs a new NugetAnalyzed Package.
        /// </summary>
        /// <remarks>
        /// In case of failure it will log a detailed message and return null.
        /// </remarks>
        public static NugetAnalyzedPackage TryAnalyzeNugetPackage(
            FrontEndContext context,
            NugetFrameworkMonikers nugetFrameworkMonikers,
            [CanBeNull] XDocument nuSpec,
            PackageOnDisk packageOnDisk,
            Dictionary <string, INugetPackage> packagesOnConfig,
            bool doNotEnforceDependencyVersions)
        {
            Contract.Requires(context != null);
            Contract.Requires(packageOnDisk != null);

            var analyzedPackage = new NugetAnalyzedPackage(context, nugetFrameworkMonikers, packageOnDisk,
                                                           packagesOnConfig, doNotEnforceDependencyVersions);

            analyzedPackage.ParseManagedSemantics();
            if (nuSpec != null && !analyzedPackage.TryParseDependenciesFromNuSpec(nuSpec))
            {
                return(null);
            }

            return(analyzedPackage);
        }