コード例 #1
0
    static void Run()
    {
        string pathToAssetServer = Path.Combine(Application.dataPath, "AssetBundleManager/Editor/AssetBundleServer.exe");
        string pathToApp         = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));

        KillRunningAssetBundleServer();

        //BuildScript.WriteServerURL();

        string args = Path.Combine(pathToApp, "AssetBundles");

        args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id);
        ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", pathToAssetServer, args, true);

        startInfo.WorkingDirectory = Path.Combine(System.Environment.CurrentDirectory, "AssetBundles");
        startInfo.UseShellExecute  = false;
        Process launchProcess = Process.Start(startInfo);

        if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0)
        {
            //Unable to start process
            UnityEngine.Debug.LogError("Unable Start AssetBundleServer process");
        }
        else
        {
            //We seem to have launched, let's save the PID
            instance.m_ServerPID = launchProcess.Id;
        }
    }
コード例 #2
0
        internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser, Action <ProcessStartInfo> setupStartInfo)
        {
            Program p;

            // Run on .NET if running on windows
            // It's twice as fast as Mono for IL2CPP.exe
            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                var startInfo = new ProcessStartInfo()
                {
                    Arguments      = args,
                    CreateNoWindow = true,
                    FileName       = exe
                };

                if (setupStartInfo != null)
                {
                    setupStartInfo(startInfo);
                }

                p = new Program(startInfo);
            }
            else
            {
                p = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, exe, args, false, setupStartInfo);
            }

            RunProgram(p, exe, args, workingDirectory, parser);
        }
コード例 #3
0
ファイル: Runner.cs プロジェクト: zhkuang/UnityDecompiled
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
 {
     using (ManagedProgram managedProgram = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args))
     {
         managedProgram.GetProcessStartInfo().WorkingDirectory = workingDirectory;
         managedProgram.Start();
         managedProgram.WaitForExit();
         if (managedProgram.ExitCode != 0)
         {
             if (parser != null)
             {
                 string[] errorOutput    = managedProgram.GetErrorOutput();
                 string[] standardOutput = managedProgram.GetStandardOutput();
                 IEnumerable <CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
                 foreach (CompilerMessage current in enumerable)
                 {
                     Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
                 }
             }
             Debug.LogError(string.Concat(new string[]
             {
                 "Failed running ",
                 exe,
                 " ",
                 args,
                 "\n\n",
                 managedProgram.GetAllOutput()
             }));
             throw new Exception(string.Format("{0} did not run properly!", exe));
         }
     }
 }
コード例 #4
0
            private static void RunManagedProgram(
                string exe,
                string args,
                string workingDirectory,
                CompilerOutputParserBase parser,
                BuildReport report)
            {
                Program p;

                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    ProcessStartInfo si = new ProcessStartInfo()
                    {
                        Arguments      = args,
                        CreateNoWindow = true,
                        FileName       = exe
                    };
                    p = new Program(si);
                }
                else
                {
                    p = (Program) new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), (string)null, exe, args, false, null);
                }

                RunProgram(p, exe, args, workingDirectory, parser, report);
            }
コード例 #5
0
ファイル: Runner.cs プロジェクト: lsx6244413/UnityDecomplie
        internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser, Action <ProcessStartInfo> setupStartInfo)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Program program;

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    Arguments      = args,
                    CreateNoWindow = true,
                    FileName       = exe
                };
                if (setupStartInfo != null)
                {
                    setupStartInfo(processStartInfo);
                }
                program = new Program(processStartInfo);
            }
            else
            {
                program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, exe, args, false, setupStartInfo);
            }
            using (program)
            {
                program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
                program.Start();
                program.WaitForExit();
                stopwatch.Stop();
                Console.WriteLine("{0} exited after {1} ms.", exe, stopwatch.ElapsedMilliseconds);
                if (program.ExitCode != 0)
                {
                    if (parser != null)
                    {
                        string[] errorOutput    = program.GetErrorOutput();
                        string[] standardOutput = program.GetStandardOutput();
                        IEnumerable <CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
                        foreach (CompilerMessage current in enumerable)
                        {
                            UnityEngine.Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
                        }
                    }
                    UnityEngine.Debug.LogError(string.Concat(new string[]
                    {
                        "Failed running ",
                        exe,
                        " ",
                        args,
                        "\n\n",
                        program.GetAllOutput()
                    }));
                    throw new Exception(string.Format("{0} did not run properly!", exe));
                }
            }
        }
コード例 #6
0
        protected ManagedProgram StartCompiler(BuildTarget target, string compiler, List <string> arguments, string profileDirectory)
        {
            AddCustomResponseFileIfPresent(arguments, Path.GetFileNameWithoutExtension(compiler) + ".rsp");

            var monoInstallation = PlayerSettingsEditor.IsLatestApiCompatibility(m_Island._api_compatibility_level)
                ? MonoInstallationFinder.GetMonoBleedingEdgeInstallation()
                : MonoInstallationFinder.GetMonoInstallation();

            return(StartCompiler(target, compiler, arguments, profileDirectory, true, monoInstallation));
        }
コード例 #7
0
        private static void RunUpdatingProgram(string executable, string arguments)
        {
            ManagedProgram program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.5", EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/" + executable, arguments);

            program.LogProcessStartInfo();
            program.Start();
            program.WaitForExit();
            Console.WriteLine(string.Join(Environment.NewLine, program.GetStandardOutput()));
            APIUpdaterHelper.HandleUpdaterReturnValue(program);
        }
コード例 #8
0
        internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
        {
            Program   program;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                ProcessStartInfo si = new ProcessStartInfo {
                    Arguments      = args,
                    CreateNoWindow = true,
                    FileName       = exe
                };
                program = new Program(si);
            }
            else
            {
                program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args);
            }
            using (program)
            {
                program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
                program.Start();
                program.WaitForExit();
                stopwatch.Stop();
                Console.WriteLine("{0} exited after {1} ms.", exe, stopwatch.ElapsedMilliseconds);
                if (program.ExitCode != 0)
                {
                    if (parser != null)
                    {
                        string[] errorOutput    = program.GetErrorOutput();
                        string[] standardOutput = program.GetStandardOutput();
                        IEnumerator <CompilerMessage> enumerator = parser.Parse(errorOutput, standardOutput, true).GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                CompilerMessage current = enumerator.Current;
                                Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
                            }
                        }
                        finally
                        {
                            if (enumerator == null)
                            {
                            }
                            enumerator.Dispose();
                        }
                    }
                    Debug.LogError("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput());
                    throw new Exception(string.Format("{0} did not run properly!", exe));
                }
            }
        }
コード例 #9
0
        private static int RunUpdatingProgram(string executable, string arguments, out string stdOut, out string stdErr)
        {
            ManagedProgram managedProgram = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/" + executable, arguments);

            managedProgram.LogProcessStartInfo();
            managedProgram.Start();
            managedProgram.WaitForExit();
            stdOut = managedProgram.GetStandardOutputAsString();
            stdErr = string.Join("\r\n", managedProgram.GetErrorOutput());
            return(managedProgram.ExitCode);
        }
コード例 #10
0
        static void RunUpdatingProgram(string executable, string arguments, string tempOutputPath)
        {
            var scriptUpdater = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/" + executable;
            var program       = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, scriptUpdater, arguments, false, null);

            program.LogProcessStartInfo();
            program.Start();
            program.WaitForExit();

            Console.WriteLine(string.Join(Environment.NewLine, program.GetStandardOutput()));

            HandleUpdaterReturnValue(program, tempOutputPath);
        }
コード例 #11
0
        protected ManagedProgram StartCompiler(BuildTarget target, string compiler, List <string> arguments, bool setMonoEnvironmentVariables)
        {
            base.AddCustomResponseFileIfPresent(arguments, Path.GetFileNameWithoutExtension(compiler) + ".rsp");
            string responseFile = CommandLineFormatter.GenerateResponseFile(arguments);

            if (this.runUpdater)
            {
                UnityEditor.Scripting.Compilers.APIUpdaterHelper.UpdateScripts(responseFile, this._island.GetExtensionOfSourceFiles());
            }
            ManagedProgram program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation(), this._island._classlib_profile, compiler, " @" + responseFile, setMonoEnvironmentVariables);

            program.Start();
            return(program);
        }
コード例 #12
0
        static void RunUpdatingProgram(string executable, string arguments, string tempOutputPath, bool anyFileInAssetsFolder)
        {
            var scriptUpdaterPath = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/" + executable; // ManagedProgram will quote this path for us.

            using (var program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, scriptUpdaterPath, arguments, false, null))
            {
                program.LogProcessStartInfo();
                program.Start();
                program.WaitForExit();

                Console.WriteLine(string.Join(Environment.NewLine, program.GetStandardOutput()));

                HandleUpdaterReturnValue(program, tempOutputPath, anyFileInAssetsFolder);
            }
        }
コード例 #13
0
 private void Create(string _path, int _port)
 {
     string str2;
     string executable = EmscriptenPaths.buildToolsDir + "/SimpleWebServer.exe";
     object[] objArray1 = new object[] { "\"", _path, "\" ", _port, " ", Process.GetCurrentProcess().Id };
     ManagedProgram program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("Mono"), "2.0", executable, string.Concat(objArray1), null);
     program._process.Start();
     do
     {
         str2 = program._process.StandardOutput.ReadLine();
     }
     while ((str2 != null) && !str2.Contains("Starting web server"));
     this.path = _path;
     this.port = _port;
     this.pid = program._process.Id;
     this.time = program._process.StartTime.ToString();
     this.Save(true);
 }
コード例 #14
0
        private static void RunUpdatingProgram(string executable, string arguments)
        {
            string         executable2    = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/" + executable;
            ManagedProgram managedProgram = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.5", executable2, arguments);

            managedProgram.LogProcessStartInfo();
            managedProgram.Start();
            managedProgram.WaitForExit();
            Console.WriteLine(string.Join(Environment.NewLine, managedProgram.GetStandardOutput()));
            if (managedProgram.ExitCode == 0)
            {
                APIUpdaterHelper.UpdateFilesInVCIfNeeded();
            }
            else
            {
                APIUpdaterHelper.ReportAPIUpdaterFailure(managedProgram.GetErrorOutput());
            }
        }
コード例 #15
0
        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();
        }
コード例 #16
0
ファイル: Runner.cs プロジェクト: zlhtech/unity-decompiled
        internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Program program;

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                program = new Program(new ProcessStartInfo()
                {
                    Arguments      = args,
                    CreateNoWindow = true,
                    FileName       = exe
                });
            }
            else
            {
                program = (Program) new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args);
            }
            using (program)
            {
                program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
                program.Start();
                program.WaitForExit();
                stopwatch.Stop();
                Console.WriteLine("{0} exited after {1} ms.", (object)exe, (object)stopwatch.ElapsedMilliseconds);
                if (program.ExitCode != 0)
                {
                    if (parser != null)
                    {
                        string[] errorOutput    = program.GetErrorOutput();
                        string[] standardOutput = program.GetStandardOutput();
                        foreach (CompilerMessage compilerMessage in parser.Parse(errorOutput, standardOutput, true))
                        {
                            UnityEngine.Debug.LogPlayerBuildError(compilerMessage.message, compilerMessage.file, compilerMessage.line, compilerMessage.column);
                        }
                    }
                    UnityEngine.Debug.LogError((object)("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput()));
                    throw new Exception(string.Format("{0} did not run properly!", (object)exe));
                }
            }
        }
コード例 #17
0
        public static Process PrepareMonoProcess(string workDir)
        {
            Process process = new Process();
            string  text    = (Application.platform != RuntimePlatform.WindowsEditor) ? "mono" : "mono.exe";

            process.StartInfo.FileName = Paths.Combine(new string[]
            {
                MonoInstallationFinder.GetMonoInstallation(),
                "bin",
                text
            });
            process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5";
            string profile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_2_0);

            process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoInstallationFinder.GetProfileDirectory(profile);
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.WorkingDirectory       = workDir;
            return(process);
        }
コード例 #18
0
        public void ExecuteAsync(BuildPlayerDataGeneratorOptions options)
        {
            Program typeDbGeneratorProcess;
            var     arguments = OptionsToStringArgument(options);

            if (NetCoreRunProgram.IsSupported())
            {
                typeDbGeneratorProcess = new NetCoreRunProgram(buildDataGeneratorPath, arguments, null);
            }
            else
            {
                typeDbGeneratorProcess =
                    new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null,
                                       buildDataGeneratorPath, arguments, false, null);
            }

            typeDbGeneratorProcess.Start((s, e) =>
            {
                ProcessExit(typeDbGeneratorProcess);
            });
            runningProcesses.Add(typeDbGeneratorProcess);
        }
コード例 #19
0
        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);
        }
コード例 #20
0
        public static Process PrepareMonoProcess(string workDir)
        {
            var process = new Process();

            var executableName = Application.platform == RuntimePlatform.WindowsEditor ? "mono.exe" : "mono";

            process.StartInfo.FileName = Paths.Combine(MonoInstallationFinder.GetMonoInstallation(), "bin", executableName);

            // ;; TODO fix this hack for strange process handle duplication problem inside mono
            process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5";

            // We run the linker on .NET 2.0 profile
            var monoProfile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_2_0);

            process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoInstallationFinder.GetProfileDirectory(monoProfile);
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.CreateNoWindow         = true;

            process.StartInfo.WorkingDirectory = workDir;

            return(process);
        }
コード例 #21
0
        protected override Program StartCompiler()
        {
            var arguments = new List <string>
            {
                "-debug",
                "-target:library",
                "-nowarn:0169",
                "-langversion:" + ((EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest) ? "6" : "4"),
                "-out:" + PrepareFileName(m_Island._output),
                "-nostdlib",
            };

            if (m_Island._allowUnsafeCode)
            {
                arguments.Add("-unsafe");
            }

            if (!m_Island._development_player && !m_Island._editor)
            {
                arguments.Add("-optimize");
            }

            foreach (string dll in m_Island._references)
            {
                arguments.Add("-r:" + PrepareFileName(dll));
            }
            foreach (string define in m_Island._defines.Distinct())
            {
                arguments.Add("-define:" + define);
            }

            var pathMappings = new List <string>(m_Island._files.Length);

            foreach (string source in m_Island._files)
            {
                var preparedFileName = PrepareFileName(source);
                if (preparedFileName != source)
                {
                    pathMappings.Add(preparedFileName + " => " + source);
                }

                arguments.Add(preparedFileName);
            }

            var responseFiles = m_Island._responseFiles?.ToDictionary(Path.GetFileName) ?? new Dictionary <string, string>();

            KeyValuePair <string, string> obsoleteResponseFile = responseFiles
                                                                 .SingleOrDefault(x => CompilerSpecificResponseFiles.MonoCSharpCompilerObsolete.Contains(x.Key));

            if (!string.IsNullOrEmpty(obsoleteResponseFile.Key))
            {
                if (m_Island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0_Subset)
                {
                    Debug.LogWarning($"Using obsolete custom response file '{obsoleteResponseFile.Key}'. Please use '{ResponseFilename}' instead.");
                }
                else
                {
                    responseFiles.Remove(obsoleteResponseFile.Key);
                }
            }

            foreach (var responseFile in responseFiles)
            {
                AddResponseFileToArguments(arguments, responseFile.Value);
            }

            return(StartCompiler(
                       m_Island._target,
                       GetCompilerPath(),
                       arguments,
                       BuildPipeline.CompatibilityProfileToClassLibFolder(m_Island._api_compatibility_level),
                       false,
                       MonoInstallationFinder.GetMonoInstallation(MonoInstallationFinder.MonoBleedingEdgeInstallation),
                       pathMappings
                       ));
        }
コード例 #22
0
        protected override Program StartCompiler()
        {
            List <string> list = new List <string>
            {
                "-debug",
                "-target:library",
                "-nowarn:0169",
                "-langversion:" + ((EditorApplication.scriptingRuntimeVersion != ScriptingRuntimeVersion.Latest) ? "4" : "6"),
                "-out:" + ScriptCompilerBase.PrepareFileName(this._island._output),
                "-nostdlib",
                "-unsafe"
            };

            if (!this._island._development_player && !this._island._editor)
            {
                list.Add("-optimize");
            }
            string[] references = this._island._references;
            for (int i = 0; i < references.Length; i++)
            {
                string fileName = references[i];
                list.Add("-r:" + ScriptCompilerBase.PrepareFileName(fileName));
            }
            foreach (string current in this._island._defines.Distinct <string>())
            {
                list.Add("-define:" + current);
            }
            string[] files = this._island._files;
            for (int j = 0; j < files.Length; j++)
            {
                string fileName2 = files[j];
                list.Add(ScriptCompilerBase.PrepareFileName(fileName2));
            }
            if (!base.AddCustomResponseFileIfPresent(list, MonoCSharpCompiler.ReponseFilename))
            {
                if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0_Subset && base.AddCustomResponseFileIfPresent(list, "smcs.rsp"))
                {
                    Debug.LogWarning(string.Format("Using obsolete custom response file 'smcs.rsp'. Please use '{0}' instead.", MonoCSharpCompiler.ReponseFilename));
                }
                else if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0 && base.AddCustomResponseFileIfPresent(list, "gmcs.rsp"))
                {
                    Debug.LogWarning(string.Format("Using obsolete custom response file 'gmcs.rsp'. Please use '{0}' instead.", MonoCSharpCompiler.ReponseFilename));
                }
            }
            return(base.StartCompiler(this._island._target, this.GetCompilerPath(list), list, false, MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge")));
        }
コード例 #23
0
    private static string GetProfileDirectory(string profile, string monoInstallation)
    {
        string monoInstallation2 = MonoInstallationFinder.GetMonoInstallation(monoInstallation);

        return(Path.Combine(monoInstallation2, Path.Combine("lib", Path.Combine("mono", profile))));
    }
コード例 #24
0
ファイル: Weaver.cs プロジェクト: wensincai/Unity5.4
 private static ManagedProgram ManagedProgramFor(string exe, string arguments)
 {
     return(new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, arguments, null));
 }
コード例 #25
0
        protected override Program StartCompiler()
        {
            List <string> list = new List <string>
            {
                "-debug",
                "-target:library",
                "-nowarn:0169",
                "-langversion:4",
                "-out:" + ScriptCompilerBase.PrepareFileName(this._island._output),
                "-unsafe"
            };

            if (!this._island._development_player && !this._island._editor)
            {
                list.Add("-optimize");
            }
            string[] references = this._island._references;
            for (int i = 0; i < references.Length; i++)
            {
                string fileName = references[i];
                list.Add("-r:" + ScriptCompilerBase.PrepareFileName(fileName));
            }
            foreach (string current in this._island._defines.Distinct <string>())
            {
                list.Add("-define:" + current);
            }
            string[] files = this._island._files;
            for (int j = 0; j < files.Length; j++)
            {
                string fileName2 = files[j];
                list.Add(ScriptCompilerBase.PrepareFileName(fileName2));
            }
            string profile          = (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_2_0) ? base.GetMonoProfileLibDirectory() : "2.0-api";
            string profileDirectory = MonoInstallationFinder.GetProfileDirectory(profile, "MonoBleedingEdge");

            string[] additionalReferences = this.GetAdditionalReferences();
            for (int k = 0; k < additionalReferences.Length; k++)
            {
                string path = additionalReferences[k];
                string text = Path.Combine(profileDirectory, path);
                if (File.Exists(text))
                {
                    list.Add("-r:" + ScriptCompilerBase.PrepareFileName(text));
                }
            }
            if (!base.AddCustomResponseFileIfPresent(list, "mcs.rsp"))
            {
                if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0_Subset && base.AddCustomResponseFileIfPresent(list, "smcs.rsp"))
                {
                    Debug.LogWarning("Using obsolete custom response file 'smcs.rsp'. Please use 'mcs.rsp' instead.");
                }
                else if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0 && base.AddCustomResponseFileIfPresent(list, "gmcs.rsp"))
                {
                    Debug.LogWarning("Using obsolete custom response file 'gmcs.rsp'. Please use 'mcs.rsp' instead.");
                }
            }
            return(base.StartCompiler(this._island._target, this.GetCompilerPath(list), list, false, MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge")));
        }
コード例 #26
0
 protected ManagedProgram StartCompiler(BuildTarget target, string compiler, List <string> arguments)
 {
     base.AddCustomResponseFileIfPresent(arguments, Path.GetFileNameWithoutExtension(compiler) + ".rsp");
     return(this.StartCompiler(target, compiler, arguments, true, MonoInstallationFinder.GetMonoInstallation()));
 }
コード例 #27
0
 private static ManagedProgram ManagedProgramFor(string exe, string arguments) =>
 new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, exe, arguments, false, null);
コード例 #28
0
        private string GetMonoBleedingEdgeExe()
        {
            var path = Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "bin");

            return(Path.Combine(path, "mono"));
        }
コード例 #29
0
        protected ManagedProgram StartCompiler(BuildTarget target, string compiler, List <string> arguments)
        {
            base.AddCustomResponseFileIfPresent(arguments, Path.GetFileNameWithoutExtension(compiler) + ".rsp");
            string monodistro = (!PlayerSettingsEditor.IsLatestApiCompatibility(this._island._api_compatibility_level)) ? MonoInstallationFinder.GetMonoInstallation() : MonoInstallationFinder.GetMonoBleedingEdgeInstallation();

            return(this.StartCompiler(target, compiler, arguments, true, monodistro));
        }
コード例 #30
0
        protected override Program StartCompiler()
        {
            var arguments = new List <string>
            {
                "-debug",
                "-target:library",
                "-nowarn:0169",
                "-langversion:" + ((EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest) ? "6" : "4"),
                "-out:" + PrepareFileName(m_Island._output),
                "-nostdlib",
            };

            if (m_Island._allowUnsafeCode)
            {
                arguments.Add("-unsafe");
            }

            if (!m_Island._development_player && !m_Island._editor)
            {
                arguments.Add("-optimize");
            }

            foreach (string dll in m_Island._references)
            {
                arguments.Add("-r:" + PrepareFileName(dll));
            }
            foreach (string define in m_Island._defines.Distinct())
            {
                arguments.Add("-define:" + define);
            }

            var pathMappings = new List <string>(m_Island._files.Length);

            foreach (string source in m_Island._files)
            {
                var preparedFileName = PrepareFileName(source);
                if (preparedFileName != source)
                {
                    pathMappings.Add(preparedFileName + " => " + source);
                }

                arguments.Add(preparedFileName);
            }

            if (!AddCustomResponseFileIfPresent(arguments, ResponseFilename))
            {
                if (m_Island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0_Subset &&
                    AddCustomResponseFileIfPresent(arguments, "smcs.rsp"))
                {
                    Debug.LogWarning("Using obsolete custom response file \'smcs.rsp\'. " +
                                     $"Please use '{ResponseFilename}' instead.");
                }
                else if (m_Island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0 &&
                         AddCustomResponseFileIfPresent(arguments, "gmcs.rsp"))
                {
                    Debug.LogWarning("Using obsolete custom response file \'gmcs.rsp\'. " +
                                     $"Please use '{ResponseFilename}' instead.");
                }
            }

            return(StartCompiler(
                       m_Island._target,
                       GetCompilerPath(),
                       arguments,
                       BuildPipeline.CompatibilityProfileToClassLibFolder(m_Island._api_compatibility_level),
                       false,
                       MonoInstallationFinder.GetMonoInstallation(MonoInstallationFinder.MonoBleedingEdgeInstallation),
                       pathMappings
                       ));
        }