示例#1
0
 public void Write(BuildManifest manifest)
 {
     foreach (var thing in m_Items.Values.Where(i => i.Exported))
     {
         manifest.Add(thing.Guid, thing.AssetPath, EnumerableExtensions.ToSingleEnumerable <FileInfo>(thing.ExportFileInfo));
     }
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateDiff()
        {
            if (DiffGenerated)
            {
                return;
            }

            BuildManifest SourceManifest = Program.BuildRegistry.GetManifestById(ManifestId);

            if (SourceManifest == null)
            {
                if (!RequestedManifests)
                {
                    Program.NetClient.RequestManifest(ManifestId);

                    RequestedManifests = true;
                }

                return;
            }

            // Show manifest info.
            manifestSizeLabel.Text   = StringUtils.FormatAsSize(SourceManifest.GetTotalSize());
            manifestBlocksLabel.Text = SourceManifest.BlockCount.ToString();
            manifestGuidLabel.Text   = SourceManifest.Guid.ToString();

            // Generate diffs.
            List <BuildManifestFileDiff> SourceDiff = SourceManifest.Diff(null);

            SourceManifestDeltaTree.ApplyDiff(SourceManifest, SourceDiff);

            DiffGenerated = true;
            UpdateStats();
        }
        /// <summary>
        ///
        /// </summary>
        public void UpdateState()
        {
            if (NameOverride != "")
            {
                NameLabel.Text = NameOverride;
            }
            else
            {
                BuildManifest Manifest = Program.NetClient.GetOrRequestManifestById(InternalBlockListState.Id, !FirstUpdate);
                if (Manifest != null)
                {
                    NameLabel.Text = Manifest.VirtualPath;
                }
                else
                {
                    NameLabel.Text = InternalBlockListState.Id.ToString();
                }
            }

            AvailabilityStatus.ApplyLocalStates   = false;
            AvailabilityStatus.UseOuterBorder     = false;
            AvailabilityStatus.ManifestBlockState = InternalBlockListState;

            FirstUpdate = false;
        }
        protected override void OnPushManifestPlayerSettings(Dictionary <string, object> settingsCache,
                                                             BuildManifest manifest)
        {
            settingsCache["bundleVersionCode"] = PlayerSettings.Android.bundleVersionCode;

            PlayerSettings.Android.bundleVersionCode = manifest.Build + m_PlayStoreDeliveryPriority;
        }
示例#5
0
        void WriteDebugFile(BuildManifest manifest, DirectoryInfo logDirectory)
        {
            var debugFile        = new NPath(logDirectory).Combine("SceneExportLog.txt");
            var debugSceneAssets = manifest.Assets.OrderBy(x => x.Value)
                                   .Select(x => $"{x.Key.ToString("N")} = {x.Value}").ToList();

            var debugLines = new List <string>();

            debugLines.Add("::Exported Scenes::");
            debugLines.AddRange(debugSceneAssets);
            debugLines.Add("\n");

            // Write out a separate list of all types
            for (int group = 0; group < 2; ++group)
            {
                IEnumerable <TypeManager.TypeInfo> typesToWrite = TypeManager.AllTypes;
                debugLines.Add($"::All Types in TypeManager (by stable hash)::");

                var debugTypeHashes = typesToWrite.OrderBy(ti => ti.StableTypeHash)
                                      .Where(ti => ti.Type != null).Select(ti =>
                                                                           $"0x{ti.StableTypeHash:x16} - {ti.StableTypeHash,22} - {ti.Type.FullName}");

                debugLines.AddRange(debugTypeHashes);
                debugLines.Add("\n");
            }

            debugFile.MakeAbsolute().WriteAllLines(debugLines.ToArray());
        }
示例#6
0
 public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary)
 {
     // the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest)
     foreach (string BinaryPath in Binary.Config.OutputFilePaths)
     {
         string ApkFile = Path.ChangeExtension(BinaryPath, ".apk");
         Manifest.AddBuildProduct(ApkFile);
     }
 }
示例#7
0
        /// <summary>
        /// </summary>
        public bool CleanUpOrphanBuilds()
        {
            bool Result = false;

            foreach (StorageLocation Location in Locations)
            {
                string BuildPath = Path.Combine(Location.Path, @"Builds");

                if (Directory.Exists(BuildPath))
                {
                    // Check if there are any folders in the storage directory that do not have a manifest associated with them.
                    foreach (string Dir in Directory.GetDirectories(BuildPath))
                    {
                        Guid ManifestId = Guid.Empty;

                        if (Guid.TryParse(Path.GetFileName(Dir), out ManifestId))
                        {
                            // This download is currently being worked on, don't try and clean it up.
                            if (DownloadManager.IsDownloadBlocked(ManifestId))
                            {
                                continue;
                            }

                            BuildManifest Manifest = ManifestRegistry.GetManifestById(ManifestId);
                            if (Manifest == null)
                            {
                                lock (PendingDirectoryCleanups)
                                {
                                    if (!PendingDirectoryCleanups.Contains(Dir))
                                    {
                                        Logger.Log(LogLevel.Info, LogCategory.Manifest, "Deleting directory in storage folder that appears to have no matching manifest (probably a previous failed delete): {0}", Dir);
                                        PendingDirectoryCleanups.Add(Dir);
                                        IOQueue.DeleteDir(Dir, bSuccess => { PendingDirectoryCleanups.Remove(Dir); });
                                        Result = true;
                                    }
                                }
                            }
                            else
                            {
                                // If we have a manifest but no download state add as local download
                                // with no available blocks so we can clean it up if needed for space.
                                if (DownloadManager.GetDownload(ManifestId) == null)
                                {
                                    Logger.Log(LogLevel.Info, LogCategory.Manifest, "Found build directory for manifest, but no download state, added as local download, might have been orphaned due to settings save failure?: {0}", Dir);
                                    DownloadManager.AddLocalDownload(Manifest, Dir, false);
                                    Result = true;
                                }
                            }
                        }
                    }
                }
            }

            return(Result);
        }
示例#8
0
        private void WriteBeeExportManifestFile(DotsRuntimeBuildProfile profile, BuildManifest manifest)
        {
            if (!profile.ShouldWriteDataFiles)
            {
                return;
            }

            var file = profile.StagingDirectory.GetFile("export.manifest");

            file.UpdateAllLines(manifest.ExportedFiles.Select(x => x.FullName).ToArray());
        }
        public string GetOutputPath(BuildManifest manifest)
        {
            string ret = m_OutputPath.Replace("{id}", m_Id.ToLower());

            ret = ret.Replace("{product}", m_ProductName.ToLower());
            ret = ret.Replace("{platform}", GetPlatformName().ToLower());
            ret = ret.Replace("{version}", manifest.GetVersionString());
            ret = ret.Replace("{short_version}", manifest.GetShortVersionString());
            ret = ret.Replace("{build}", manifest.Build.ToString());
            ret = ret.Replace("{branch}", manifest.ScmBranch);
            ret = ret.Replace("{commit}", manifest.ScmCommitId);
            return(ret);
        }
        internal static void UpdateManifest(BuildManifest manifest, string scenePath, Hash128 subSceneGuid, SceneSectionData[] sections, DirectoryInfo dataDirectory, string outputDirectory)
        {
            //Add the entity header file and all the sections to the manifest
            List <FileInfo> exportedFiles = new List <FileInfo>();
            var             headerFile    = dataDirectory.GetFile(Path.Combine(outputDirectory, subSceneGuid + "." + EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesHeader)));

            exportedFiles.Add(headerFile);
            foreach (var section in sections)
            {
                var entityFile = dataDirectory.GetFile(Path.Combine(outputDirectory, section.SceneGUID + "." + section.SubSectionIndex + "." + EntityScenesPaths.GetExtension(EntityScenesPaths.PathType.EntitiesBinary)));
                exportedFiles.Add(entityFile);
            }
            manifest.Add(new Guid(subSceneGuid.ToString()), scenePath, exportedFiles);
        }
示例#11
0
    FileReference[] CompilePlugin(FileReference HostProjectFile, FileReference HostProjectPluginFile, PluginDescriptor Plugin, List <UnrealTargetPlatform> HostPlatforms, List <UnrealTargetPlatform> TargetPlatforms, string AdditionalArgs, bool bVS2019)
    {
        List <FileReference> ManifestFileNames = new List <FileReference>();

        // Build the host platforms
        if (HostPlatforms.Count > 0)
        {
            CommandUtils.LogInformation("Building plugin for host platforms: {0}", String.Join(", ", HostPlatforms));
            foreach (UnrealTargetPlatform HostPlatform in HostPlatforms)
            {
                if (Plugin.SupportedPrograms != null && Plugin.SupportedPrograms.Contains("UnrealHeaderTool"))
                {
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UnrealHeaderTool", TargetType.Program, HostPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, String.Format("{0} -plugin={1}", AdditionalArgs, CommandUtils.MakePathSafeToUseWithCommandLine(HostProjectPluginFile.FullName)));
                }
                CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Editor", TargetType.Editor, HostPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, AdditionalArgs);
            }
        }

        // Add the game targets
        if (TargetPlatforms.Count > 0)
        {
            CommandUtils.LogInformation("Building plugin for target platforms: {0}", String.Join(", ", TargetPlatforms));
            foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms)
            {
                if (Plugin.SupportsTargetPlatform(TargetPlatform))
                {
                    string AdditionalTargetArgs = AdditionalArgs + (bVS2019 ? "" : " -2017");
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Game", TargetType.Game, TargetPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, AdditionalTargetArgs);
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Game", TargetType.Game, TargetPlatform, UnrealTargetConfiguration.Shipping, ManifestFileNames, AdditionalTargetArgs);
                }
            }
        }

        // Package the plugin to the output folder
        HashSet <FileReference> BuildProducts = new HashSet <FileReference>();

        foreach (FileReference ManifestFileName in ManifestFileNames)
        {
            BuildManifest Manifest = CommandUtils.ReadManifest(ManifestFileName);
            BuildProducts.UnionWith(Manifest.BuildProducts.Select(x => new FileReference(x)));
        }
        return(BuildProducts.ToArray());
    }
    // Use this for initialization
    void Start()
    {
        if (this.uiText == null)
        {
            return;
        }
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
        var manifest = (TextAsset)Resources.Load("UnityCloudBuildManifest.json");
        if (manifest == null)
        {
            this.uiText.text = "not CloubBuild";
            return;
        }
        BuildManifest buildManifest = JsonUtility.FromJson <BuildManifest>(manifest.text);
        this.uiText.text =
            buildManifest.cloudBuildTargetName + "\n" +
            "BuildNumber #" + buildManifest.buildNumber + "\n" +
            buildManifest.buildStartTime + "\n" +
            "SCM " + buildManifest.scmCommitId + "\n" +
            "PID " + buildManifest.projectId + "\n" +
            "(unity ver" + buildManifest.unityVersion + ")";
#endif
    }
示例#13
0
        /// <summary>
        /// Build a target remotely
        /// </summary>
        /// <param name="TargetDesc">Descriptor for the target to build</param>
        /// <param name="RemoteLogFile">Path to store the remote log file</param>
        /// <returns>True if the build succeeded, false otherwise</returns>
        public bool Build(TargetDescriptor TargetDesc, FileReference RemoteLogFile)
        {
            // Get the directory for working files
            DirectoryReference BaseDir = DirectoryReference.FromFile(TargetDesc.ProjectFile) ?? UnrealBuildTool.EngineDirectory;
            DirectoryReference TempDir = DirectoryReference.Combine(BaseDir, "Intermediate", "Remote", TargetDesc.Name, TargetDesc.Platform.ToString(), TargetDesc.Configuration.ToString());

            DirectoryReference.CreateDirectory(TempDir);

            // Compile the rules assembly
            RulesCompiler.CreateTargetRulesAssembly(TargetDesc.ProjectFile, TargetDesc.Name, false, false, TargetDesc.ForeignPlugin);

            // Path to the local manifest file. This has to be translated from the remote format after the build is complete.
            List <FileReference> LocalManifestFiles = new List <FileReference>();

            // Path to the remote manifest file
            FileReference RemoteManifestFile = FileReference.Combine(TempDir, "Manifest.xml");

            // Prepare the arguments we will pass to the remote build
            List <string> RemoteArguments = new List <string>();

            RemoteArguments.Add(TargetDesc.Name);
            RemoteArguments.Add(TargetDesc.Platform.ToString());
            RemoteArguments.Add(TargetDesc.Configuration.ToString());
            RemoteArguments.Add("-SkipRulesCompile");             // Use the rules assembly built locally
            RemoteArguments.Add("-ForceXmlConfigCache");          // Use the XML config cache built locally, since the remote won't have it
            RemoteArguments.Add(String.Format("-Log={0}", GetRemotePath(RemoteLogFile)));
            RemoteArguments.Add(String.Format("-Manifest={0}", GetRemotePath(RemoteManifestFile)));

            if (TargetDesc.ProjectFile != null)
            {
                RemoteArguments.Add(String.Format("-Project={0}", GetRemotePath(TargetDesc.ProjectFile)));
            }

            foreach (string LocalArgument in TargetDesc.AdditionalArguments)
            {
                int EqualsIdx = LocalArgument.IndexOf('=');
                if (EqualsIdx == -1)
                {
                    RemoteArguments.Add(LocalArgument);
                    continue;
                }

                string Key   = LocalArgument.Substring(0, EqualsIdx);
                string Value = LocalArgument.Substring(EqualsIdx + 1);

                if (Key.Equals("-Log", StringComparison.InvariantCultureIgnoreCase))
                {
                    // We are already writing to the local log file. The remote will produce a different log (RemoteLogFile)
                    continue;
                }
                if (Key.Equals("-Manifest", StringComparison.InvariantCultureIgnoreCase))
                {
                    LocalManifestFiles.Add(new FileReference(Value));
                    continue;
                }

                string RemoteArgument = LocalArgument;
                foreach (RemoteMapping Mapping in Mappings)
                {
                    if (Value.StartsWith(Mapping.LocalDirectory.FullName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        RemoteArgument = String.Format("{0}={1}", Key, GetRemotePath(Value));
                        break;
                    }
                }
                RemoteArguments.Add(RemoteArgument);
            }

            // Handle any per-platform setup that is required
            if (TargetDesc.Platform == UnrealTargetPlatform.IOS || TargetDesc.Platform == UnrealTargetPlatform.TVOS)
            {
                // Always generate a .stub
                RemoteArguments.Add("-CreateStub");

                // Get the provisioning data for this project
                IOSProvisioningData ProvisioningData = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(TargetDesc.Platform)).ReadProvisioningData(TargetDesc.ProjectFile);
                if (ProvisioningData == null || ProvisioningData.MobileProvisionFile == null)
                {
                    throw new BuildException("Unable to find mobile provision for {0}. See log for more information.", TargetDesc.Name);
                }

                // Create a local copy of the provision
                FileReference MobileProvisionFile = FileReference.Combine(TempDir, ProvisioningData.MobileProvisionFile.GetFileName());
                if (FileReference.Exists(MobileProvisionFile))
                {
                    FileReference.SetAttributes(MobileProvisionFile, FileAttributes.Normal);
                }
                FileReference.Copy(ProvisioningData.MobileProvisionFile, MobileProvisionFile, true);
                Log.TraceInformation("[Remote] Uploading {0}", MobileProvisionFile);
                UploadFile(MobileProvisionFile);

                // Extract the certificate for the project
                FileReference CertificateFile = FileReference.Combine(TempDir, "Certificate.p12");
                if (!FileReference.Exists(CertificateFile))
                {
                    StringBuilder Arguments = new StringBuilder("ExportCertificate");
                    if (TargetDesc.ProjectFile == null)
                    {
                        Arguments.AppendFormat(" \"{0}\"", UnrealBuildTool.EngineSourceDirectory);
                    }
                    else
                    {
                        Arguments.AppendFormat(" \"{0}\"", TargetDesc.ProjectFile.Directory);
                    }
                    Arguments.AppendFormat(" -certificate \"{0}\"", CertificateFile);

                    ProcessStartInfo StartInfo = new ProcessStartInfo();
                    StartInfo.FileName  = FileReference.Combine(UnrealBuildTool.EngineDirectory, "Binaries", "DotNET", "IOS", "IPhonePackager.exe").FullName;
                    StartInfo.Arguments = Arguments.ToString();
                    if (Utils.RunLocalProcessAndLogOutput(StartInfo) != 0)
                    {
                        throw new BuildException("IphonePackager failed.");
                    }
                }

                // Upload the certificate to the remote
                Log.TraceInformation("[Remote] Uploading {0}", CertificateFile);
                UploadFile(CertificateFile);

                // Tell the remote UBT instance to use them
                RemoteArguments.Add(String.Format("-ImportProvision={0}", GetRemotePath(MobileProvisionFile)));
                RemoteArguments.Add(String.Format("-ImportCertificate={0}", GetRemotePath(CertificateFile)));
                RemoteArguments.Add(String.Format("-ImportCertificatePassword=A"));
            }

            // Upload the workspace files
            Log.TraceInformation("[Remote] Uploading workspace files");
            UploadWorkspace(TempDir);

            // Fixup permissions on any shell scripts
            Execute(RemoteBaseDir, String.Format("chmod +x {0}/Build/BatchFiles/Mac/*.sh", EscapeShellArgument(GetRemotePath(UnrealBuildTool.EngineDirectory))));

            // Execute the compile
            Log.TraceInformation("[Remote] Executing build");

            StringBuilder BuildCommandLine = new StringBuilder("Engine/Build/BatchFiles/Mac/Build.sh");

            foreach (string RemoteArgument in RemoteArguments)
            {
                BuildCommandLine.AppendFormat(" {0}", EscapeShellArgument(RemoteArgument));
            }

            int Result = Execute(GetRemotePath(UnrealBuildTool.RootDirectory), BuildCommandLine.ToString());

            if (Result != 0)
            {
                if (RemoteLogFile != null)
                {
                    Log.TraceInformation("[Remote] Downloading {0}", RemoteLogFile);
                    DownloadFile(RemoteLogFile);
                }
                return(false);
            }

            // Download the manifest
            Log.TraceInformation("[Remote] Downloading {0}", RemoteManifestFile);
            DownloadFile(RemoteManifestFile);

            // Convert the manifest to local form
            BuildManifest Manifest = Utils.ReadClass <BuildManifest>(RemoteManifestFile.FullName);

            for (int Idx = 0; Idx < Manifest.BuildProducts.Count; Idx++)
            {
                Manifest.BuildProducts[Idx] = GetLocalPath(Manifest.BuildProducts[Idx]).FullName;
            }

            // Download the files from the remote
            if (TargetDesc.AdditionalArguments.Any(x => x.Equals("-GenerateManifest", StringComparison.InvariantCultureIgnoreCase)))
            {
                LocalManifestFiles.Add(FileReference.Combine(UnrealBuildTool.EngineDirectory, "Intermediate", "Build", "Manifest.xml"));
            }
            else
            {
                Log.TraceInformation("[Remote] Downloading build products");

                List <FileReference> FilesToDownload = new List <FileReference>();
                FilesToDownload.Add(RemoteLogFile);
                FilesToDownload.AddRange(Manifest.BuildProducts.Select(x => new FileReference(x)));
                DownloadFiles(FilesToDownload);
            }

            // Write out all the local manifests
            foreach (FileReference LocalManifestFile in LocalManifestFiles)
            {
                Log.TraceInformation("[Remote] Writing {0}", LocalManifestFile);
                Utils.WriteClass <BuildManifest>(Manifest, LocalManifestFile.FullName, "");
            }
            return(true);
        }
示例#14
0
        /// <summary>
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="VirtualPath"></param>
        /// <param name="LocalPath"></param>
        public void Start(string VirtualPath, string InLocalPath)
        {
            LocalPath = InLocalPath;
            State     = BuildPublishingState.ScanningFiles;

            Task.Run(
                () =>
            {
                try
                {
                    Guid NewManifestId = Guid.NewGuid();

                    // Don't allow downloading of this manifest until we have fully committed it.
                    Program.ManifestDownloadManager.BlockDownload(NewManifestId);

                    // Calculate max size of all files in folder to publish.
                    string[] Files = Directory.GetFiles(LocalPath, "*", SearchOption.AllDirectories);
                    long TotalSize = 0;
                    for (int i = 0; i < Files.Length; i++)
                    {
                        TotalSize += new FileInfo(Files[i]).Length;
                    }

                    // Allocate appropriate folder to store build in.
                    if (!Program.StorageManager.AllocateSpace(TotalSize, NewManifestId, out StoragePath))
                    {
                        Logger.Log(LogLevel.Error, LogCategory.Main, "Failed to allocate space, storage folders likely at capacity.");

                        Program.ManifestDownloadManager.UnblockDownload(NewManifestId);
                        State = BuildPublishingState.Failed;
                        return;
                    }

                    // Recreated directory.
                    if (Directory.Exists(StoragePath))
                    {
                        FileUtils.DeleteDirectory(StoragePath);
                    }

                    Directory.CreateDirectory(StoragePath);

                    // Copy each file over to the storage folder.
                    State = BuildPublishingState.CopyingFiles;
                    for (int i = 0; i < Files.Length; i++)
                    {
                        string Src          = Files[i];
                        string RelativePath = Files[i].Substring(LocalPath.Length).TrimStart('/', '\\');
                        string Dst          = Path.Combine(StoragePath, RelativePath);

                        string DstDir = Path.GetDirectoryName(Dst);
                        if (!Directory.Exists(DstDir))
                        {
                            Directory.CreateDirectory(DstDir);
                        }

                        Progress    = i / (float)Files.Length * 50.0f;
                        CurrentFile = Src;

                        File.Copy(Src, Dst);
                    }

                    // Build manifest from directory.
                    Manifest = BuildManifest.BuildFromDirectory(
                        NewManifestId, StoragePath, VirtualPath, Program.IOQueue, (InFile, InProgress) =>
                    {
                        Progress = 50.0f + InProgress * 0.5f;
                        if (InFile.Length > 0)
                        {
                            CurrentFile = InFile;
                        }
                    }
                        );

                    ManualResetEvent PublishCompleteEvent = new ManualResetEvent(false);
                    ManifestPublishResultRecievedHandler PublishHandler = (ManifestId, Result) =>
                    {
                        if (ManifestId == Manifest.Guid)
                        {
                            switch (Result)
                            {
                            case PublishManifestResult.Success:
                                {
                                    break;
                                }

                            case PublishManifestResult.VirtualPathAlreadyExists:
                                {
                                    State = BuildPublishingState.FailedVirtualPathAlreadyExists;
                                    break;
                                }

                            case PublishManifestResult.PermissionDenied:
                                {
                                    State = BuildPublishingState.PermissionDenied;
                                    break;
                                }

                            case PublishManifestResult.GuidAlreadyExists:
                                {
                                    State = BuildPublishingState.FailedGuidAlreadyExists;
                                    break;
                                }

                            case PublishManifestResult.Failed:
                            default:
                                {
                                    State = BuildPublishingState.Failed;
                                    break;
                                }
                            }

                            PublishCompleteEvent.Set();
                        }
                    };

                    Program.NetClient.OnManifestPublishResultRecieved += PublishHandler;

                    // Submit to the server.
                    State = BuildPublishingState.UploadingManifest;
                    if (!Program.NetClient.PublishManifest(Manifest))
                    {
                        State = BuildPublishingState.Failed;
                        Program.ManifestDownloadManager.UnblockDownload(NewManifestId);
                        return;
                    }

                    // Wait for complete delegate.
                    PublishCompleteEvent.WaitOne();

                    Program.NetClient.OnManifestPublishResultRecieved -= PublishHandler;

                    // Abort here if publishing failed.
                    if (State != BuildPublishingState.UploadingManifest)
                    {
                        Program.ManifestDownloadManager.UnblockDownload(NewManifestId);
                        return;
                    }

                    State    = BuildPublishingState.Success;
                    Progress = 100;
                }
                catch (Exception ex)
                {
                    Logger.Log(LogLevel.Error, LogCategory.Main, "Manifest publishing failed with exception: {0}", ex.Message);
                    State = BuildPublishingState.Failed;
                }
            }
                );
        }
        public void Run(bool deploy)
        {
            PlayerPrefs.SetString(BuildUtility.GetLastSettingsKey <PlayerBuildSettings>(), m_Id);
            AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

            List <string> scenes = new List <string>(m_Scenes.Length);

            for (int i = 0; i < m_Scenes.Length; i++)
            {
                SceneAsset sceneAsset = m_Scenes[i];

                if (sceneAsset == null)
                {
                    throw new BuildException("Missing scene asset reference in BuildSettings. Has this scene been deleted?");
                }

                scenes.Add(AssetDatabase.GetAssetPath(sceneAsset));
            }

            if (scenes.Count == 0)
            {
                throw new BuildException("No scene asset references in BuildSettings. At least one scene must be added when building a player.");
            }

            BuildOptions buildOptions = BuildOptions.None;

            if (m_IsDevelopment)
            {
                buildOptions |= BuildOptions.Development;
                buildOptions |= BuildOptions.AllowDebugging;
            }

            if (deploy)
            {
                buildOptions |= BuildOptions.AutoRunPlayer;
            }

            var settingsCache = new Dictionary <string, object>();

            try
            {
                PushPlayerSettings(settingsCache);
                PreProcessBuild();

                BuildManifest manifest   = CreateOrUpdateBuildManifest();
                string        outputPath = GetOutputPath(manifest);
                string        buildPath  = PrepareBuildPath(outputPath);
                PushManifestPlayerSettings(settingsCache, manifest);

#if UNITY_2018_1_OR_NEWER
                BuildReport report = BuildPipeline.BuildPlayer(scenes.ToArray(), buildPath, BuildTarget, buildOptions);

                if (report.summary.result == BuildResult.Failed)
                {
                    throw new BuildException("Build player FAILED: BuildResult is Failed");
                }

                if (report.summary.totalErrors > 0 &&
                    m_FailBuildOnErrors)
                {
                    throw new BuildException($"Build player FAILED: {report.summary.totalErrors} error(s)");
                }
#else
                string error = BuildPipeline.BuildPlayer(scenes.ToArray(), buildPath, BuildTarget, buildOptions);

                if (!string.IsNullOrEmpty())
                {
                    throw new BuildException("Build player FAILED: " + error);
                }
#endif

                PostProcessBuild(outputPath);
            }
            finally
            {
                PopPlayerSettings(settingsCache);
            }
        }
 protected virtual void OnPushManifestPlayerSettings(Dictionary <string, object> settingsCache, BuildManifest manifest)
 {
 }
        private void PushManifestPlayerSettings(Dictionary <string, object> settingsCache, BuildManifest manifest)
        {
            settingsCache["bundle_version"] = PlayerSettings.bundleVersion;

            PlayerSettings.bundleVersion = manifest.GetShortVersionString();

            OnPushManifestPlayerSettings(settingsCache, manifest);
        }
示例#18
0
 public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary)
 {
     // we need to include the generated .mem file.
     Manifest.AddBuildProduct(Binary.Config.OutputFilePath + ".mem");
 }
示例#19
0
        /// <summary>
        ///
        /// </summary>
        public void ApplyDiff(BuildManifest InManifest, List <BuildManifestFileDiff> InDiff)
        {
            Manifest = InManifest;
            Diff     = InDiff;

            pathTextBox.Text = InManifest.VirtualPath;

            Model.Nodes.Clear();
            NodeCache.Clear();

            MainTreeView.BeginUpdate();

            // Create folders first.
            foreach (BuildManifestFileDiff Diff in InDiff)
            {
                string ParentPath = VirtualFileSystem.GetParentPath(Diff.FileInfo.Path);
                if (ParentPath != "")
                {
                    GetOrCreateNode(ParentPath, null);
                }
            }

            // Create files after.
            foreach (BuildManifestFileDiff Diff in InDiff)
            {
                GetOrCreateNode(Diff.FileInfo.Path, Diff);
            }

            // Calculate the folder states.
            foreach (BuildManifestFileDiff Diff in InDiff)
            {
                string ParentPath = Diff.FileInfo.Path;
                while (true)
                {
                    ParentPath = VirtualFileSystem.GetParentPath(ParentPath);
                    if (ParentPath == "")
                    {
                        break;
                    }

                    if (FolderDiffTypes.ContainsKey(ParentPath))
                    {
                        switch (FolderDiffTypes[ParentPath])
                        {
                        case BuildManifestFileDiffType.Added:
                        {
                            // Added can be upgraded to modified if we are not already added..
                            if (Diff.Type != BuildManifestFileDiffType.Added)
                            {
                                FolderDiffTypes[ParentPath] = BuildManifestFileDiffType.Modified;
                            }
                            break;
                        }

                        case BuildManifestFileDiffType.Modified:
                        {
                            // Modified never changes.
                            break;
                        }

                        case BuildManifestFileDiffType.Removed:
                        {
                            // Removed can be upgraded to modified if we are not already removed.
                            if (Diff.Type != BuildManifestFileDiffType.Removed)
                            {
                                FolderDiffTypes[ParentPath] = BuildManifestFileDiffType.Modified;
                            }
                            break;
                        }

                        case BuildManifestFileDiffType.Unchanged:
                        {
                            // Unchanged can be upgraded to modified.
                            if (Diff.Type != BuildManifestFileDiffType.Unchanged)
                            {
                                FolderDiffTypes[ParentPath] = BuildManifestFileDiffType.Modified;
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                        FolderDiffTypes[ParentPath] = Diff.Type;
                    }
                }
            }

            MainTreeView.EndUpdate();
            //MainTreeView.FullUpdate();
        }
示例#20
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateDiff()
        {
            if (DiffGenerated)
            {
                return;
            }

            BuildManifest SourceManifest      = Program.BuildRegistry.GetManifestById(SourceManifestId);
            BuildManifest DestinationManifest = Program.BuildRegistry.GetManifestById(DestinationManifestId);

            if (SourceManifest == null || DestinationManifest == null)
            {
                if (!RequestedManifests)
                {
                    Program.NetClient.RequestManifest(SourceManifestId);
                    Program.NetClient.RequestManifest(DestinationManifestId);

                    RequestedManifests = true;
                }

                return;
            }

            int  MatchingFiles      = 0;
            long MatchingFilesSize  = 0;
            int  MatchingBlocks     = 0;
            long MatchingBlocksSize = 0;

            HashSet <string> FileHashes  = new HashSet <string>();
            HashSet <uint>   BlockHashes = new HashSet <uint>();

            foreach (BuildManifestFileInfo File in SourceManifest.GetFiles())
            {
                FileHashes.Add(File.Checksum);
            }

            for (int i = 0; i < SourceManifest.BlockCount; i++)
            {
                BlockHashes.Add(SourceManifest.GetBlockChecksum(i));
            }

            foreach (BuildManifestFileInfo File in DestinationManifest.GetFiles())
            {
                if (FileHashes.Contains(File.Checksum))
                {
                    MatchingFiles++;
                    MatchingFilesSize += File.Size;
                }
            }

            for (int i = 0; i < DestinationManifest.BlockCount; i++)
            {
                if (BlockHashes.Contains(DestinationManifest.GetBlockChecksum(i)))
                {
                    BuildManifestBlockInfo Info = new BuildManifestBlockInfo();
                    if (DestinationManifest.GetBlockInfo(i, ref Info))
                    {
                        MatchingBlocks++;
                        MatchingBlocksSize += Info.TotalSize;
                    }
                }
            }

            // Show manifest info.
            manifestSizeLabel.Text = string.Format("{0} (Delta {1})",
                                                   StringUtils.FormatAsSize(DestinationManifest.GetTotalSize()),
                                                   StringUtils.FormatAsSize(DestinationManifest.GetTotalSize() - SourceManifest.GetTotalSize()));

            manifestBlocksLabel.Text = string.Format("{0} (Delta {1})",
                                                     DestinationManifest.BlockCount,
                                                     DestinationManifest.BlockCount - SourceManifest.BlockCount);

            manifestGuidLabel.Text   = SourceManifest.Guid + " / " + DestinationManifest.Guid;
            matchingFilesLabel.Text  = MatchingFiles + " (" + StringUtils.FormatAsSize(MatchingFilesSize) + ")";
            matchingBlocksLabel.Text = MatchingBlocks + " (" + StringUtils.FormatAsSize(MatchingBlocksSize) + ")";

            // Generate diffs.
            List <BuildManifestFileDiff> SourceDiff = SourceManifest.Diff(null);

            SourceManifestDeltaTree.ApplyDiff(SourceManifest, SourceDiff);

            List <BuildManifestFileDiff> DestinationDiff = SourceManifest.Diff(DestinationManifest);

            DestinationManifestDeltaTree.ApplyDiff(DestinationManifest, DestinationDiff);

            DiffGenerated = true;
            UpdateStats();
        }
示例#21
0
 public virtual void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary)
 {
 }
        protected override void OnPushManifestPlayerSettings(Dictionary <string, object> settingsCache, BuildManifest manifest)
        {
            settingsCache["buildNumber"] = PlayerSettings.iOS.buildNumber;

            PlayerSettings.iOS.buildNumber = manifest.Build.ToString();
        }