private string[] GetClassLibraries() { BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.BuildTarget); string[] result; if (PlayerSettings.GetScriptingBackend(buildTargetGroup) != ScriptingImplementation.WinRTDotNET) { string monoAssemblyDirectory = base.GetMonoProfileLibDirectory(); List <string> list = new List <string>(); list.AddRange(from dll in MicrosoftCSharpCompiler.GetReferencesFromMonoDistribution() select Path.Combine(monoAssemblyDirectory, dll)); if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_4_6) { string path = Path.Combine(monoAssemblyDirectory, "Facades"); list.Add(Path.Combine(path, "System.ObjectModel.dll")); list.Add(Path.Combine(path, "System.Runtime.dll")); list.Add(Path.Combine(path, "System.Runtime.InteropServices.WindowsRuntime.dll")); list.Add(Path.Combine(monoAssemblyDirectory, "System.Numerics.dll")); list.Add(Path.Combine(monoAssemblyDirectory, "System.Numerics.Vectors.dll")); } result = list.ToArray(); } else { if (this.BuildTarget != BuildTarget.WSAPlayer) { throw new InvalidOperationException(string.Format("MicrosoftCSharpCompiler cannot build for .NET Scripting backend for BuildTarget.{0}.", this.BuildTarget)); } WSASDK wSASDK = WSASDK.UWP; if (wSASDK != WSASDK.UWP) { result = Directory.GetFiles(MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wSASDK), "*.dll"); } else { NuGetPackageResolver nuGetPackageResolver = new NuGetPackageResolver { ProjectLockFile = "UWP\\project.lock.json" }; result = nuGetPackageResolver.Resolve(); } } return(result); }
private string[] GetNETWSAAssemblies(WSASDK wsaSDK) { if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() == ScriptingImplementation.IL2CPP) { string monoAssemblyDirectory = BuildPipeline.GetMonoLibDirectory(BuildTarget.WSAPlayer); return((from dll in MicrosoftCSharpCompiler.GetReferencesFromMonoDistribution() select Path.Combine(monoAssemblyDirectory, dll)).ToArray <string>()); } if (wsaSDK != WSASDK.UWP) { return(Directory.GetFiles(MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wsaSDK), "*.dll")); } NuGetPackageResolver nuGetPackageResolver = new NuGetPackageResolver { ProjectLockFile = "UWP\\project.lock.json" }; return(nuGetPackageResolver.Resolve()); }
public NuGetAssemblyResolver(string projectLockFile) { NuGetPackageResolver resolver = new NuGetPackageResolver { ProjectLockFile = projectLockFile }; resolver.Resolve(); string[] resolvedReferences = resolver.ResolvedReferences; this._references = new Dictionary<string, string>(resolvedReferences.Length, StringComparer.InvariantCultureIgnoreCase); foreach (string str in resolvedReferences) { string str3; string fileName = Path.GetFileName(str); if (this._references.TryGetValue(fileName, out str3)) { throw new Exception(string.Format("Reference \"{0}\" already added as \"{1}\".", str, str3)); } this._references.Add(fileName, str); } }
private string[] GetNETWSAAssemblies(WSASDK wsaSDK) { if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() == ScriptingImplementation.IL2CPP) { // ISSUE: object of a compiler-generated type is created // ISSUE: reference to a compiler-generated method return(((IEnumerable <string>)MicrosoftCSharpCompiler.GetReferencesFromMonoDistribution()).Select <string, string>(new Func <string, string>(new MicrosoftCSharpCompiler.\u003CGetNETWSAAssemblies\u003Ec__AnonStoreyB3() { monoAssemblyDirectory = BuildPipeline.GetMonoLibDirectory(BuildTarget.WSAPlayer) }.\u003C\u003Em__20C)).ToArray <string>()); } if (wsaSDK != WSASDK.UWP) { return(Directory.GetFiles(MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wsaSDK), "*.dll")); } NuGetPackageResolver resolver = new NuGetPackageResolver() { ProjectLockFile = "UWP\\project.lock.json" }; for (int index = !MicrosoftCSharpCompiler.EnsureProjectLockFile(resolver) ? 1 : 2; index != 0; --index) { try { resolver.Resolve(); } catch (Exception ex) { if (index > 1) { Console.WriteLine("Failed to resolve NuGet packages. Deleting \"{0}\" and retrying.", (object)Path.GetFullPath(resolver.ProjectLockFile)); File.Delete(resolver.ProjectLockFile); MicrosoftCSharpCompiler.EnsureProjectLockFile(resolver); } else { throw; } } } return(resolver.ResolvedReferences); }
private string[] GetClassLibraries() { var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(BuildTarget); if (PlayerSettings.GetScriptingBackend(buildTargetGroup) != ScriptingImplementation.WinRTDotNET) { return(new string[] {}); } if (BuildTarget != BuildTarget.WSAPlayer) { throw new InvalidOperationException(string.Format("MicrosoftCSharpCompiler cannot build for .NET Scripting backend for BuildTarget.{0}.", BuildTarget)); } var resolver = new NuGetPackageResolver { ProjectLockFile = @"UWP\project.lock.json" }; return(resolver.Resolve()); }
public static string[] GetClassLibraries(BuildTarget buildTarget, bool buildingForEditor) { var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget); if (!IsBuildingForDotNetScriptingBackend(buildTargetGroup, buildingForEditor)) { return(new string[] {}); } if (buildTarget != BuildTarget.WSAPlayer) { throw new InvalidOperationException($"MicrosoftCSharpCompiler cannot build for .NET Scripting backend for BuildTarget. {buildTarget}."); } var resolver = new NuGetPackageResolver { ProjectLockFile = @"UWP\project.lock.json" }; return(resolver.Resolve()); }
private string[] GetClassLibraries() { BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.BuildTarget); string[] result; if (PlayerSettings.GetScriptingBackend(buildTargetGroup) != ScriptingImplementation.WinRTDotNET) { result = new string[0]; } else { if (this.BuildTarget != BuildTarget.WSAPlayer) { throw new InvalidOperationException(string.Format("MicrosoftCSharpCompiler cannot build for .NET Scripting backend for BuildTarget.{0}.", this.BuildTarget)); } NuGetPackageResolver nuGetPackageResolver = new NuGetPackageResolver { ProjectLockFile = "UWP\\project.lock.json" }; result = nuGetPackageResolver.Resolve(); } return(result); }
private string[] GetNETWSAAssemblies(WSASDK wsaSDK) { if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() == ScriptingImplementation.IL2CPP) { // ISSUE: object of a compiler-generated type is created // ISSUE: reference to a compiler-generated method return ((IEnumerable<string>) MicrosoftCSharpCompiler.GetReferencesFromMonoDistribution()).Select<string, string>(new Func<string, string>(new MicrosoftCSharpCompiler.\u003CGetNETWSAAssemblies\u003Ec__AnonStoreyB3() { monoAssemblyDirectory = BuildPipeline.GetMonoLibDirectory(BuildTarget.WSAPlayer) }.\u003C\u003Em__20C)).ToArray<string>(); } if (wsaSDK != WSASDK.UWP) return Directory.GetFiles(MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wsaSDK), "*.dll"); NuGetPackageResolver resolver = new NuGetPackageResolver() { ProjectLockFile = "UWP\\project.lock.json" }; for (int index = !MicrosoftCSharpCompiler.EnsureProjectLockFile(resolver) ? 1 : 2; index != 0; --index) { try { resolver.Resolve(); } catch (Exception ex) { if (index > 1) { Console.WriteLine("Failed to resolve NuGet packages. Deleting \"{0}\" and retrying.", (object) Path.GetFullPath(resolver.ProjectLockFile)); File.Delete(resolver.ProjectLockFile); MicrosoftCSharpCompiler.EnsureProjectLockFile(resolver); } else throw; } } return resolver.ResolvedReferences; }
private static bool EnsureProjectLockFile(NuGetPackageResolver resolver) { string projectFile = FileUtil.NiceWinPath(Path.Combine(BuildPipeline.GetBuildToolsDirectory(BuildTarget.WSAPlayer), "project.json")); return resolver.EnsureProjectLockFile(projectFile); }
private static bool EnsureProjectLockFile(NuGetPackageResolver resolver) { string projectFile = FileUtil.NiceWinPath(Path.Combine(BuildPipeline.GetBuildToolsDirectory(BuildTarget.WSAPlayer), "project.json")); return(resolver.EnsureProjectLockFile(projectFile)); }