/// <summary> /// Tries to build all projects that define the specified profile. /// </summary> /// <param name="profile">The name of the profile to build.</param> /// <param name="additionalArguments">The additional arguments passed to MSBuild.</param> public static void TryBuildAllProjects(string profile, string additionalArguments = "") { try { MSBuildProjectBuilder.BuildAllProjects(profile, additionalArguments); } catch (OperationCanceledException) { Debug.LogWarning("Canceled building MSBuild projects."); } }
private static void RebuildAllProjects() { try { MSBuildProjectBuilder.BuildAllProjects(MSBuildProjectBuilder.RebuildTargetArgument); } catch (OperationCanceledException) { Debug.LogWarning("Canceled building MSBuild projects."); } }
/// <summary> /// Builds all MSBuild projects referenced by a <see cref="MSBuildProjectReference"/> within the Unity project with the default UI. /// </summary> /// <param name="profile">The name of the profile to build.</param> /// <param name="additionalArguments">The additional arguments passed to MSBuild.</param> /// <returns>A task that will have a result of true if the build succeeds.</returns> public static bool BuildAllProjects(string profile, string additionalArguments = "") { (IEnumerable <MSBuildProjectReference> withProfile, IEnumerable <MSBuildProjectReference> withoutProfile) = MSBuildProjectBuilder.SplitByProfile(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences(), profile); foreach (MSBuildProjectReference msBuildProjectReference in withoutProfile) { Debug.Log($"Skipping {msBuildProjectReference.ProjectPath} because it does not have a profile named {profile}.", msBuildProjectReference); } return(MSBuildProjectBuilder.BuildProjects(withProfile.ToArray(), profile, additionalArguments)); }
/// <summary> /// Determines whether the specified profile can currently be built. /// </summary> /// <param name="profile">The name of the profile to build.</param> /// <returns>True if the specified profile can currently be built.</returns> public static bool CanBuildAllProjects(string profile) { // Only allow one build at a time (with the default UI) if (!MSBuildProjectBuilder.isBuildingWithDefaultUI) { // Verify at least one project defines the specified profile. (IEnumerable <MSBuildProjectReference> withProfile, _) = MSBuildProjectBuilder.SplitByProfile(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences(), profile); return(withProfile.Any()); } return(false); }
//[MenuItem("MSBuild/Auto Build All Projects [testing only]", priority = int.MaxValue)] private static void BuildAllAutoBuiltProjects() { IEnumerable <IGrouping <string, MSBuildProjectReference> > autoBuildProfiles = from projectReference in MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences() from profile in projectReference.Profiles where profile.autoBuild group projectReference by profile.name; foreach (IGrouping <string, MSBuildProjectReference> autoBuildProfile in autoBuildProfiles) { MSBuildProjectBuilder.BuildProjects(autoBuildProfile.ToArray(), autoBuildProfile.Key); } }
public static void DrawBuildButtons(this MSBuildProjectReference msBuildProjectReference) { using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Build")) { MSBuildProjectBuilder.BuildProject(msBuildProjectReference); } if (GUILayout.Button("Rebuild")) { MSBuildProjectBuilder.BuildProject(msBuildProjectReference, MSBuildProjectBuilder.RebuildTargetArgument); } } }
public static void DrawBuildButtons(this MSBuildProjectReference msBuildProjectReference) { using (new EditorGUILayout.HorizontalScope()) { if (!msBuildProjectReference.Profiles.Any()) { EditorGUILayout.HelpBox($"Define profiles below.", MessageType.Error); } else { foreach (var profile in msBuildProjectReference.Profiles) { if (GUILayout.Button(profile.name)) { MSBuildProjectBuilder.BuildProject(msBuildProjectReference, profile.name); } } } } }
//[MenuItem("MSBuild/Auto Build All Projects [testing only]", priority = int.MaxValue)] private static void BuildAllAutoBuiltProjects() { (IEnumerable <MSBuildProjectReference> withProfile, _) = MSBuildProjectBuilder.SplitByProfile(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences(), "Build"); MSBuildProjectBuilder.BuildProjects(withProfile.Where(projectReference => projectReference.AutoBuild).ToArray(), "Build"); }
private static bool CanPackAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.PackProfileName);
private static void PackAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.PackProfileName);
private static bool CanRebuildAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.RebuildProfileName);
private static void RebuildAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.RebuildProfileName);
private static void BuildAllAutoBuiltProjects() { MSBuildProjectBuilder.BuildProjects(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences().Where(projectReference => projectReference.AutoBuild).ToArray()); }
private static bool CanCleanAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.CleanProfileName);
private static void CleanAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.CleanProfileName);
/// <summary> /// Builds all MSBuild projects referenced by a <see cref="MSBuildProjectReference"/> within the Unity project with the default UI. /// </summary> /// <param name="arguments">The additional arguments passed to MSBuild.</param> /// <returns>A task that will have a result of true if the build succeeds.</returns> public static bool BuildAllProjects(string arguments = MSBuildProjectBuilder.DefaultBuildArguments) { return(MSBuildProjectBuilder.BuildProjects(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences().ToArray(), arguments)); }