Ejemplo n.º 1
0
        private bool CopyContent(UMakeTarget umakeTarget, string version, string buildPath)
        {
            string contentFolderPath = GetContentFolderPath();

            if (!Directory.Exists(contentFolderPath))
            {
                Debug.LogFormat("Content folder \"{0}\" does not exist.", contentFolderPath);
                return(false);
            }

            UMakeTarget.Path targetPath = umakeTarget.GetTargetPath(version, buildPath);

            if (!Directory.Exists(targetPath.directoryPath))
            {
                Debug.LogFormat("Target path \"{0}\" does not exist. Did you forget to build?", targetPath.directoryPath);
                return(false);
            }

            string uploadFolderPath = Path.Combine(contentFolderPath, contentSubFolder);

            if (Directory.Exists(uploadFolderPath))
            {
                Directory.Delete(uploadFolderPath, true);
            }

            FileSystemHelper.CopyDirectory(targetPath.directoryPath, uploadFolderPath);

            Debug.LogFormat("Build files copied to \"{0}\".", uploadFolderPath);
            return(true);
        }
Ejemplo n.º 2
0
        public static void ExecuteAction(UMakeTarget t, BuildAction action)
        {
            UMake umake;

            if (!UMake.Get().TryGet(out umake))
            {
                return;
            }

            string buildPath;

            UMakeTarget.Path targetPath;

            switch (action)
            {
            case BuildAction.PreActions:
                EditorApplication.delayCall += () => t.ExecutePreBuildActions(umake);
                break;

            case BuildAction.Build:
                buildPath = UMake.GetBuildPath();
                EditorApplication.delayCall += () => t.Build(umake, buildPath);
                break;

            case BuildAction.PostActions:
                EditorApplication.delayCall += () => t.ExecutePostBuildActions(umake);
                break;

            case BuildAction.OpenFolder:
                targetPath = t.GetTargetPath(umake.version, UMake.GetBuildPath());
                EditorUtility.RevealInFinder(targetPath.directoryPath);
                break;
            }
        }
Ejemplo n.º 3
0
        public override void Execute(UMake umake, UMakeTarget target)
        {
            PlayerSettings.keystorePass = keyStorePassword;
            PlayerSettings.keyaliasPass = keyAliasPassword;

            PlayerSettings.Android.keystoreName = ProjectPath + keyStoreName;
            PlayerSettings.Android.keyaliasName = keyAliasName;
        }
Ejemplo n.º 4
0
        private void ShowPostBuildActions(UMakeTarget t)
        {
            if (postBuildActionsList == null)
            {
                postBuildActionsList = CreateBuildActionsList("Post Build Actions", t.postBuildActions);
            }

            postBuildActionsList.DoLayoutList();
        }
Ejemplo n.º 5
0
        private void ShowBuildSettings(UMakeTarget t)
        {
            t.buildTarget = ( BuildTarget )EditorGUILayout.EnumPopup("Build Target", t.buildTarget);

#if UNITY_5 || UNITY_2017_1 || UNITY_2017_2
            t.buildOptions = ( BuildOptions )EditorGUILayout.EnumMaskField("Build Options", t.buildOptions);
#else
            t.buildOptions = ( BuildOptions )EditorGUILayout.EnumFlagsField("Build Options", t.buildOptions);
#endif

            t.fileNameOverride = EditorGUILayout.TextField("File Name Override", t.fileNameOverride);
        }
        public override void Execute(UMake umake, UMakeTarget target)
        {
            Undo.RecordObject(umake, "UMakeBuildAction");

            string[] parts = umake.version.Split(separator);
            int      minVersion;

            if (int.TryParse(parts[parts.Length - 1], out minVersion))
            {
                minVersion += 1;
                parts[parts.Length - 1] = minVersion.ToString();

                umake.version = string.Join(separator.ToString(), parts);
            }

            EditorUtility.SetDirty(umake);
        }
Ejemplo n.º 7
0
        public override void Execute(UMake umake, UMakeTarget target)
        {
            string bundleVersion = PlayerSettings.bundleVersion;

            if (target.buildTarget == BuildTarget.Android)
            {
                PlayerSettings.Android.bundleVersionCode++;
            }
            else if (target.buildTarget == BuildTarget.iOS)
            {
                int buildNumber = 0;

                if (int.TryParse(PlayerSettings.iOS.buildNumber, out buildNumber))
                {
                    buildNumber++;
                    PlayerSettings.iOS.buildNumber = buildNumber.ToString();
                }
            }
        }
Ejemplo n.º 8
0
        public override void Execute(UMake umake, UMakeTarget target)
        {
            Undo.RecordObject(umake, "UMakeBuildAction");

            string[] parts = umake.version.Split(separator);
            int      minVersion;

            if (int.TryParse(parts[parts.Length - 1], out minVersion))
            {
                minVersion += 1;
                parts[parts.Length - 1] = minVersion.ToString();

                umake.version = string.Join(separator.ToString(), parts);
            }

            if (updateApplicationVersion)
            {
                PlayerSettings.bundleVersion = umake.version;
                Debug.Log("The application is now with version " + Application.version);
            }
            EditorUtility.SetDirty(umake);
        }
        public override void Execute(UMake umake, UMakeTarget target)
        {
            Undo.RecordObject(umake, "UMakeBuildAction");

            string[] parts   = umake.version.Split(separator);
            int      version = 1;
            int      index   = (int)increaseVersionType;

            if (index >= parts.Length)
            {
                string[] versions = new string[(index + 1) - parts.Length];
                for (int i = 0; i < versions.Length; i++)
                {
                    versions[i] = "0";
                }
                ArrayUtility.AddRange(ref parts, versions);
            }
            else if (int.TryParse(parts[index], out version))
            {
                version += 1;
            }

            for (int i = index + 1; i < parts.Length;)
            {
                ArrayUtility.RemoveAt(ref parts, i);
            }

            parts[index]  = version.ToString();
            umake.version = string.Join(separator.ToString(), parts);

            if (updateApplicationVersion)
            {
                PlayerSettings.bundleVersion = umake.version;
                Debug.Log("The application is now with version " + Application.version);
            }
            EditorUtility.SetDirty(umake);
        }
Ejemplo n.º 10
0
        public override void Execute(UMake umake, UMakeTarget target)
        {
            try
            {
                string buildPath        = UMake.GetBuildPath();
                string steamBuildScript = buildScript;
                if (UMakeCli.IsInCli)
                {
                    UMakeCli.Args.TryGetValue("path", out buildPath);
                    UMakeCli.Args.TryGetValue("script", out steamBuildScript);
                }

                if (!CopyContent(target, umake.version, buildPath))
                {
                    Debug.Log("Could not copy content to Steam folder.");
                    return;
                }

                if (!Directory.Exists(steamSdkPath.Value))
                {
                    Debug.LogFormat("SteamSDK \"{0}\" not found.", steamSdkPath.Value);
                    return;
                }

                string steamCmdPath = GetSteamCmdPath();
                if (!File.Exists(steamCmdPath))
                {
                    Debug.LogFormat("SteamCMD \"{0}\" not found.", steamCmdPath);
                    return;
                }

                var uploaderProcess = new System.Diagnostics.Process();
                uploaderProcess.StartInfo.FileName         = steamCmdPath;
                uploaderProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetDirectoryName(steamCmdPath));
                uploaderProcess.StartInfo.Arguments        = string.Format(steamCmdArgFormat, steamUsername.Value, steamPassword.Value, steamBuildScript);

                if (UMakeCli.IsInCli)
                {
                    uploaderProcess.StartInfo.UseShellExecute        = false;
                    uploaderProcess.StartInfo.RedirectStandardOutput = true;
                    uploaderProcess.OutputDataReceived += (sender, msg) =>
                    {
                        if (msg != null)
                        {
                            Debug.Log(msg.Data);
                        }
                    };
                }

                uploaderProcess.Start();
                Debug.LogFormat("Executing SteamCMD \"{0}\"...", steamCmdPath);

                if (UMakeCli.IsInCli)
                {
                    uploaderProcess.BeginOutputReadLine();
                    uploaderProcess.WaitForExit();
                }

                uploaderProcess.Close();
            }
            catch (System.Exception e)
            {
                Debug.Log("Upload to Steam failed.");
                Debug.LogException(e);
            }
        }
Ejemplo n.º 11
0
 private void ShowBuildSettings(UMakeTarget t)
 {
     t.buildTarget      = ( BuildTarget )EditorGUILayout.EnumPopup("Build Target", t.buildTarget);
     t.buildOptions     = ( BuildOptions )EditorGUILayout.EnumMaskField("Build Options", t.buildOptions);
     t.fileNameOverride = EditorGUILayout.TextField("File Name Override", t.fileNameOverride);
 }
Ejemplo n.º 12
0
 public virtual void Execute(UMake umake, UMakeTarget target)
 {
 }