private static void ExecuteOnTarget(System.Action <UMake, UMakeTarget> callback) { if (callback == null) { return; } GetArgs(); string targetName; Args.TryGetValue("target", out targetName); UMakeTarget target; if (!UMake.GetTarget(targetName).TryGet(out target)) { throw new CliErrorException(string.Format("Could not find target '{0}'.", targetName)); } UMake umake; if (UMake.Get().TryGet(out umake)) { callback(umake, target); } }
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; } }
public static void Select() { UMake.Get().IfSome(umake => { Selection.activeObject = umake; EditorGUIUtility.PingObject(umake); }); }
public override void Execute(UMake umake, UMakeTarget target) { PlayerSettings.keystorePass = keyStorePassword; PlayerSettings.keyaliasPass = keyAliasPassword; PlayerSettings.Android.keystoreName = ProjectPath + keyStoreName; PlayerSettings.Android.keyaliasName = keyAliasName; }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { PropertyDrawerHelper.LoadAttributeTooltip(this, label); position = position.Right(-16.0f); float buttonWidth = 40.0f; Rect preButtonRect, buildButtonRect, postButtonRect; Rect propertyRect = position .Right(buttonWidth, out postButtonRect) .Right(buttonWidth, out buildButtonRect) .Right(buttonWidth, out preButtonRect); UMakeTarget target; UMakeTargetEditor.BuildAction action; using (new ChangeIndentLevel(0)) { EditorGUI.PropertyField(propertyRect, property, GUIContent.none); target = property.objectReferenceValue as UMakeTarget; action = UMakeTargetEditor.BuildAction.None; GUI.enabled = target != null && UMakeTargetEditor.CanBuild; if (GUI.Button(preButtonRect, "Pre", EditorStyles.miniButtonLeft)) { action = UMakeTargetEditor.BuildAction.PreActions; } if (GUI.Button(buildButtonRect, "Build", EditorStyles.miniButtonMid)) { action = UMakeTargetEditor.BuildAction.Build; } if (GUI.Button(postButtonRect, "Post", EditorStyles.miniButtonRight)) { action = UMakeTargetEditor.BuildAction.PostActions; } GUI.enabled = true; } property.serializedObject.ApplyModifiedProperties(); UMake umake; if (UMake.Get().TryGet(out umake) && target != null) { UMakeTargetEditor.ExecuteAction(target, action); } }
public void ExecutePostBuildActions(UMake umake) { foreach (var postBuildAction in postBuildActions) { Debug.LogFormat("Executing post build action '{0}'", postBuildAction.name); if (postBuildAction != null) { postBuildAction.Execute(umake, this); } } AssetDatabase.SaveAssets(); }
public static void Select() { UMake umake; if (!UMake.Get().TryGet(out umake)) { umake = ScriptableObject.CreateInstance <UMake>(); AssetDatabase.CreateAsset(umake, UMake.Path); } if (umake != null) { Selection.activeObject = umake; EditorGUIUtility.PingObject(umake); } }
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); }
public void Build(UMake umake, Path targetPath) { if (string.IsNullOrEmpty(targetPath.path)) { return; } if (Directory.Exists(targetPath.directoryPath)) { Directory.Delete(targetPath.directoryPath, true); Directory.CreateDirectory(targetPath.directoryPath); } ExecutePreBuildActions(umake); string[] levels = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray(); BuildPipeline.BuildPlayer(levels, targetPath.path, buildTarget, buildOptions); }
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(); } } }
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); }
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); } }
public virtual void Execute(UMake umake, UMakeTarget target) { }