private void CleanUp() { // We will keep the bug-report zip file, but clean up everything-else. if (Directory.Exists(BugProjectPath)) { UTinyBuildUtilities.PurgeDirectory(new DirectoryInfo(BugProjectPath)); } }
private static void InstallRuntime(bool force, bool silent) { try { var installLocation = new DirectoryInfo("UTiny"); var versionFile = new FileInfo(Path.Combine(installLocation.FullName, "lastUpdate.txt")); var sourcePackage = new FileInfo(UTinyConstants.PackagePath + "tiny-runtime-dist.zip"); var shouldUpdate = sourcePackage.Exists && (!versionFile.Exists || versionFile.LastWriteTimeUtc < sourcePackage.LastWriteTimeUtc); if (!force && !shouldUpdate) { if (!silent) { Debug.Log("Tiny: Runtime is already up to date"); } return; } if (!sourcePackage.Exists) { if (!silent) { Debug.LogError($"Tiny: could not find {sourcePackage.FullName}"); } return; } if (installLocation.Exists) { EditorUtility.DisplayProgressBar($"{UTinyConstants.ApplicationName} Runtime", "Removing old runtime...", 0.0f); UTinyBuildUtilities.PurgeDirectory(installLocation); } EditorUtility.DisplayProgressBar($"{UTinyConstants.ApplicationName} Runtime", "Installing new runtime...", 0.5f); UTinyBuildUtilities.UnzipFile(sourcePackage.FullName, installLocation.Parent); File.WriteAllText(versionFile.FullName, $"{sourcePackage.FullName} install time: {DateTime.UtcNow.ToString()}"); #if UNITY_EDITOR_OSX // TODO: figure out why UnzipFile does not preserve executable bits in some cases // chmod +x any native executables here UTinyBuildUtilities.RunInShell("chmod +x cwebp moz-cjpeg pngcrush", new ShellProcessArgs() { WorkingDirectory = new DirectoryInfo(GetToolDirectory("images/osx")), ExtraPaths = "/bin".AsEnumerable(), // adding this folder just in case, but should be already in $PATH ThrowOnError = false }); #endif Debug.Log($"Installed {UTinyConstants.ApplicationName} runtime at: {installLocation.FullName}"); } finally { EditorUtility.ClearProgressBar(); } }
private void Send(MouseUpEvent evt) { if (Directory.Exists(BugReportPath)) { UTinyBuildUtilities.PurgeDirectory(new DirectoryInfo(BugReportPath)); } EditorUtility.DisplayProgressBar($"{UTinyConstants.ApplicationName} Bug Report", "Validating Fields", 0.0f); m_PathsOnSend.AddRange(m_Paths); try { if (!RunUntilFailure(m_SendMethods, true)) { EditorUtility.ClearProgressBar(); // Failed to send the bug report to Jira, but successfully created the zip file. if (File.Exists(ZipFilePath)) { Debug.Log($"{UTinyConstants.ApplicationName}: Could not send the bug report. you can send it manually by emailing the '{RelativeToProjectFolder(ZipFilePath)}' file to '*****@*****.**'" + "\nNo need to provide additional description, it is all packed in the zip file itself."); EditorUtility.RevealInFinder(ZipFilePath); Close(); } } else { Debug.Log($"{UTinyConstants.ApplicationName}: bug sent successfully - thanks!"); Close(); } } finally { CleanUp(); m_PathsOnSend.Clear(); EditorUtility.ClearProgressBar(); } }
public static UTinyBuildResults Build(UTinyBuildOptions options) { if (options?.Project == null || options.Destination == null) { throw new ArgumentException($"{UTinyConstants.ApplicationName}: invalid build options provided", nameof(options)); } var buildStart = DateTime.Now; var results = new UTinyBuildResults(); IUTinyBuilder builder = null; switch (options.Platform) { case UTinyPlatform.HTML5: builder = new UTinyHTML5Builder(); break; default: throw new ArgumentException($"{UTinyConstants.ApplicationName}: build platform not supported", nameof(options)); } try { EditorUtility.DisplayProgressBar(ProgressBarTitle, "Build started for " + options.Platform.ToString(), 0.0f); var destFolder = options.Destination; destFolder.Create(); // BUILD = <DEST>/PLATFORM/CONFIG var buildFolder = new DirectoryInfo(GetBuildDirectory(options.Project, options.Platform, options.Configuration)); results.OutputFolder = buildFolder; UTinyBuildUtilities.PurgeDirectory(buildFolder); buildFolder.Create(); options.Destination = results.BinaryFolder = buildFolder; var idlFile = new FileInfo(Path.Combine(buildFolder.FullName, "generated.cs")); UTinyIDLGenerator.GenerateIDL(options.Project, idlFile); var distFolder = GetRuntimeDistFolder(); var bindGem = new FileInfo(Path.Combine( distFolder.FullName, "bindgem/BindGem/bin/Release/BindGem.exe")); var exeName = "\"" + bindGem.FullName + "\""; // always call bindgem with mono for consistency exeName = "mono " + exeName; // reference the core runtime file var bindReferences = $"-r \"{RuntimeDefsAssemblyPath}\""; UTinyBuildUtilities.RunInShell( $"{exeName} -j {bindReferences} -o bind-generated {idlFile.Name}", new ShellProcessArgs() { WorkingDirectory = buildFolder, ExtraPaths = TinyPreferences.MonoDirectory.AsEnumerable() }); // @TODO Perform a full refresh before building builder.Build(options, results); results.BuildReport.Update(); Debug.Log($"{UTinyConstants.ApplicationName} project generated at: {results.BinaryFolder.FullName}"); TinyEditorAnalytics.SendBuildEvent(options.Project, results, DateTime.Now - buildStart); return(results); } catch (Exception ex) { TinyEditorAnalytics.SendException("BuildPipeline.Build", ex); throw; } finally { EditorUtility.ClearProgressBar(); UTinyEditorUtility.RepaintAllWindows(); } }