public void RunCompileAndLink() { var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList(); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(GetShortPathName(Path.GetFullPath(GetCppOutputDirectoryInStagingArea())))}"); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup)))); arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; var managedDir = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed")); RunIl2CppWithArguments(arguments, setupStartInfo, managedDir); } }
public ManagedProgram(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables) { string[] parts = new string[] { monodistribution, "bin", "mono" }; string str = PathCombine(parts); string[] textArray2 = new string[] { monodistribution, "lib", "mono", profile }; string str2 = PathCombine(textArray2); if (Application.platform == RuntimePlatform.WindowsEditor) { str = CommandLineFormatter.PrepareFileName(str + ".exe"); } ProcessStartInfo info = new ProcessStartInfo { Arguments = CommandLineFormatter.PrepareFileName(executable) + " " + arguments, CreateNoWindow = true, FileName = str, RedirectStandardError = true, RedirectStandardOutput = true, WorkingDirectory = Application.dataPath + "/..", UseShellExecute = false }; if (setMonoEnvironmentVariables) { info.EnvironmentVariables["MONO_PATH"] = str2; string[] textArray3 = new string[] { monodistribution, "etc" }; info.EnvironmentVariables["MONO_CFG_DIR"] = PathCombine(textArray3); } base._process.StartInfo = info; }
static string AssemblyUpdaterPath() { var unescapedAssemblyUpdaterPath = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/AssemblyUpdater.exe"; return(Application.platform == RuntimePlatform.WindowsEditor ? CommandLineFormatter.EscapeCharsWindows(unescapedAssemblyUpdaterPath) : CommandLineFormatter.EscapeCharsQuote(unescapedAssemblyUpdaterPath)); }
private string EscapeSpacesInPath(string path) { if (Application.platform == RuntimePlatform.WindowsEditor) { return(CommandLineFormatter.EscapeCharsWindows(path)); } return(CommandLineFormatter.EscapeCharsQuote(path)); }
private static string ConfigurationProviderAssembliesPathArgument(IEnumerable <string> updateConfigSourcePaths) { var paths = new StringBuilder(); foreach (var configSourcePath in updateConfigSourcePaths) { paths.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(configSourcePath)); } return(paths.ToString()); }
internal static string ArgumentsForUpdateAssembly(string assemblyPath, string tempOutputPath, IEnumerable <string> updateConfigSourcePaths) { var assemblyFullPath = ResolveAssemblyPath(assemblyPath); return("update -a " + assemblyFullPath + " --output " + CommandLineFormatter.PrepareFileName(tempOutputPath) + APIVersionArgument() + AssemblySearchPathArgument(updateConfigSourcePaths.Select(Path.GetDirectoryName).Distinct()) + ConfigurationProviderAssembliesPathArgument(updateConfigSourcePaths)); }
private static bool RunAssemblyLinker(IEnumerable <string> args, out string @out, out string err, string linkerPath, string workingDirectory) { var argString = args.Aggregate((buff, s) => buff + " " + s); var responseFile = Path.Combine(workingDirectory, "response.rsp"); File.WriteAllText(responseFile, argString); UnityLogWriter.WriteStringToUnityLog($"Invoking UnityLinker with response file. response.rsp contents: {argString}\n"); Runner.RunNetCoreProgram(linkerPath, $"@{CommandLineFormatter.PrepareFileName(responseFile)}", workingDirectory, null, null); @out = ""; err = ""; return(true); }
public static bool DoesAssemblyRequireUpgrade(string assemblyFullPath) { bool result; if (!File.Exists(assemblyFullPath)) { result = false; } else if (!AssemblyHelper.IsManagedAssembly(assemblyFullPath)) { result = false; } else if (!APIUpdaterHelper.MayContainUpdatableReferences(assemblyFullPath)) { result = false; } else { string text; string text2; int num = APIUpdaterHelper.RunUpdatingProgram("AssemblyUpdater.exe", string.Concat(new string[] { APIUpdaterHelper.TimeStampArgument(), APIUpdaterHelper.APIVersionArgument(), "--check-update-required -a ", CommandLineFormatter.PrepareFileName(assemblyFullPath), APIUpdaterHelper.AssemblySearchPathArgument(), APIUpdaterHelper.ConfigurationProviderAssembliesPathArgument() }), out text, out text2); Console.WriteLine("{0}{1}", text, text2); switch (num) { case 0: case 1: result = false; break; case 2: result = true; break; default: UnityEngine.Debug.LogError(text + Environment.NewLine + text2); result = false; break; } } return(result); }
public ManagedProgram(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables, Action <ProcessStartInfo> setupStartInfo) { string text = ManagedProgram.PathCombine(new string[] { monodistribution, "bin", "mono" }); string value = ManagedProgram.PathCombine(new string[] { monodistribution, "lib", "mono", profile }); if (Application.platform == RuntimePlatform.WindowsEditor) { text = CommandLineFormatter.PrepareFileName(text + ".exe"); } ProcessStartInfo processStartInfo = new ProcessStartInfo { Arguments = CommandLineFormatter.PrepareFileName(executable) + " " + arguments, CreateNoWindow = true, FileName = text, RedirectStandardError = true, RedirectStandardOutput = true, WorkingDirectory = Application.dataPath + "/..", UseShellExecute = false }; if (setMonoEnvironmentVariables) { processStartInfo.EnvironmentVariables["MONO_PATH"] = value; processStartInfo.EnvironmentVariables["MONO_CFG_DIR"] = ManagedProgram.PathCombine(new string[] { monodistribution, "etc" }); } if (setupStartInfo != null) { setupStartInfo(processStartInfo); } this._process.StartInfo = processStartInfo; }
public NetCoreProgram(string executable, string arguments, Action <ProcessStartInfo> setupStartInfo) { if (!IsNetCoreAvailable()) { Debug.LogError("Creating NetCoreProgram, but IsNetCoreAvailable() == false; fix the caller!"); // let it happen anyway to preserve previous behaviour } var startInfo = CreateDotNetCoreStartInfoForArgs(CommandLineFormatter.PrepareFileName(executable) + " " + arguments); if (setupStartInfo != null) { setupStartInfo(startInfo); } _process.StartInfo = startInfo; }
public void Start() { var runner = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "ILPostProcessorRunner", "ILPostProcessorRunner.exe"); if (!File.Exists(runner)) { throw new Exception(string.Format($"'{runner}' not found. Is your Unity installation corrupted?")); } var assemblyPath = AssetPath.GetFullPath(AssetPath.Combine(tempOutputDirectory, Assembly.Filename)); var assemblyReferencesPaths = Assembly.GetAllReferences().ToArray(); var assemblyFolderPaths = ilPostProcessing.AssemblySearchPaths; var outputDirectory = AssetPath.GetFullPath(tempOutputDirectory); var postProcessorPaths = ilPostProcessing.PostProcessorAssemblyPaths; var arguments = new List <string> { $"-a \"{assemblyPath}\"", $"-f \"{string.Join(",", assemblyFolderPaths)}\"", $"-r \"{string.Join(",", assemblyReferencesPaths)}\"", $"-d \"{string.Join(",", Assembly.Defines)}\"", $"-p \"{string.Join(",", postProcessorPaths)}\"", $"-o \"{outputDirectory}\"", }; var responseFilePath = PrepareFileName(AssetPath.GetFullPath(CommandLineFormatter.GenerateResponseFile(arguments))); var args = $"@{responseFilePath}"; // Always run on Mono until all ILPostProcessors have been fixed // to run on NET Core. //if (NetCoreRunProgram.IsSupported()) //{ // process = new NetCoreRunProgram(runner, args, null); //} //else { process = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, runner, args, false, null); } process.Start(); }
public void RunCompileAndLink(string il2cppBuildCacheSource) { if (string.Equals(Path.GetFullPath(il2cppBuildCacheSource), Path.GetFullPath(m_PlatformProvider.il2cppBuildCacheDirectory), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("IIl2CppPlatformProvider.il2cppBuildCacheDirectory cannot be the same as il2cppBuildCacheDirectory. You probably forgot to override il2cppBuildCacheDirectory on your IIl2CppPlatformProvider."); } var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); var buildCacheDirectory = m_PlatformProvider.il2cppBuildCacheDirectory; Directory.CreateDirectory(buildCacheDirectory); var buildCacheNativeOutputFile = Path.Combine(GetNativeOutputRelativeDirectory(buildCacheDirectory), m_PlatformProvider.nativeLibraryFileName); var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, buildCacheNativeOutputFile, m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList(); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } foreach (var buildingArgument in IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider, buildTargetGroup)) { if (!arguments.Contains(buildingArgument)) { arguments.Add(buildingArgument); } } arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(GetCppOutputDirectory(il2cppBuildCacheSource))}"); arguments.Add($"--dotnetprofile=\"{IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup), m_PlatformProvider.target)}\""); arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; RunIl2CppWithArguments(arguments, setupStartInfo); } }
private static string ConfigurationProviderAssembliesPathArgument() { var paths = new StringBuilder(); foreach (var ext in ModuleManager.packageManager.unityExtensions) { foreach (var dllPath in ext.files.Where(f => f.Value.type == Unity.DataContract.PackageFileType.Dll).Select(pi => pi.Key)) { paths.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(ext.basePath, dllPath))); } } var editorManagedPath = GetUnityEditorManagedPath(); paths.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(editorManagedPath, "UnityEngine.dll"))); paths.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(editorManagedPath, "UnityEditor.dll"))); return(paths.ToString()); }
static ProcessStartInfo CreateOSDependentStartInfo( bool isWindows, string processPath, string processArguments, string unityEditorDataDir ) { ProcessStartInfo startInfo; if (isWindows) { startInfo = new ProcessStartInfo(processPath, processArguments); } else { string runtimePath; if (File.Exists("/Library/Frameworks/Mono.framework/Commands/mono")) { runtimePath = "/Library/Frameworks/Mono.framework/Commands/mono"; } else if (File.Exists("/usr/local/bin/mono")) { runtimePath = "/usr/local/bin/mono"; } else { runtimePath = Path.Combine(unityEditorDataDir, "MonoBleedingEdge/bin/mono"); } startInfo = new ProcessStartInfo(runtimePath, $"{CommandLineFormatter.PrepareFileName(processPath)} {processArguments}"); } var vars = startInfo.EnvironmentVariables; vars.Add("UNITY_DATA", unityEditorDataDir); // vars["RoslynCommandLineLogFile"] = Path.Combine(Directory.GetCurrentDirectory(), "clogs"); startInfo.CreateNoWindow = true; startInfo.WorkingDirectory = Application.dataPath + "/.."; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; startInfo.UseShellExecute = false; return(startInfo); }
private static string ConfigurationProviderAssembliesPathArgument() { StringBuilder stringBuilder = new StringBuilder(); foreach (Unity.DataContract.PackageInfo current in ModuleManager.packageManager.unityExtensions) { foreach (string current2 in from f in current.files where f.Value.type == PackageFileType.Dll select f into pi select pi.Key) { stringBuilder.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(current.basePath, current2))); } } string unityEditorManagedPath = APIUpdaterHelper.GetUnityEditorManagedPath(); stringBuilder.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(unityEditorManagedPath, "UnityEngine.dll"))); stringBuilder.AppendFormat(" {0}", CommandLineFormatter.PrepareFileName(Path.Combine(unityEditorManagedPath, "UnityEditor.dll"))); return(stringBuilder.ToString()); }
public ManagedProgram(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables) { string str1 = ManagedProgram.PathCombine(monodistribution, "bin", "mono"); string str2 = ManagedProgram.PathCombine(monodistribution, "lib", "mono", profile); if (Application.platform == RuntimePlatform.WindowsEditor) { str1 = CommandLineFormatter.PrepareFileName(str1 + ".exe"); } ProcessStartInfo processStartInfo = new ProcessStartInfo() { Arguments = CommandLineFormatter.PrepareFileName(executable) + " " + arguments, CreateNoWindow = true, FileName = str1, RedirectStandardError = true, RedirectStandardOutput = true, WorkingDirectory = Application.dataPath + "/..", UseShellExecute = false }; if (setMonoEnvironmentVariables) { processStartInfo.EnvironmentVariables["MONO_PATH"] = str2; processStartInfo.EnvironmentVariables["MONO_CFG_DIR"] = ManagedProgram.PathCombine(monodistribution, "etc"); } this._process.StartInfo = processStartInfo; }
private static string ConfigurationProviderAssembliesPathArgument() { StringBuilder stringBuilder = new StringBuilder(); using (IEnumerator <PackageInfo> enumerator = ModuleManager.packageManager.get_unityExtensions().GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { PackageInfo current = enumerator.Current; foreach (string path2 in ((IEnumerable <KeyValuePair <string, PackageFileData> >)current.get_files()).Where <KeyValuePair <string, PackageFileData> >((Func <KeyValuePair <string, PackageFileData>, bool>)(f => f.Value.type == 3)).Select <KeyValuePair <string, PackageFileData>, string>((Func <KeyValuePair <string, PackageFileData>, string>)(pi => pi.Key))) { stringBuilder.AppendFormat(" {0}", (object)CommandLineFormatter.PrepareFileName(Path.Combine((string)current.basePath, path2))); } } } string editorManagedPath = APIUpdaterHelper.GetUnityEditorManagedPath(); stringBuilder.AppendFormat(" {0}", (object)CommandLineFormatter.PrepareFileName(Path.Combine(editorManagedPath, "UnityEngine.dll"))); stringBuilder.AppendFormat(" {0}", (object)CommandLineFormatter.PrepareFileName(Path.Combine(editorManagedPath, "UnityEditor.dll"))); return(stringBuilder.ToString()); }
public NetCoreRunProgram(string executable, string arguments, Action <ProcessStartInfo> setupStartInfo) { if (!IsSupported()) { throw new NotSupportedException("NetCoreRunProgram is not supported on this platform"); } var startInfo = new ProcessStartInfo { FileName = netcoreRunPath, Arguments = $"{CommandLineFormatter.PrepareFileName(executable)} {arguments}", CreateNoWindow = true }; if (setupStartInfo != null) { setupStartInfo(startInfo); } _process.StartInfo = startInfo; }
public ManagedProgram(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables, Action <ProcessStartInfo> setupStartInfo) { var monoexe = PathCombine(monodistribution, "bin", "mono"); if (Application.platform == RuntimePlatform.WindowsEditor) { monoexe = CommandLineFormatter.PrepareFileName(monoexe + ".exe"); } var startInfo = new ProcessStartInfo { Arguments = CommandLineFormatter.PrepareFileName(executable) + " " + arguments, CreateNoWindow = true, FileName = monoexe, RedirectStandardError = true, RedirectStandardOutput = true, WorkingDirectory = Application.dataPath + "/..", UseShellExecute = false }; if (setMonoEnvironmentVariables) { var profileAbspath = PathCombine(monodistribution, "lib", "mono", profile); startInfo.EnvironmentVariables["MONO_PATH"] = profileAbspath; startInfo.EnvironmentVariables["MONO_CFG_DIR"] = PathCombine(monodistribution, "etc"); } // if you ever need to debug assembly loading, uncomment the following two lines //startInfo.EnvironmentVariables["MONO_LOG_LEVEL"] = "info"; //startInfo.EnvironmentVariables["MONO_LOG_MASK"] = "asm"; if (setupStartInfo != null) { setupStartInfo(startInfo); } _process.StartInfo = startInfo; }
internal static int Run(string arguments, string workingDir, out string stdOut, out string stdErr) { var assemblyUpdaterPath = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/AssemblyUpdater.exe"; var monodistribution = MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"); var monoexe = Path.Combine(monodistribution, "bin/mono"); if (Application.platform == RuntimePlatform.WindowsEditor) { monoexe = Application.platform == RuntimePlatform.WindowsEditor ? CommandLineFormatter.EscapeCharsWindows(monoexe + ".exe") : CommandLineFormatter.EscapeCharsQuote(monoexe + ".exe"); } var startInfo = new ProcessStartInfo { Arguments = assemblyUpdaterPath + " " + arguments, CreateNoWindow = true, FileName = monoexe, RedirectStandardError = true, RedirectStandardOutput = true, WorkingDirectory = workingDir, UseShellExecute = false }; var assemblyUpdaterProcess = new Program(startInfo); assemblyUpdaterProcess.LogProcessStartInfo(); assemblyUpdaterProcess.Start(); assemblyUpdaterProcess.WaitForExit(); stdOut = assemblyUpdaterProcess.GetStandardOutputAsString(); stdErr = string.Join("\r\n", assemblyUpdaterProcess.GetErrorOutput()); return(assemblyUpdaterProcess.ExitCode); }
private (int exitCode, IList <string> lines) Format( bool skipWrite = false, bool check = false, bool writeStdout = false, string standardInFileContents = null, params string[] directoryOrFilePaths ) { if (directoryOrFilePaths.Length == 0) { directoryOrFilePaths = new[] { GetRootPath() }; } else { directoryOrFilePaths = directoryOrFilePaths.Select( o => this.fileSystem.Path.Combine(GetRootPath(), o) ) .ToArray(); } var fakeConsole = new TestConsole(); var result = CommandLineFormatter.Format( new CommandLineOptions { DirectoryOrFilePaths = directoryOrFilePaths, SkipWrite = skipWrite, Check = check, WriteStdout = writeStdout, StandardInFileContents = standardInFileContents, }, this.fileSystem, fakeConsole, CancellationToken.None ).Result; return(result, fakeConsole.Lines); }
public static bool DoesAssemblyRequireUpgrade(string assetFullPath) { if (!File.Exists(assetFullPath)) { return(false); } if (!InternalEditorUtility.DetectDotNetDll(assetFullPath)) { return(false); } string text; string text2; int num = APIUpdaterHelper.RunUpdatingProgram("AssemblyUpdater.exe", string.Concat(new string[] { APIUpdaterHelper.TimeStampArgument(), APIUpdaterHelper.APIVersionArgument(), "--check-update-required -a ", CommandLineFormatter.PrepareFileName(assetFullPath), APIUpdaterHelper.AssemblySearchPathArgument() }), out text, out text2); Console.WriteLine("{0}{1}", text, text2); switch (num) { case 0: case 1: return(false); case 2: return(true); default: UnityEngine.Debug.LogError(text + Environment.NewLine + text2); return(false); } }
public NetCoreProgram(string executable, string arguments, Action <ProcessStartInfo> setupStartInfo) { if (!NetCoreProgram.IsNetCoreAvailable()) { UnityEngine.Debug.LogError("Creating NetCoreProgram, but IsNetCoreAvailable() == false; fix the caller!"); } ProcessStartInfo processStartInfo = NetCoreProgram.CreateDotNetCoreStartInfoForArgs(CommandLineFormatter.PrepareFileName(executable) + " " + arguments); if (setupStartInfo != null) { setupStartInfo(processStartInfo); } this._process.StartInfo = processStartInfo; }
private static string AssemblySearchPathArgument() { return(" -e " + CommandLineFormatter.PrepareFileName(GetUnityEditorManagedPath()) + " -p " + CommandLineFormatter.PrepareFileName(Application.dataPath)); }
public static bool DoesAssemblyRequireUpgrade(string assemblyFullPath) { if (!File.Exists(assemblyFullPath)) { return(false); } if (!AssemblyHelper.IsManagedAssembly(assemblyFullPath)) { return(false); } if (!MayContainUpdatableReferences(assemblyFullPath)) { return(false); } string stdOut, stdErr; var ret = RunUpdatingProgram("AssemblyUpdater.exe", TimeStampArgument() + APIVersionArgument() + "--check-update-required -a " + CommandLineFormatter.PrepareFileName(assemblyFullPath) + AssemblySearchPathArgument() + ConfigurationProviderAssembliesPathArgument(), out stdOut, out stdErr); { Console.WriteLine("{0}{1}", stdOut, stdErr); switch (ret) { // See AssemblyUpdater/Program.cs case 0: case 1: return(false); case 2: return(true); default: Debug.LogError(stdOut + Environment.NewLine + stdErr); return(false); } } }
private static bool StripAssembliesTo(string[] assemblies, string[] searchDirs, string outputFolder, string workingDirectory, out string output, out string error, string linkerPath, IIl2CppPlatformProvider platformProvider, IEnumerable <string> additionalBlacklist, BuildTargetGroup buildTargetGroup, ManagedStrippingLevel managedStrippingLevel) { if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } additionalBlacklist = additionalBlacklist.Select(s => Path.IsPathRooted(s) ? s : Path.Combine(workingDirectory, s)).Where(File.Exists); var userBlackLists = GetUserBlacklistFiles(); foreach (var ub in userBlackLists) { Console.WriteLine("UserBlackList: " + ub); } additionalBlacklist = additionalBlacklist.Concat(userBlackLists); var args = new List <string> { "-out=\"" + outputFolder + "\"", "-x=\"" + GetModuleWhitelist("Core", platformProvider.moduleStrippingInformationFolder) + "\"", }; args.AddRange(additionalBlacklist.Select(path => "-x \"" + path + "\"")); args.AddRange(searchDirs.Select(d => "-d \"" + d + "\"")); args.AddRange(assemblies.Select(assembly => "--include-unity-root-assembly=\"" + Path.GetFullPath(assembly) + "\"")); args.Add($"--dotnetruntime={GetRuntimeArgumentValueForLinker(buildTargetGroup)}"); args.Add($"--dotnetprofile={GetProfileArgumentValueForLinker(buildTargetGroup)}"); args.Add("--use-editor-options"); args.Add($"--include-directory={CommandLineFormatter.PrepareFileName(workingDirectory)}"); if (EditorUserBuildSettings.allowDebugging) { args.Add("--editor-settings-flag=AllowDebugging"); } if (EditorUserBuildSettings.development) { args.Add("--editor-settings-flag=Development"); } args.Add($"--rule-set={GetRuleSetForStrippingLevel(managedStrippingLevel)}"); // One final check to make sure we only run high on latest runtime. if ((managedStrippingLevel == ManagedStrippingLevel.High) && (PlayerSettingsEditor.IsLatestApiCompatibility(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup)))) { // Prepare the arguments to run the UnityLinker. When in high mode, need to also // supply the IL2CPP compiler platform and compiler architecture. When the scripting backend // is not IL2CPP, we have to map those strings and use a utility function to figure out proper strings. // Currently only need to do this on the non aot platforms of Android, Windows, Mac, Linux. var compilerPlatform = ""; var compilerArchitecture = ""; Il2CppNativeCodeBuilder il2cppNativeCodeBuilder = platformProvider.CreateIl2CppNativeCodeBuilder(); if (il2cppNativeCodeBuilder != null) { compilerPlatform = il2cppNativeCodeBuilder.CompilerPlatform; compilerArchitecture = il2cppNativeCodeBuilder.CompilerArchitecture; } else { GetUnityLinkerPlatformStringsFromBuildTarget(platformProvider.target, out compilerPlatform, out compilerArchitecture); } args.Add($"--platform={compilerPlatform}"); if (platformProvider.target != BuildTarget.Android) { args.Add($"--architecture={compilerArchitecture}"); } } var additionalArgs = System.Environment.GetEnvironmentVariable("UNITYLINKER_ADDITIONAL_ARGS"); if (!string.IsNullOrEmpty(additionalArgs)) { args.Add(additionalArgs); } additionalArgs = Debug.GetDiagnosticSwitch("VMUnityLinkerAdditionalArgs") as string; if (!string.IsNullOrEmpty(additionalArgs)) { args.Add(additionalArgs.Trim('\'')); } return(RunAssemblyLinker(args, out output, out error, linkerPath, workingDirectory)); }
private static string AssemblySearchPathArgument() { return(" -s " + CommandLineFormatter.PrepareFileName(APIUpdaterHelper.GetUnityEngineDLLPath()) + ",+" + CommandLineFormatter.PrepareFileName(Application.dataPath)); }
private static string AssemblySearchPathArgument() { string[] textArray1 = new string[] { " -s ", CommandLineFormatter.PrepareFileName(Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Managed")), ",+", CommandLineFormatter.PrepareFileName(Path.Combine(EditorApplication.applicationContentsPath, "UnityExtensions/Unity")), ",+", CommandLineFormatter.PrepareFileName(Application.dataPath) }; return(string.Concat(textArray1)); }
private static string ResolveAssemblyPath(string assemblyPath) { return(CommandLineFormatter.PrepareFileName(assemblyPath)); }
private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data, string outputDirectory, string workingDirectory, bool platformSupportsManagedDebugging) { ProcessBuildPipelineOnBeforeConvertRun(m_PlatformProvider.buildReport, data); var arguments = new List <string>(); arguments.Add("--convert-to-cpp"); if (m_PlatformProvider.emitNullChecks) { arguments.Add("--emit-null-checks"); } if (m_PlatformProvider.enableStackTraces) { arguments.Add("--enable-stacktrace"); } if (m_PlatformProvider.enableArrayBoundsCheck) { arguments.Add("--enable-array-bounds-check"); } if (m_PlatformProvider.enableDivideByZeroCheck) { arguments.Add("--enable-divide-by-zero-check"); } if (m_PlatformProvider.development && m_PlatformProvider.enableDeepProfilingSupport) { arguments.Add("--enable-deep-profiler"); } if (m_BuildForMonoRuntime) { arguments.Add("--mono-runtime"); } var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(apiCompatibilityLevel))); var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); arguments.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration)); } arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); arguments.AddRange(IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--directory={CommandLineFormatter.PrepareFileName(Path.GetFullPath(data.inputDirectory))}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(Path.GetFullPath(outputDirectory))}"); // NOTE: any arguments added here that affect how generated code is built need // to also be added to PlatformDependent\Win\Extensions\Managed\VisualStudioProjectHelpers.cs // as that file generated project files that invoke back into IL2CPP in order to build // generated code string progressMessage = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { progressMessage = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", progressMessage, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; } if (PlayerBuildInterface.ExtraTypesProvider != null) { var extraTypes = new HashSet <string>(); foreach (var extraType in PlayerBuildInterface.ExtraTypesProvider()) { extraTypes.Add(extraType); } var tempFile = Path.GetFullPath(Path.Combine(m_TempFolder, "extra-types.txt")); File.WriteAllLines(tempFile, extraTypes.ToArray()); arguments.Add($"--extra-types-file={CommandLineFormatter.PrepareFileName(tempFile)}"); } RunIl2CppWithArguments(arguments, setupStartInfo, workingDirectory); }