private bool Deploy(bool multiple, Action callback) { // multiple"; string path = BuildBridgeIOS.Path_IOS_Packages; if (!Directory.Exists(path)) { UnityEngine.Debug.LogWarning("The project seems not to be build yet. Please generate the project for the iOS target platform and build it with the iOS Build Environment."); } else { DirectoryInfo di = new DirectoryInfo(path); FileInfo[] ipaFiles = di.GetFiles("*.ipa"); if (ipaFiles.Length > 0) { Process p = BuildBridgeUtilities.CreateProcess(Path_BuildEnv_OTADeploy, "\"" + ipaFiles[0].FullName + "\""); p.StartInfo.CreateNoWindow = false; // append "multiple" parameter to provide multiple OTA deployments at once if (multiple) { p.StartInfo.Arguments += " multiple"; } if (p.Start()) { UnityEngine.Debug.Log("OTA deployment started.."); return(true); } } } return(false); }
public override bool Deploy(Action callback) { BuildBridgeAndroid.Prepare(); DirectoryInfo diOutputPathGradle = new DirectoryInfo(OutputPathGradle); FileInfo fiGradleBuildFile = diOutputPathGradle.GetFiles(GradleBuildFileName, SearchOption.AllDirectories).FirstOrDefault(); if (fiGradleBuildFile != null) { string gradleOutputPath = Path.Combine(fiGradleBuildFile.Directory.FullName, "build", "outputs", "apk"); // last is configuration and DirectoryInfo diGradleOutputPath = new DirectoryInfo(gradleOutputPath); if (diGradleOutputPath.Exists) { FileInfo[] files = diGradleOutputPath.GetFiles("*.apk", SearchOption.AllDirectories); if (files.Length > 0) { gradleOutputPath = files[0].FullName; System.Diagnostics.Process pLaunch = BuildBridgeUtilities.CreateProcess(string.Format(LaunchCommandPattern, PathADB), string.Format(LaunchArgumentsPattern, BuildBridgeAndroid.AppIdentifier)); System.Diagnostics.Process pDeploy = BuildBridgeUtilities.CreateProcess(string.Format(DeployCommandPattern, PathADB), string.Format(DeployArgumentsPattern, files[0].FullName), () => { pLaunch.Start(); }); pDeploy.StartInfo.UseShellExecute = false; pDeploy.StartInfo.RedirectStandardOutput = true; if (pDeploy.Start()) { UnityEngine.Debug.Log(pDeploy.StandardOutput.ReadToEnd()); if (callback != null) { callback.Invoke(); } UnityEngine.Debug.Log("APK deployed to connected device.."); return(true); } } } } return(false); /* * string apkPath = PathProject; * * FileInfo[] files = _diProject.GetFiles("*.apk", SearchOption.TopDirectoryOnly); * Array.Sort(files, (x, y) => x.LastAccessTime.CompareTo(y.LastAccessTime)); * if (files.Length > 0) * { * apkPath = files[0].FullName; * System.Diagnostics.Process pLaunch = BuildBridgeUtilities.CreateProcess(string.Format(LaunchCommandPattern, PathADB), string.Format(LaunchArgumentsPattern, PlayerSettings.applicationIdentifier)); * System.Diagnostics.Process pDeploy = BuildBridgeUtilities.CreateProcess(string.Format(DeployCommandPattern, PathADB), string.Format(DeployArgumentsPattern, files[0].FullName), () => { pLaunch.Start(); }); * //System.Diagnostics.Process pDeploy = CreateDeployProcess(files[0].FullName, () => { pLaunch.Start(); }); * if (pDeploy.Start()) * { * UnityEngine.Debug.Log("ADB deployment started.."); * return true; * } * } * return false; */ }