private static async void OnPostProcessBuild(BuildInfo buildInfo, string buildReport)
        {
            if (string.IsNullOrEmpty(buildReport))
#endif
            {
                string outputProjectDirectoryPath = Path.Combine(GetProjectPath(), buildInfo.OutputDirectory);
                if (buildInfo.CopyDirectories != null)
                {
                    string inputProjectDirectoryPath = GetProjectPath();
                    foreach (var directory in buildInfo.CopyDirectories)
                    {
                        CopyBuildDirectory(inputProjectDirectoryPath, outputProjectDirectoryPath, directory);
                    }
                }

                if (buildInfo.IsCommandLine && buildInfo.BuildAppx)
                {
                    await UwpAppxBuildTools.BuildAppxAsync(
                        PlayerSettings.productName,
                        true,
                        buildInfo.Configuration,
                        buildInfo.BuildPlatform,
                        outputProjectDirectoryPath,
                        true);
                }
            }

            // Raise the global event for listeners
            BuildCompleted?.Invoke(buildInfo, buildReport);

            // Call the post-build action, if any
            buildInfo.PostBuildAction?.Invoke(buildInfo, buildReport);
        }
示例#2
0
        /// <summary>
        /// Do a build configured for UWP Applications to the specified path, returns the error from <see cref="BuildPlayer(UwpBuildInfo)"/>
        /// </summary>
        /// <param name="buildDirectory"></param>
        /// <param name="showDialog"></param>
        /// <param name="buildAppx"></param>
        /// <returns>True, if build was successful.</returns>
        public static async Task <bool> BuildPlayer(string buildDirectory, bool showDialog = true, bool buildAppx = false)
        {
            if (UnityPlayerBuildTools.CheckBuildScenes() == false)
            {
                return(false);
            }

            var buildInfo = new UwpBuildInfo
            {
                OutputDirectory = buildDirectory,
                Scenes          = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path),
                BuildAppx       = buildAppx,
                AppIconPath     = UwpBuildDeployPreferences._3DAppIconPath,

                // Configure a post build action that will compile the generated solution
                PostBuildAction = PostBuildAction
            };

            async void PostBuildAction(IBuildInfo innerBuildInfo, BuildReport buildReport)
            {
                if (buildReport.summary.result != BuildResult.Succeeded)
                {
                    EditorUtility.DisplayDialog($"{PlayerSettings.productName} WindowsStoreApp Build {buildReport.summary.result}!", "See console for details", "OK");
                }
                else
                {
                    if (showDialog &&
                        !EditorUtility.DisplayDialog(PlayerSettings.productName, "Build Complete", "OK", "Build AppX"))
                    {
                        var _buildInfo = innerBuildInfo as UwpBuildInfo;
                        Debug.Assert(_buildInfo != null);
                        EditorAssemblyReloadManager.LockReloadAssemblies = true;
                        await UwpAppxBuildTools.BuildAppxAsync(_buildInfo);

                        EditorAssemblyReloadManager.LockReloadAssemblies = false;
                    }
                }
            }

            return(await BuildPlayer(buildInfo));
        }
示例#3
0
        /// <summary>
        /// Build the Uwp Player.
        /// </summary>
        /// <param name="buildInfo"></param>
        public static async Task <bool> BuildPlayer(UwpBuildInfo buildInfo)
        {
            #region Gather Build Data

            if (buildInfo.IsCommandLine)
            {
                ParseBuildCommandLine(ref buildInfo);
            }

            #endregion Gather Build Data

            BuildReport buildReport = UnityPlayerBuildTools.BuildUnityPlayer(buildInfo);

            bool success = buildReport != null && buildReport.summary.result == BuildResult.Succeeded;

            if (success && buildInfo.BuildAppx)
            {
                success &= await UwpAppxBuildTools.BuildAppxAsync(buildInfo);
            }

            return(success);
        }