/// <summary> /// Build method that is invoked by commandline /// </summary> // ReSharper disable once UnusedMember.Global public static void Build() { try { var args = CommandLineArgs.FromCommandLine(); // Parse command line arguments var buildTargetFilter = CommandlineParser.GetBuildTargetFilter(args); var wantedWorkerTypes = CommandlineParser.GetWorkerTypesToBuild(args); var scriptImplementation = CommandlineParser.GetScriptingImplementation(args); var buildEnvironment = CommandlineParser.GetBuildEnvironment(args); // Create BuildContext for each worker var buildContexts = BuildContext.GetBuildContexts(wantedWorkerTypes, buildEnvironment, scriptImplementation, buildTargetFilter); if (buildContexts.Count == 0) { throw new BuildFailedException( $"Attempted a build with no valid targets!"); } BuildWorkers(buildContexts); } catch (Exception e) { Debug.LogException(e); if (e is BuildFailedException) { throw; } throw new BuildFailedException(e); } }
/// <summary> /// Build method that is invoked by commandline /// </summary> // ReSharper disable once UnusedMember.Global public static void Build() { try { var args = CommandLineArgs.FromCommandLine(); // Parse command line arguments var buildContextFilter = BuildContextSettings.FromCommandLine(args); // Create BuildContext for each worker var buildConfig = BuildConfig.GetInstance(); var buildContexts = BuildContext.GetBuildContexts(buildConfig, buildContextFilter); if (buildContexts.Count == 0) { throw new BuildFailedException("Attempted a build with no valid targets!"); } BuildWorkers(buildContexts); } catch (Exception e) { Debug.LogException(e); if (e is BuildFailedException) { throw; } throw new BuildFailedException(e); } }
public void GetBuildContexts_for_unknown_worker_type_without_filter_returns_zero_cloud_contexts(string workerType) { var buildContextFilter = BuildContextSettings.Cloud(workerType); List <BuildContext> buildContexts = null; Assert.DoesNotThrow(() => { buildContexts = BuildContext.GetBuildContexts(EmptyBuildConfig, buildContextFilter); }); Assert.AreEqual(0, buildContexts.Count); }
public void GetBuildContexts_for_unknown_worker_type_with_invalid_filter_returns_zero_cloud_contexts(string workerType, params BuildTarget[] buildTargetFilter) { var buildContextFilter = BuildContextSettings.Cloud(workerType); buildContextFilter.BuildTargetFilter = buildTargetFilter; List <BuildContext> buildContexts = null; Assert.DoesNotThrow(() => { buildContexts = BuildContext.GetBuildContexts(ValidBuildConfig, buildContextFilter); }); Assert.AreEqual(0, buildContexts.Count); }
public void GetBuildContexts_for_valid_worker_type_with_valid_filter_returns_expected_number_of_cloud_contexts(string workerType, int expectedContexts, params BuildTarget[] buildTargetFilter) { var buildContextFilter = BuildContextSettings.Cloud(workerType); buildContextFilter.BuildTargetFilter = buildTargetFilter; List <BuildContext> buildContexts = null; Assert.DoesNotThrow(() => { buildContexts = BuildContext.GetBuildContexts(ValidBuildConfig, buildContextFilter); }); Assert.AreEqual(expectedContexts, buildContexts.Count); }
public void GetBuildContexts_for_valid_worker_type_without_filter_returns_all_expected_cloud_contexts(string workerType, params BuildTarget[] expectedTargets) { var buildContextFilter = BuildContextSettings.Cloud(workerType); List <BuildContext> buildContexts = null; Assert.DoesNotThrow(() => { buildContexts = BuildContext.GetBuildContexts(ValidBuildConfig, buildContextFilter); }); Assert.AreEqual(expectedTargets.Length, buildContexts.Count); for (var i = 0; i < buildContexts.Count; i++) { Assert.AreEqual(workerType, buildContexts[i].WorkerType); Assert.AreEqual(expectedTargets[i], buildContexts[i].BuildTargetConfig.Target); } }
internal static void MenuBuild(BuildEnvironment environment, params string[] workerTypes) { // Delaying build by a frame to ensure the editor has re-rendered the UI to avoid odd glitches. EditorApplication.delayCall += () => { try { var buildContexts = BuildContext.GetBuildContexts(workerTypes, environment); BuildWorkers(buildContexts); } catch (Exception e) { Debug.LogException(e); EditorUtility.DisplayDialog("Build Failed", "Build failed. Please see the Unity Console Window for information.", "OK"); throw; } }; }
internal static void MenuBuild(BuildContextSettings buildContextSettings) { // Delaying build by a frame to ensure the editor has re-rendered the UI to avoid odd glitches. EditorApplication.delayCall += () => { try { var buildConfig = BuildConfig.GetInstance(); var buildContexts = BuildContext.GetBuildContexts(buildConfig, buildContextSettings); BuildWorkers(buildContexts); } catch (Exception e) { Debug.LogException(e); EditorUtility.DisplayDialog("Build Failed", "Build failed. Please see the Unity Console Window for information.", "OK"); throw; } }; }