static UploadPlatformConfig GetUploadPlatformConfig()
        {
            UploadPlatformConfig config = new UploadPlatformConfig();

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                config.UsymtoolPath = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "usymtool.exe");
                config.LzmaPath     = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "lzma.exe");
                config.LogFilePath  = Paths.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Unity", "Editor", "symbol_upload.log");
            }
            else if (Application.platform == RuntimePlatform.OSXEditor)
            {
                config.UsymtoolPath = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "macosx", "usymtool");
                config.LzmaPath     = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "lzma");
                config.LogFilePath  = Paths.Combine(Environment.GetEnvironmentVariable("HOME"), "Library", "Logs", "Unity", "symbol_upload.log");
            }
            else if (Application.platform == RuntimePlatform.LinuxEditor)
            {
                config.UsymtoolPath = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "usymtool");
                config.LzmaPath     = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "lzma-linux64");
                config.LogFilePath  = Paths.Combine(Environment.GetEnvironmentVariable("HOME"), ".config", "unity3d", "symbol_upload.log");
            }

            return(config);
        }
Example #2
0
        public static void UploadSymbolsInPath(string authToken, string symbolPath, string includeFilter, string excludeFilter, bool waitForExit)
        {
            UploadPlatformConfig platformConfig = GetUploadPlatformConfig();

            string args = string.Format("-symbolPath \"{0}\" -log \"{1}\" -filter \"{2}\" -excludeFilter \"{3}\"", symbolPath, platformConfig.LogFilePath, includeFilter, excludeFilter);

            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo()
            {
                Arguments        = args,
                CreateNoWindow   = true,
                FileName         = platformConfig.UsymtoolPath,
                WorkingDirectory = Directory.GetParent(Application.dataPath).FullName,
                UseShellExecute  = false
            };

            psi.EnvironmentVariables["USYM_UPLOAD_AUTH_TOKEN"] = authToken;
            psi.EnvironmentVariables["USYM_UPLOAD_URL_SOURCE"] = SignedUrlSourceUrl;
            psi.EnvironmentVariables["LZMA_PATH"] = platformConfig.LzmaPath;

            System.Diagnostics.Process nativeProgram = new System.Diagnostics.Process();
            nativeProgram.StartInfo = psi;

            nativeProgram.Start();

            if (waitForExit)
            {
                nativeProgram.WaitForExit();
            }
        }
        public static void UploadSymbolsInPath(string authToken, string symbolPath, string il2cppOutputPath, string il2cppFileRoot, string includeFilter, string excludeFilter, bool waitForExit)
        {
            try
            {
                UploadPlatformConfig platformConfig = GetUploadPlatformConfig();

                string args = string.Format("-symbolPath \"{0}\" -log \"{1}\"",
                                            symbolPath, platformConfig.LogFilePath);

                if (!String.IsNullOrEmpty(includeFilter))
                {
                    args = string.Format("{0} -filter \"{1}\"", args, includeFilter);
                }

                if (!String.IsNullOrEmpty(excludeFilter))
                {
                    args = string.Format("{0} -excludeFilter \"{1}\"", args, excludeFilter);
                }

                if (!String.IsNullOrEmpty(il2cppOutputPath))
                {
                    args = string.Format("{0} -il2cppOutputPath \"{1}\"", args, il2cppOutputPath);
                }

                if (!String.IsNullOrEmpty(il2cppFileRoot))
                {
                    args = string.Format("{0} -il2cppFileRoot \"{1}\"", args, il2cppFileRoot);
                }

                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo()
                {
                    Arguments        = args,
                    CreateNoWindow   = true,
                    FileName         = platformConfig.UsymtoolPath,
                    WorkingDirectory = Directory.GetParent(Application.dataPath).FullName,
                    UseShellExecute  = false
                };

                psi.EnvironmentVariables["USYM_UPLOAD_AUTH_TOKEN"] = authToken;
                psi.EnvironmentVariables["USYM_UPLOAD_URL_SOURCE"] = SignedUrlSourceUrl;
                psi.EnvironmentVariables["LZMA_PATH"] = platformConfig.LzmaPath;

                System.Diagnostics.Process nativeProgram = new System.Diagnostics.Process();
                nativeProgram.StartInfo = psi;

                nativeProgram.Start();

                if (waitForExit)
                {
                    nativeProgram.WaitForExit();
                }
            }
            catch (Exception ex)
            {
                Debug.LogWarningFormat("Exception occurred attempting to upload symbols to Unity Cloud Diagnostics service.  Native symbols will not be available for this build. Exception details:\n{0}\n{1}", ex.ToString(), ex.StackTrace);
            }
        }