コード例 #1
0
 /// <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.");
     }
 }
コード例 #2
0
 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));
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
            //[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);
                }
            }
        }
コード例 #7
0
 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);
                 }
             }
         }
     }
 }
コード例 #8
0
 //[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");
 }
コード例 #9
0
 private static bool CanPackAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.PackProfileName);
コード例 #10
0
 private static void PackAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.PackProfileName);
コード例 #11
0
 private static bool CanRebuildAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.RebuildProfileName);
コード例 #12
0
 private static void RebuildAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.RebuildProfileName);
コード例 #13
0
 private static void BuildAllAutoBuiltProjects()
 {
     MSBuildProjectBuilder.BuildProjects(MSBuildProjectBuilder.EnumerateAllMSBuildProjectReferences().Where(projectReference => projectReference.AutoBuild).ToArray());
 }
コード例 #14
0
 private static bool CanCleanAllProjects() => MSBuildProjectBuilder.CanBuildAllProjects(MSBuildProjectBuilder.CleanProfileName);
コード例 #15
0
 private static void CleanAllProjects() => MSBuildProjectBuilder.TryBuildAllProjects(MSBuildProjectBuilder.CleanProfileName);
コード例 #16
0
 /// <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));
 }