public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string profileDirectory = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), "MonoBleedingEdge");
            string str = Path.Combine(profileDirectory, "mono-cil-strip.exe");

            for (int i = 0; i < fileNames.Length; i++)
            {
                string  text    = fileNames[i];
                Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory);
                string  text2   = text + ".out";
                process.StartInfo.Arguments = "\"" + str + "\"";
                ProcessStartInfo expr_67   = process.StartInfo;
                string           arguments = expr_67.Arguments;
                expr_67.Arguments = string.Concat(new string[]
                {
                    arguments,
                    " \"",
                    text,
                    "\" \"",
                    text,
                    ".out\""
                });
                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, text2));
                MonoAssemblyStripping.ReplaceFile(managedLibrariesDirectory + "/" + text2, managedLibrariesDirectory + "/" + text);
                File.Delete(managedLibrariesDirectory + "/" + text2);
            }
        }
示例#2
0
        static public void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string basePath    = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), MonoInstallationFinder.MonoBleedingEdgeInstallation);
            string cilStripper = Path.Combine(basePath, "mono-cil-strip.exe");

            foreach (string fileName in fileNames)
            {
                Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory);
                string  outFile = fileName + ".out";

                process.StartInfo.Arguments  = "\"" + cilStripper + "\"";
                process.StartInfo.Arguments += " \"" + fileName + "\" \"" + fileName + ".out\"";

                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, outFile));

                ReplaceFile(managedLibrariesDirectory + "/" + outFile, managedLibrariesDirectory + "/" + fileName);
                File.Delete(managedLibrariesDirectory + "/" + outFile);
            }
        }
示例#3
0
        public static Process PrepareMonoProcessBleedingEdge(string workDir)
        {
            Process process = new Process();
            string  text    = (Application.platform != RuntimePlatform.WindowsEditor) ? "mono" : "mono.exe";

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

            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);
        }
示例#4
0
        public static Process PrepareMonoProcessBleedingEdge(string workDir)
        {
            var process = new Process();

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

            process.StartInfo.FileName = Paths.Combine(MonoInstallationFinder.GetMonoBleedingEdgeInstallation(), "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 stripper on .NET 4.6 profile
            var monoProfile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6);

            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);
        }