Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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");
 }
        /// <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));
        }