public IEnumerable <string> GetNetStandardReferenceAndCompatShimDirs()
            {
                yield return(NetStandardFinder.GetReferenceDirectory());

                yield return(NetStandardFinder.GetDotNetFrameworkCompatShimsDirectory());

                yield return(NetStandardFinder.GetNetStandardCompatShimsDirectory());
            }
        static string[] GetNetStandardClassLibraries()
        {
            var classLibraries = new List <string>();

            // Add the .NET Standard 2.0 reference assembly
            classLibraries.Add(Path.Combine(NetStandardFinder.GetReferenceDirectory(), "netstandard.dll"));

            // Add the .NET Standard 2.0 compat shims
            classLibraries.AddRange(Directory.GetFiles(NetStandardFinder.GetNetStandardCompatShimsDirectory(), "*.dll"));

            // Add the .NET Framework compat shims
            classLibraries.AddRange(Directory.GetFiles(NetStandardFinder.GetDotNetFrameworkCompatShimsDirectory(), "*.dll"));

            return(classLibraries.ToArray());
        }
        private static string AssemblySearchPathArgument(IEnumerable <string> configurationSourceDirectories = null)
        {
            var searchPath = NetStandardFinder.GetReferenceDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + NetStandardFinder.GetNetStandardCompatShimsDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + NetStandardFinder.GetDotNetFrameworkCompatShimsDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + "+" + Application.dataPath.Escape(Path.PathSeparator);

            if (configurationSourceDirectories != null)
            {
                var searchPathFromConfigSources = configurationSourceDirectories.Aggregate("", (acc, curr) => acc + $"{Path.PathSeparator}+" + curr.Escape(Path.PathSeparator));
                searchPath += searchPathFromConfigSources;
            }

            return(" -s \"" + searchPath + "\"");
        }
Beispiel #4
0
        public static string[] GetSystemReferenceDirectories(ApiCompatibilityLevel apiCompatibilityLevel)
        {
            if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard)
            {
                var systemReferenceDirectories = new List <string>();
                systemReferenceDirectories.Add(NetStandardFinder.GetReferenceDirectory());
                systemReferenceDirectories.Add(NetStandardFinder.GetNetStandardCompatShimsDirectory());
                systemReferenceDirectories.Add(NetStandardFinder.GetNetStandardExtensionsDirectory());
                systemReferenceDirectories.Add(NetStandardFinder.GetDotNetFrameworkCompatShimsDirectory());
                return(systemReferenceDirectories.ToArray());
            }

            if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_Unity_4_8)
            {
                var systemReferenceDirectories = new List <string>();
                var frameworkDirectory         = GetSystemReference(apiCompatibilityLevel);
                systemReferenceDirectories.Add(frameworkDirectory);
                systemReferenceDirectories.Add(Path.Combine(frameworkDirectory, "Facades"));
                return(systemReferenceDirectories.ToArray());
            }

            return(new[] { GetSystemReference(apiCompatibilityLevel) });
        }
        private static string AssemblySearchPathArgument(IEnumerable <string> configurationSourceDirectories = null)
        {
            var req = PackageManager.Client.List(offlineMode: true, includeIndirectDependencies: true);

            while (!req.IsCompleted)
            {
                System.Threading.Thread.Sleep(10);
            }

            var packagePathsToSearchForAssemblies = new StringBuilder();

            if (req.Status == PackageManager.StatusCode.Success)
            {
                foreach (var resolvedPackage in req.Result)
                {
                    packagePathsToSearchForAssemblies.Append($"{Path.PathSeparator}+{resolvedPackage.resolvedPath.Escape(Path.PathSeparator)}");
                }
            }
            else
            {
                APIUpdaterLogger.WriteToFile(L10n.Tr($"Unable to retrieve project configured packages; AssemblyUpdater may fail to resolve assemblies from packages. Status = {req.Error?.message} ({req.Error?.errorCode})"));
            }

            var searchPath = NetStandardFinder.GetReferenceDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + NetStandardFinder.GetNetStandardCompatShimsDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + NetStandardFinder.GetDotNetFrameworkCompatShimsDirectory().Escape(Path.PathSeparator) + Path.PathSeparator
                             + "+" + Application.dataPath.Escape(Path.PathSeparator)
                             + packagePathsToSearchForAssemblies.ToString();

            if (configurationSourceDirectories != null)
            {
                var searchPathFromConfigSources = configurationSourceDirectories.Aggregate("", (acc, curr) => acc + $"{Path.PathSeparator}+" + curr.Escape(Path.PathSeparator));
                searchPath += searchPathFromConfigSources;
            }

            return(" -s \"" + searchPath + "\"");
        }