private ProjectImportExportInfo GenerateProjectImportExportInfo(string RootWorkingDirectory, string LocalizationConfigFile)
    {
        ConfigFile File = new ConfigFile(new FileReference(LocalizationConfigFile), ConfigLineAction.Add);
        var        LocalizationConfig = new ConfigHierarchy(new ConfigFile[] { File });

        string DestinationPath;

        if (!LocalizationConfig.GetString("CommonSettings", "DestinationPath", out DestinationPath))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'DestinationPath', File: '{0}'", LocalizationConfigFile);
        }

        string ManifestName;

        if (!LocalizationConfig.GetString("CommonSettings", "ManifestName", out ManifestName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ManifestName', File: '{0}'", LocalizationConfigFile);
        }

        string ArchiveName;

        if (!LocalizationConfig.GetString("CommonSettings", "ArchiveName", out ArchiveName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ArchiveName', File: '{0}'", LocalizationConfigFile);
        }

        string PortableObjectName;

        if (!LocalizationConfig.GetString("CommonSettings", "PortableObjectName", out PortableObjectName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'PortableObjectName', File: '{0}'", LocalizationConfigFile);
        }

        string NativeCulture;

        if (!LocalizationConfig.GetString("CommonSettings", "NativeCulture", out NativeCulture))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'NativeCulture', File: '{0}'", LocalizationConfigFile);
        }

        List <string> CulturesToGenerate;

        if (!LocalizationConfig.GetArray("CommonSettings", "CulturesToGenerate", out CulturesToGenerate))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'CulturesToGenerate', File: '{0}'", LocalizationConfigFile);
        }

        bool bUseCultureDirectory;

        if (!LocalizationConfig.GetBool("CommonSettings", "bUseCultureDirectory", out bUseCultureDirectory))
        {
            // bUseCultureDirectory is optional, default is true
            bUseCultureDirectory = true;
        }

        var ProjectImportExportInfo = new ProjectImportExportInfo(DestinationPath, ManifestName, ArchiveName, PortableObjectName, NativeCulture, CulturesToGenerate, bUseCultureDirectory);

        ProjectImportExportInfo.CalculateSplitPlatformNames(RootWorkingDirectory);
        return(ProjectImportExportInfo);
    }
    public OnlineSubsystemApple(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        if (Target.Platform == UnrealTargetPlatform.IOS || Target.Platform == UnrealTargetPlatform.TVOS)
        {
            ConfigHierarchy PlatformGameConfig = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Target.ProjectFile), UnrealTargetPlatform.IOS);
            PlatformGameConfig.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableSignInWithAppleSupport", out bSignInWithAppleSupported);
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            // TODO: Mark.Fitt enable Mac support
        }

        PrivateIncludePaths.Add("Private");

        PublicDefinitions.Add("ONLINESUBSYSTEMAPPLE_PACKAGE=1");
        PublicDefinitions.Add("ONLINESUBSYSTEMAPPLE_IDENTITY_ENABLE_SIWA=" + (bSignInWithAppleSupported ? "1" : "0"));

        PrivateDependencyModuleNames.AddRange(
            new string[] {
            "Core",
            "CoreUObject",
            "Engine",
            "OnlineSubsystem",
        });

        if (Target.Platform == UnrealTargetPlatform.Mac || Target.Platform == UnrealTargetPlatform.IOS || Target.Platform == UnrealTargetPlatform.TVOS)
        {
            if (bSignInWithAppleSupported)
            {
                PublicWeakFrameworks.Add("AuthenticationServices");
            }
        }
    }
Exemplo n.º 3
0
        public static bool GetGenerateFrameworkWrapperProject(DirectoryReference ProjectDirectory)
        {
            ConfigHierarchy Ini = GetIni(ProjectDirectory);
            bool            bGenerateFrameworkWrapperProject;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bGenerateFrameworkWrapperProject", out bGenerateFrameworkWrapperProject);
            return(bGenerateFrameworkWrapperProject);
        }
Exemplo n.º 4
0
        public static bool GetBuildAsFramework(DirectoryReference ProjectDirectory)
        {
            ConfigHierarchy Ini = GetIni(ProjectDirectory);
            bool            bBuildAsFramework;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bBuildAsFramework", out bBuildAsFramework);
            return(bBuildAsFramework);
        }
Exemplo n.º 5
0
    protected void DoBuildCookRun(ProjectParams Params)
    {
        const ProjectBuildTargets ClientTargets = ProjectBuildTargets.ClientCooked | ProjectBuildTargets.ServerCooked;
        bool bGenerateNativeScripts             = Params.RunAssetNativization;
        int  WorkingCL = -1;

        if (P4Enabled && GlobalCommandLine.Submit && AllowSubmit)
        {
            WorkingCL = P4.CreateChange(P4Env.Client, String.Format("{0} build from changelist {1}", Params.ShortProjectName, P4Env.Changelist));
        }

        Project.Build(this, Params, WorkingCL, bGenerateNativeScripts ? (ProjectBuildTargets.All & ~ClientTargets) : ProjectBuildTargets.All);
        Project.Cook(Params);
        if (bGenerateNativeScripts)
        {
            // crash reporter is built along with client targets, so we need to
            // include that target flag here as well - note: that its not folded
            // into ClientTargets because the editor needs its own CrashReporter
            // as well (which would be built above)
            Project.Build(this, Params, WorkingCL, ClientTargets | ProjectBuildTargets.CrashReporter);
        }
        else
        {
            ConfigHierarchy GameIni = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, Params.RawProjectPath.Directory, HostPlatform.Current.HostEditorPlatform);
            if (GameIni != null)
            {
                List <string> NativizeBlueprintAssets                = null;
                string        BlueprintNativizationMethod            = "Disabled";
                bool          bWarnIfPackagedWithoutNativizationFlag = true;
                GameIni.GetString("/Script/UnrealEd.ProjectPackagingSettings", "BlueprintNativizationMethod", out BlueprintNativizationMethod);
                GameIni.GetBool("/Script/UnrealEd.ProjectPackagingSettings", "bWarnIfPackagedWithoutNativizationFlag", out bWarnIfPackagedWithoutNativizationFlag);
                GameIni.GetArray("/Script/UnrealEd.ProjectPackagingSettings", "NativizeBlueprintAssets", out NativizeBlueprintAssets);

                if (bWarnIfPackagedWithoutNativizationFlag && BlueprintNativizationMethod != "Disabled")
                {
                    // Warn if we're cooking without the -nativizeAssets flag, when the project settings specify a nativization method.
                    // If the "exclusive" (whitelist) method is set, we only warn if at least one asset has been selected for conversion.
                    if (BlueprintNativizationMethod != "Exclusive" || (NativizeBlueprintAssets != null && NativizeBlueprintAssets.Count > 0))
                    {
                        LogWarning("Project is configured for Blueprint nativization, but the conversion flag (-nativizeAssets) was omitted from the command line. No nativized assets have been built as a result.");
                    }
                }
            }
        }
        Project.CopyBuildToStagingDirectory(Params);
        Project.Package(Params, WorkingCL);
        Project.Archive(Params);
        Project.Deploy(Params);
        PrintRunTime();
        Project.Run(Params);

        // Check everything in!
        if (WorkingCL != -1)
        {
            int SubmittedCL;
            P4.Submit(WorkingCL, out SubmittedCL, true, true);
        }
    }
Exemplo n.º 6
0
    public void UploadToS3(DeploymentContext SC)
    {
        ConfigHierarchy Ini    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType);
        bool            Upload = false;

        string KeyId      = "";
        string AccessKey  = "";
        string BucketName = "";
        string FolderName = "";

        if (Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "UploadToS3", out Upload))
        {
            if (!Upload)
            {
                return;
            }
        }
        else
        {
            return;
        }
        bool AmazonIdentity = Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3KeyID", out KeyId) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3SecretAccessKey", out AccessKey) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3BucketName", out BucketName) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3FolderName", out FolderName);

        if (!AmazonIdentity)
        {
            Log("Amazon S3 Incorrectly configured");
            return;
        }

        if (FolderName == "")
        {
            FolderName = SC.ShortProjectName;
        }

        List <Task> UploadTasks = new List <Task>();

        foreach (KeyValuePair <string, string> Entry in SC.ArchivedFiles)
        {
            FileInfo Info = new FileInfo(Entry.Key);
            UploadTasks.Add(Task.Factory.StartNew(() => UploadToS3Worker(Info, KeyId, AccessKey, BucketName, FolderName)));
        }

        Task.WaitAll(UploadTasks.ToArray());

        string URL = "http://" + BucketName + ".s3.amazonaws.com/" + FolderName + "/" + SC.ShortProjectName + ".html";

        Log("Your project's shareable link is: " + URL);

        Log("Upload Tasks finished.");
    }
        public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles)
        {
            if (System.IO.File.Exists(BundleIniFile) == false)
            {
                CommandUtils.LogWarning("Unable to find bundle config ini file  {0}", BundleIniFile);
                return(false);
            }

            FileReference BundleFileReference = new FileReference(BundleIniFile);

            ConfigHierarchy BundleConfig    = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) });
            int             PriorityCounter = 0;

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                BundleSettings Bundle = new BundleSettings();
                Bundle.Name     = SectionName;
                Bundle.Priority = PriorityCounter;
                ++PriorityCounter;
                {
                    string ExecFileName;
                    BundleConfig.GetString(SectionName, "ExecFileName", out ExecFileName);
                    Bundle.ExecFileName = ExecFileName;
                }
                {
                    List <string> Tags;
                    BundleConfig.GetArray(SectionName, "Tags", out Tags);
                    Bundle.Tags = Tags;
                }
                {
                    List <string> FileRegex;
                    BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex);
                    Bundle.FileRegex = FileRegex;
                }
                {
                    bool bContainsShaderLibrary;
                    BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary);
                    Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                }
                if (Bundle.Tags == null)
                {
                    Bundle.Tags = new List <string>();
                }

                Bundles.Add(SectionName, Bundle);
            }

            return(true);
        }
Exemplo n.º 8
0
    private ProjectImportExportInfo GenerateProjectImportExportInfo(string LocalizationConfigFile)
    {
        var ProjectImportExportInfo = new ProjectImportExportInfo();

        ConfigFile File = new ConfigFile(new FileReference(LocalizationConfigFile), ConfigLineAction.Add);
        var        LocalizationConfig = new ConfigHierarchy(new ConfigFile[] { File });

        if (!LocalizationConfig.GetString("CommonSettings", "DestinationPath", out ProjectImportExportInfo.DestinationPath))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'DestinationPath', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetString("CommonSettings", "ManifestName", out ProjectImportExportInfo.ManifestName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ManifestName', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetString("CommonSettings", "ArchiveName", out ProjectImportExportInfo.ArchiveName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ArchiveName', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetString("CommonSettings", "PortableObjectName", out ProjectImportExportInfo.PortableObjectName))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'PortableObjectName', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetString("CommonSettings", "NativeCulture", out ProjectImportExportInfo.NativeCulture))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'NativeCulture', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetArray("CommonSettings", "CulturesToGenerate", out ProjectImportExportInfo.CulturesToGenerate))
        {
            throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'CulturesToGenerate', File: '{0}'", LocalizationConfigFile);
        }

        if (!LocalizationConfig.GetBool("CommonSettings", "bUseCultureDirectory", out ProjectImportExportInfo.bUseCultureDirectory))
        {
            // bUseCultureDirectory is optional, default is true
            ProjectImportExportInfo.bUseCultureDirectory = true;
        }

        return(ProjectImportExportInfo);
    }
Exemplo n.º 9
0
    public void UploadToS3(DeploymentContext SC, string OutputFilename)
    {
        ConfigHierarchy Ini    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType);
        bool            Upload = false;

        string Region     = "";
        string KeyId      = "";
        string AccessKey  = "";
        string BucketName = "";
        string FolderName = "";

        if (!Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "UploadToS3", out Upload) || !Upload)
        {
            return;
        }

        bool AmazonIdentity = Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3Region", out Region) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3KeyID", out KeyId) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3SecretAccessKey", out AccessKey) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3BucketName", out BucketName);

        if (!AmazonIdentity)
        {
            Log("Amazon S3 Incorrectly configured");
            return;
        }

        Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3FolderName", out FolderName);
        if (FolderName == "")
        {
            FolderName = SC.ShortProjectName;
        }
        else
        {
            // strip any before and after folder "/"
            FolderName = Regex.Replace(Regex.Replace(FolderName, "^/+", ""), "/+$", "");
        }

        List <Task> UploadTasks = new List <Task>();
        long        msTimeOut   = 0;

        foreach (KeyValuePair <string, string> Entry in SC.ArchivedFiles)
        {
            FileInfo Info = new FileInfo(Entry.Key);
            UploadTasks.Add(UploadToS3Worker(Info, Region, KeyId, AccessKey, BucketName, FolderName));
            if (msTimeOut < Info.Length)
            {
                msTimeOut = Info.Length;
            }
        }
        msTimeOut /= 100;             // [miliseconds] give 10 secs for each ~MB ( (10s * 1000ms) / ( 1024KB * 1024MB * 1000ms ) )
        if (msTimeOut < (100 * 1000)) // HttpClient: default timeout is 100 sec
        {
            msTimeOut = 100 * 1000;
        }
        Log("Upload Timeout set to: " + (msTimeOut / 1000) + "secs");
        Task.WaitAll(UploadTasks.ToArray(), (int)msTimeOut);         // set timeout [miliseconds]

        string URL = "https://" + BucketName + ".s3.amazonaws.com/" + FolderName + "/" + OutputFilename;

        Log("Your project's shareable link is: " + URL);

        Log("Upload Tasks finished.");
    }
Exemplo n.º 10
0
    public DeploymentContext(
        FileReference RawProjectPathOrName,
        DirectoryReference InLocalRoot,
        DirectoryReference BaseStageDirectory,
        DirectoryReference BaseArchiveDirectory,
        Platform InSourcePlatform,
        Platform InTargetPlatform,
        List <UnrealTargetConfiguration> InTargetConfigurations,
        IEnumerable <StageTarget> InStageTargets,
        List <String> InStageExecutables,
        bool InServer,
        bool InCooked,
        bool InStageCrashReporter,
        bool InStage,
        bool InCookOnTheFly,
        bool InArchive,
        bool InProgram,
        bool IsClientInsteadOfNoEditor,
        bool InForceChunkManifests,
        bool InSeparateDebugStageDirectory
        )
    {
        bStageCrashReporter       = InStageCrashReporter;
        RawProjectPath            = RawProjectPathOrName;
        DedicatedServer           = InServer;
        LocalRoot                 = InLocalRoot;
        CookSourcePlatform        = InSourcePlatform;
        StageTargetPlatform       = InTargetPlatform;
        StageTargetConfigurations = new List <UnrealTargetConfiguration>(InTargetConfigurations);
        StageTargets              = new List <StageTarget>(InStageTargets);
        StageExecutables          = InStageExecutables;
        IsCodeBasedProject        = ProjectUtils.IsCodeBasedUProjectFile(RawProjectPath, StageTargetConfigurations);
        ShortProjectName          = ProjectUtils.GetShortProjectName(RawProjectPath);
        Stage   = InStage;
        Archive = InArchive;

        if (CookSourcePlatform != null && InCooked)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (CookSourcePlatform != null && InProgram)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(false, false);
        }
        else
        {
            CookPlatform = "";
        }

        if (StageTargetPlatform != null && InCooked)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (StageTargetPlatform != null && InProgram)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(false, false);
        }
        else
        {
            FinalCookPlatform = "";
        }

        PlatformDir = StageTargetPlatform.PlatformType.ToString();

        if (BaseStageDirectory != null)
        {
            StageDirectory      = DirectoryReference.Combine(BaseStageDirectory, FinalCookPlatform);
            DebugStageDirectory = InSeparateDebugStageDirectory? DirectoryReference.Combine(BaseStageDirectory, FinalCookPlatform + "Debug") : StageDirectory;
        }

        if (BaseArchiveDirectory != null)
        {
            ArchiveDirectory = DirectoryReference.Combine(BaseArchiveDirectory, FinalCookPlatform);
        }

        if (!FileReference.Exists(RawProjectPath))
        {
            throw new AutomationException("Can't find uproject file {0}.", RawProjectPathOrName);
        }

        EngineRoot  = DirectoryReference.Combine(LocalRoot, "Engine");
        ProjectRoot = RawProjectPath.Directory;

        RelativeProjectRootForStage = new StagedDirectoryReference(ShortProjectName);

        ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(RawProjectPath.FullName);
        CookSourceRuntimeRootDir  = RuntimeRootDir = LocalRoot;
        RuntimeProjectRootDir     = ProjectRoot;

        if (Stage)
        {
            CommandUtils.CreateDirectory(StageDirectory.FullName);

            RuntimeRootDir            = StageDirectory;
            CookSourceRuntimeRootDir  = DirectoryReference.Combine(BaseStageDirectory, CookPlatform);
            RuntimeProjectRootDir     = DirectoryReference.Combine(StageDirectory, RelativeProjectRootForStage.Name);
            ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(UProjectCommandLineArgInternalRoot + RelativeProjectRootForStage.Name + "/" + ShortProjectName + ".uproject");
        }
        if (Archive)
        {
            CommandUtils.CreateDirectory(ArchiveDirectory.FullName);
        }
        ProjectArgForCommandLines = ProjectArgForCommandLines.Replace("\\", "/");
        ProjectBinariesFolder     = DirectoryReference.Combine(ProjectUtils.GetClientProjectBinariesRootPath(RawProjectPath, TargetType.Game, IsCodeBasedProject), PlatformDir);

        // Build a list of restricted folder names. This will comprise all other restricted platforms, plus standard restricted folder names such as NoRedist, NotForLicensees, etc...
        RestrictedFolderNames.UnionWith(PlatformExports.GetPlatformFolderNames());
        foreach (UnrealTargetPlatform StagePlatform in StageTargetPlatform.GetStagePlatforms())
        {
            RestrictedFolderNames.ExceptWith(PlatformExports.GetIncludedFolderNames(StagePlatform));
        }
        RestrictedFolderNames.UnionWith(FileFilter.RestrictedFolderNames);
        RestrictedFolderNames.Remove(new FileSystemName(StageTargetPlatform.IniPlatformType.ToString()));

        // Read the game config files
        ConfigHierarchy GameConfig = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, ProjectRoot, InTargetPlatform.PlatformType);

        // Read the list of directories to remap when staging
        List <string> RemapDirectoriesList;

        if (GameConfig.GetArray("Staging", "RemapDirectories", out RemapDirectoriesList))
        {
            foreach (string RemapDirectory in RemapDirectoriesList)
            {
                Dictionary <string, string> Properties;
                if (!ConfigHierarchy.TryParse(RemapDirectory, out Properties))
                {
                    throw new AutomationException("Unable to parse '{0}'", RemapDirectory);
                }

                string FromDir;
                if (!Properties.TryGetValue("From", out FromDir))
                {
                    throw new AutomationException("Missing 'From' property in '{0}'", RemapDirectory);
                }

                string ToDir;
                if (!Properties.TryGetValue("To", out ToDir))
                {
                    throw new AutomationException("Missing 'To' property in '{0}'", RemapDirectory);
                }

                RemapDirectories.Add(Tuple.Create(new StagedDirectoryReference(FromDir), new StagedDirectoryReference(ToDir)));
            }
        }

        // Read the list of directories to whitelist from restricted folder warnings
        List <string> WhitelistDirectoriesList;

        if (GameConfig.GetArray("Staging", "WhitelistDirectories", out WhitelistDirectoriesList))
        {
            foreach (string WhitelistDirectory in WhitelistDirectoriesList)
            {
                WhitelistDirectories.Add(new StagedDirectoryReference(WhitelistDirectory));
            }
        }

        // Read the list of files which are whitelisted to be staged
        ReadConfigFileList(GameConfig, "Staging", "WhitelistConfigFiles", WhitelistConfigFiles);
        ReadConfigFileList(GameConfig, "Staging", "BlacklistConfigFiles", BlacklistConfigFiles);

        // If we were configured to use manifests across the whole project, then this platform should use manifests.
        // Otherwise, read whether we are generating chunks from the ProjectPackagingSettings ini.
        if (InForceChunkManifests)
        {
            PlatformUsesChunkManifests = true;
        }
        else
        {
            ConfigHierarchy GameIni  = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, ProjectRoot, InTargetPlatform.PlatformType);
            String          IniPath  = "/Script/UnrealEd.ProjectPackagingSettings";
            bool            bSetting = false;
            if (GameIni.GetBool(IniPath, "bGenerateChunks", out bSetting))
            {
                PlatformUsesChunkManifests = bSetting;
            }
        }
    }
Exemplo n.º 11
0
    public override void Package(ProjectParams Params, DeploymentContext SC, int WorkingCL)
    {
        LogInformation("Package {0}", Params.RawProjectPath);

        LogInformation("Setting Emscripten SDK for packaging..");
        HTML5SDKInfo.SetupEmscriptenTemp();
        HTML5SDKInfo.SetUpEmscriptenConfigFile();

        // ----------------------------------------
        // ini configurations
        ConfigHierarchy ConfigCache = UnrealBuildTool.ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Params.RawProjectPath), UnrealTargetPlatform.HTML5);

        // Debug and Development builds are not compressed to:
        // - speed up iteration times
        // - ensure (IndexedDB) data are not cached/used
        // Shipping builds "can be":
        // - compressed
        // - (IndexedDB) cached
        string ProjectConfiguration = Params.ClientConfigsToBuild[0].ToString();

        if (ProjectConfiguration == "Shipping")
        {
            ConfigCache.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "Compressed", out Compressed);
            ConfigCache.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableIndexedDB", out enableIndexedDB);
        }
        LogInformation("HTML5Platform.Automation: Compressed = " + Compressed);
        LogInformation("HTML5Platform.Automation: EnableIndexedDB = " + enableIndexedDB);

        // ----------------------------------------
        // package directory
        string PackagePath = Path.Combine(Path.GetDirectoryName(Params.RawProjectPath.FullName), "Binaries", "HTML5");

        if (!Directory.Exists(PackagePath))
        {
            Directory.CreateDirectory(PackagePath);
        }
        string _ProjectNameExtra  = ProjectConfiguration != "Development" ? "-HTML5-" + ProjectConfiguration : "";
        string _ProjectFullpath   = Params.GetProjectExeForPlatform(UnrealTargetPlatform.HTML5).ToString();
        string _ProjectFilename   = Path.GetFileNameWithoutExtension(_ProjectFullpath) + _ProjectNameExtra;
        string SrcUE4GameBasename = Path.Combine(Path.GetDirectoryName(_ProjectFullpath), _ProjectFilename);
        string UE4GameBasename    = Path.Combine(PackagePath, _ProjectFilename);
        string ProjectBasename    = Path.Combine(PackagePath, Params.ShortProjectName + _ProjectNameExtra);

        // ----------------------------------------
        // packaging
        if (HTMLPakAutomation.CanCreateMapPaks(Params))
        {
            HTMLPakAutomation PakAutomation = new HTMLPakAutomation(Params, SC);

            // Create Necessary Paks.
            PakAutomation.CreateEnginePak();
            PakAutomation.CreateGamePak();
            PakAutomation.CreateContentDirectoryPak();

            // Create Emscripten Package from Necessary Paks. - This will be the VFS.
            PakAutomation.CreateEmscriptenDataPackage(PackagePath, ProjectBasename + ".data");

            // Create All Map Paks which  will be downloaded on the fly.
            PakAutomation.CreateMapPak();

            // Create Delta Paks if setup.
            List <string> Paks = new List <string>();
            ConfigCache.GetArray("/Script/HTML5PlatformEditor.HTML5TargetSettings", "LevelTransitions", out Paks);

            if (Paks != null)
            {
                foreach (var Pak in Paks)
                {
                    var    Matched = Regex.Matches(Pak, "\"[^\"]+\"", RegexOptions.IgnoreCase);
                    string MapFrom = Path.GetFileNameWithoutExtension(Matched[0].ToString().Replace("\"", ""));
                    string MapTo   = Path.GetFileNameWithoutExtension(Matched[1].ToString().Replace("\"", ""));
                    PakAutomation.CreateDeltaMapPaks(MapFrom, MapTo);
                }
            }
        }
        else
        {
            // we need to operate in the root
            string PythonPath     = HTML5SDKInfo.Python();
            string EmPackagerPath = HTML5SDKInfo.EmscriptenPackager();

            using (new ScopedEnvVar("EM_CONFIG", HTML5SDKInfo.DOT_EMSCRIPTEN))
            {
                using (new PushedDirectory(Path.Combine(Params.BaseStageDirectory, "HTML5")))
                {
                    string CmdLine = string.Format("\"{0}\" \"{1}\" --preload . --js-output=\"{1}.js\" --no-heap-copy", EmPackagerPath, ProjectBasename + ".data");
                    RunAndLog(CmdEnv, PythonPath, CmdLine);
                }
            }
        }


        // ----------------------------------------
        // copy to package directory

        // ensure the ue4game binary exists, if applicable
        if (!FileExists_NoExceptions(SrcUE4GameBasename + ".js"))
        {
            LogInformation("Failed to find game application " + SrcUE4GameBasename + ".js");
            throw new AutomationException(ExitCode.Error_MissingExecutable, "Stage Failed. Could not find application {0}. You may need to build the UE4 project with your target configuration and platform.", SrcUE4GameBasename + ".js");
        }

        if (!Params.IsCodeBasedProject)
        {
            // template project - need to copy over UE4Game.*
            File.Copy(SrcUE4GameBasename + ".wasm", UE4GameBasename + ".wasm", true);
            File.Copy(SrcUE4GameBasename + ".js", UE4GameBasename + ".js", true);
            File.Copy(SrcUE4GameBasename + ".js.symbols", UE4GameBasename + ".js.symbols", true);

            File.SetAttributes(UE4GameBasename + ".wasm", FileAttributes.Normal);
            File.SetAttributes(UE4GameBasename + ".js", FileAttributes.Normal);
            File.SetAttributes(UE4GameBasename + ".js.symbols", FileAttributes.Normal);
        }
        // else, c++ projects will compile "to" PackagePath

        // note: ( ProjectBasename + ".data" ) already created above (!HTMLPakAutomation.CanCreateMapPaks())


        // ----------------------------------------
        // generate HTML files to the package directory

        // custom HTML, JS (if any), and CSS (if any) template files
        string LocalBuildPath = CombinePaths(CmdEnv.LocalRoot, "Engine/Build/HTML5");
        string BuildPath      = Path.Combine(Path.GetDirectoryName(Params.RawProjectPath.FullName), "Build", "HTML5");
        string TemplateFile   = CombinePaths(BuildPath, "project_template.html");

        if (!File.Exists(TemplateFile))
        {
            // fall back to default UE4 template files
            BuildPath    = LocalBuildPath;
            TemplateFile = CombinePaths(BuildPath, "project_template.html");
        }
        GenerateFileFromTemplate(TemplateFile, ProjectBasename + ".html", Params, ConfigCache);

        TemplateFile = CombinePaths(BuildPath, "project_template.js");
        if (File.Exists(TemplateFile))
        {
            GenerateFileFromTemplate(TemplateFile, ProjectBasename + ".UE4.js", Params, ConfigCache);
        }

        TemplateFile = CombinePaths(BuildPath, "project_template.css");
        if (File.Exists(TemplateFile))
        {
            GenerateFileFromTemplate(TemplateFile, ProjectBasename + ".css", Params, ConfigCache);
        }


        // ----------------------------------------
        // (development) support files
        string MacBashTemplateFile = CombinePaths(LocalBuildPath, "RunMacHTML5LaunchHelper_template.command");
        string MacBashOutputFile   = Path.Combine(PackagePath, "RunMacHTML5LaunchHelper.command");
        string MonoPath            = CombinePaths(CmdEnv.LocalRoot, "Engine/Build/BatchFiles/Mac/SetupMono.sh");

        GenerateMacCommandFromTemplate(MacBashTemplateFile, MacBashOutputFile, MonoPath);
        // ........................................
        string htaccesspath = Path.Combine(PackagePath, ".htaccess");

        if (File.Exists(htaccesspath))
        {
            FileAttributes attributes = File.GetAttributes(htaccesspath);
            if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
            {
                attributes &= ~FileAttributes.ReadOnly;
                File.SetAttributes(htaccesspath, attributes);
            }
        }
        File.Copy(CombinePaths(LocalBuildPath, "htaccess_template.txt"), htaccesspath, true);


        // ----------------------------------------
        // final copies

        // Gather utlity .js files and combine into one file
        string DestinationFile = PackagePath + "/Utility.js";

        File.Delete(DestinationFile);
        // spelling this out - one file at a time (i.e. don't slurp in project_template.js)
        File.AppendAllText(DestinationFile, File.ReadAllText(CombinePaths(LocalBuildPath, "json2.js")));
        File.AppendAllText(DestinationFile, File.ReadAllText(CombinePaths(LocalBuildPath, "jstorage.js")));
        File.AppendAllText(DestinationFile, File.ReadAllText(CombinePaths(LocalBuildPath, "moz_binarystring.js")));

        if (Compressed)
        {
            LogInformation("Build configuration is " + ProjectConfiguration + ", so (gzip) compressing files for web servers.");

            // Compress all files. These are independent tasks which can be threaded.
            List <Task> CompressionTasks = new List <Task>();

            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(UE4GameBasename + ".wasm", UE4GameBasename + ".wasmgz")));                            // main game code
            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(UE4GameBasename + ".js", UE4GameBasename + ".jsgz")));                                // main js (emscripten)
            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(UE4GameBasename + ".js.symbols", UE4GameBasename + ".js.symbolsgz")));                // symbols fil.
            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(PackagePath + "/Utility.js", PackagePath + "/Utility.jsgz")));                        // Utility
            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(ProjectBasename + ".data", ProjectBasename + ".datagz")));                            // DATA file
            CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(ProjectBasename + ".data.js", ProjectBasename + ".data.jsgz")));                      // DATA file .js driver (emscripten)
            if (File.Exists(ProjectBasename + ".UE4.js"))
            {
                CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(ProjectBasename + ".UE4.js", ProjectBasename + ".UE4.jsgz")));                            // UE4 js
            }
            if (File.Exists(ProjectBasename + ".css"))
            {
                CompressionTasks.Add(Task.Factory.StartNew(() => CompressFile(ProjectBasename + ".css", ProjectBasename + ".cssgz")));                                          // UE4 css
            }
            Task.WaitAll(CompressionTasks.ToArray());
        }
        else
        {
            LogInformation("Build configuration is " + ProjectConfiguration + ", so not compressing. Build Shipping configuration to compress files to save space.");

            // nuke old compressed files to prevent using stale files
            File.Delete(UE4GameBasename + ".wasmgz");
            File.Delete(UE4GameBasename + ".jsgz");
            File.Delete(UE4GameBasename + ".js.symbolsgz");
            File.Delete(PackagePath + "/Utility.jsgz");
            File.Delete(ProjectBasename + ".datagz");
            File.Delete(ProjectBasename + ".data.jsgz");
            File.Delete(ProjectBasename + ".UE4.jsgz");
            File.Delete(ProjectBasename + ".cssgz");
        }

        File.Copy(CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/DotNET/HTML5LaunchHelper.exe"), CombinePaths(PackagePath, "HTML5LaunchHelper.exe"), true);
//		Task.WaitAll(CompressionTasks);
        PrintRunTime();
    }
Exemplo n.º 12
0
        public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles)
        {
            if (System.IO.File.Exists(BundleIniFile) == false)
            {
                CommandUtils.LogWarning("Unable to find bundle config ini file  {0}", BundleIniFile);
                return(false);
            }

            FileReference BundleFileReference = new FileReference(BundleIniFile);

            ConfigHierarchy BundleConfig    = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) });
            int             PriorityCounter = 0;

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                BundleSettings Bundle = new BundleSettings();
                Bundle.Name     = SectionName;
                Bundle.Priority = PriorityCounter;
                ++PriorityCounter;
                {
                    string OverrideName;
                    if (BundleConfig.GetString(SectionName, "OverrideName", out OverrideName))
                    {
                        Bundle.OverrideName = OverrideName;
                    }
                    else
                    {
                        Bundle.OverrideName = Bundle.Name;
                    }
                }
                {
                    string ParentName;
                    BundleConfig.GetString(SectionName, "Parent", out ParentName);
                    Bundle.ParentName = ParentName;
                }
                {
                    List <string> Tags;
                    BundleConfig.GetArray(SectionName, "Tags", out Tags);
                    Bundle.Tags = Tags;
                }
                {
                    List <string> FileRegex;
                    BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex);
                    Bundle.FileRegex = FileRegex;
                }
                {
                    bool bContainsShaderLibrary;
                    BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary);
                    Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                }
                if (Bundle.Tags == null)
                {
                    Bundle.Tags = new List <string>();
                }

                Bundles.Add(SectionName, Bundle);
                //BundleConfig.GetArray(SectionName, "OptionalTags", out Bundle.OptionalTags);
            }



            foreach (var BundleIt in Bundles)
            {
                BundleSettings Bundle = BundleIt.Value;
                if (Bundles.ContainsKey(Bundle.ParentName))
                {
                    BundleSettings ParentBundle = Bundles[Bundle.ParentName];
                    ParentBundle.Children.Add(Bundle);
                    Bundle.bFoundParent = true;
                }
            }
            return(true);
        }
    public DeploymentContext(
        FileReference RawProjectPathOrName,
        DirectoryReference InLocalRoot,
        DirectoryReference BaseStageDirectory,
        DirectoryReference BaseArchiveDirectory,
        Platform InSourcePlatform,
        Platform InTargetPlatform,
        List <UnrealTargetConfiguration> InTargetConfigurations,
        IEnumerable <StageTarget> InStageTargets,
        List <String> InStageExecutables,
        bool InServer,
        bool InCooked,
        bool InStageCrashReporter,
        bool InStage,
        bool InCookOnTheFly,
        bool InArchive,
        bool InProgram,
        bool IsClientInsteadOfNoEditor,
        bool InForceChunkManifests
        )
    {
        bStageCrashReporter       = InStageCrashReporter;
        RawProjectPath            = RawProjectPathOrName;
        DedicatedServer           = InServer;
        LocalRoot                 = InLocalRoot;
        CookSourcePlatform        = InSourcePlatform;
        StageTargetPlatform       = InTargetPlatform;
        StageTargetConfigurations = new List <UnrealTargetConfiguration>(InTargetConfigurations);
        StageTargets              = new List <StageTarget>(InStageTargets);
        StageExecutables          = InStageExecutables;
        IsCodeBasedProject        = ProjectUtils.IsCodeBasedUProjectFile(RawProjectPath);
        ShortProjectName          = ProjectUtils.GetShortProjectName(RawProjectPath);
        Stage   = InStage;
        Archive = InArchive;

        if (CookSourcePlatform != null && InCooked)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (CookSourcePlatform != null && InProgram)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(false, false);
        }
        else
        {
            CookPlatform = "";
        }

        if (StageTargetPlatform != null && InCooked)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (StageTargetPlatform != null && InProgram)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(false, false);
        }
        else
        {
            FinalCookPlatform = "";
        }

        PlatformDir = StageTargetPlatform.PlatformType.ToString();

        if (BaseStageDirectory != null)
        {
            StageDirectory = DirectoryReference.Combine(BaseStageDirectory, FinalCookPlatform);
        }

        if (BaseArchiveDirectory != null)
        {
            ArchiveDirectory = DirectoryReference.Combine(BaseArchiveDirectory, FinalCookPlatform);
        }

        if (!FileReference.Exists(RawProjectPath))
        {
            throw new AutomationException("Can't find uproject file {0}.", RawProjectPathOrName);
        }

        EngineRoot  = DirectoryReference.Combine(LocalRoot, "Engine");
        ProjectRoot = RawProjectPath.Directory;

        RelativeProjectRootForStage = new StagedDirectoryReference(ShortProjectName);

        ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(RawProjectPath.FullName);
        CookSourceRuntimeRootDir  = RuntimeRootDir = LocalRoot;
        RuntimeProjectRootDir     = ProjectRoot;

        if (Stage)
        {
            CommandUtils.CreateDirectory(StageDirectory.FullName);

            RuntimeRootDir            = StageDirectory;
            CookSourceRuntimeRootDir  = DirectoryReference.Combine(BaseStageDirectory, CookPlatform);
            RuntimeProjectRootDir     = DirectoryReference.Combine(StageDirectory, RelativeProjectRootForStage.Name);
            ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(UProjectCommandLineArgInternalRoot + RelativeProjectRootForStage.Name + "/" + ShortProjectName + ".uproject");
        }
        if (Archive)
        {
            CommandUtils.CreateDirectory(ArchiveDirectory.FullName);
        }
        ProjectArgForCommandLines = ProjectArgForCommandLines.Replace("\\", "/");
        ProjectBinariesFolder     = DirectoryReference.Combine(ProjectUtils.GetClientProjectBinariesRootPath(RawProjectPath, TargetType.Game, IsCodeBasedProject), PlatformDir);

        // If we were configured to use manifests across the whole project, then this platform should use manifests.
        // Otherwise, read whether we are generating chunks from the ProjectPackagingSettings ini.
        if (InForceChunkManifests)
        {
            PlatformUsesChunkManifests = true;
        }
        else
        {
            ConfigHierarchy GameIni  = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, ProjectRoot, InTargetPlatform.PlatformType);
            String          IniPath  = "/Script/UnrealEd.ProjectPackagingSettings";
            bool            bSetting = false;
            if (GameIni.GetBool(IniPath, "bGenerateChunks", out bSetting))
            {
                PlatformUsesChunkManifests = bSetting;
            }
        }
    }
Exemplo n.º 14
0
    public AppCenter(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            // ... add other public dependencies that you statically link with here ...
        }
            );


        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "CoreUObject",
            "Engine",
            "Slate",
            "SlateCore",
            // ... add private dependencies that you statically link with here ...
        }
            );

        // Setup platform include paths
        if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PrivateIncludePaths.Add("AppCenter/Private/Android");
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PrivateIncludePaths.Add("AppCenter/Private/IOS");
        }

        // Configure build defines
        bool   bAppCenterEnabled = false;
        bool   bEnableAnalytics  = false;
        bool   bEnableCrashes    = false;
        bool   bEnableDistribute = false;
        bool   bEnablePush       = false;
        string AppSecretAndroid  = "";
        string AppSecretIOS      = "";

        // Read from config
        ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, Target.ProjectFile.Directory, Target.Platform);

        string SettingsSection = "/Script/AppCenter.AppCenterSettings";

        Ini.GetBool(SettingsSection, "bEnableAnalytics", out bEnableAnalytics);
        Ini.GetBool(SettingsSection, "bEnableCrashes", out bEnableCrashes);
        Ini.GetBool(SettingsSection, "bEnableDistribute", out bEnableDistribute);
        Ini.GetBool(SettingsSection, "bEnablePush", out bEnablePush);
        Ini.GetString(SettingsSection, "AppSecretAndroid", out AppSecretAndroid);
        Ini.GetString(SettingsSection, "AppSecretIOS", out AppSecretIOS);
        bool bAnyModuleEnabled = (bEnableAnalytics | bEnableCrashes | bEnableDistribute | bEnablePush);

        if (bAnyModuleEnabled)
        {
            if (Target.Platform == UnrealTargetPlatform.Android && AppSecretAndroid != "")
            {
                bAppCenterEnabled = true;

                PublicDependencyModuleNames.AddRange(new string[] { "Launch" });

                string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
                AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "AppCenter_UPL_Android.xml"));

                if (bEnableCrashes)
                {
                    /**
                     * Application.mk
                     *
                     * APP_STL := gnustl_static
                     * APP_ABI := armeabi-v7a, arm64-v8a
                     * APP_CXXFLAGS := -std=c++11 -D__STDC_LIMIT_MACROS
                     * APP_PLATFORM := android-19
                     */
                    string ThirdPartyPath = Path.Combine(ModuleDirectory, "..", "ThirdParty");
                    PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "src"));

                    PublicLibraryPaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "lib", "armeabi-v7a"));
                    PublicLibraryPaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "lib", "arm64-v8a"));
                    PublicAdditionalLibraries.Add("breakpad_client");
                }
            }
            else if (Target.Platform == UnrealTargetPlatform.IOS && AppSecretIOS != "")
            {
                bAppCenterEnabled = true;

                string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
                AdditionalPropertiesForReceipt.Add("IOSPlugin", Path.Combine(PluginPath, "AppCenter_UPL_IOS.xml"));

                // The AppCenter.framework is required to start the SDK. If it is not added to the project,
                // the other modules won't work and your app won't compile.
                PublicAdditionalFrameworks.Add(
                    new Framework(
                        "AppCenter",
                        "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenter.embeddedframework.zip"
                        )
                    );

                if (bEnableAnalytics)
                {
                    PublicAdditionalFrameworks.Add(
                        new Framework(
                            "AppCenterAnalytics",
                            "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterAnalytics.embeddedframework.zip"
                            )
                        );
                }

                if (bEnableCrashes)
                {
                    PublicAdditionalFrameworks.Add(
                        new Framework(
                            "AppCenterCrashes",
                            "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterCrashes.embeddedframework.zip"
                            )
                        );
                }

                if (bEnableDistribute)
                {
                    PublicAdditionalFrameworks.Add(
                        new Framework(
                            "AppCenterDistribute",
                            "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterDistribute.embeddedframework.zip",
                            "AppCenterDistributeResources.bundle"
                            )
                        );
                }

                if (bEnablePush)
                {
                    PublicAdditionalFrameworks.Add(
                        new Framework(
                            "AppCenterPush",
                            "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterPush.embeddedframework.zip"
                            )
                        );
                }
            }
        }

        // Setup defines based on reality
        if (bAppCenterEnabled)
        {
            PublicDefinitions.Add("WITH_APPCENTER=" + (bAnyModuleEnabled ? "1" : "0"));
            PublicDefinitions.Add("WITH_APPCENTER_ANALYTICS=" + (bEnableAnalytics ? "1" : "0"));
            PublicDefinitions.Add("WITH_APPCENTER_CRASHES=" + (bEnableCrashes ? "1" : "0"));
            PublicDefinitions.Add("WITH_APPCENTER_DISTIBUTE=" + (bEnableDistribute ? "1" : "0"));
            PublicDefinitions.Add("WITH_APPCENTER_PUSH=" + (bEnablePush ? "1" : "0"));
        }
        else
        {
            PublicDefinitions.Add("WITH_APPCENTER=0");
            PublicDefinitions.Add("WITH_APPCENTER_ANALYTICS=0");
            PublicDefinitions.Add("WITH_APPCENTER_CRASHES=0");
            PublicDefinitions.Add("WITH_APPCENTER_DISTIBUTE=0");
            PublicDefinitions.Add("WITH_APPCENTER_PUSH=0");
        }
    }
Exemplo n.º 15
0
    public DeploymentContext(
        FileReference RawProjectPathOrName,
        string InLocalRoot,
        string BaseStageDirectory,
        string BaseArchiveDirectory,
        Platform InSourcePlatform,
        Platform InTargetPlatform,
        List <UnrealTargetConfiguration> InTargetConfigurations,
        IEnumerable <StageTarget> InStageTargets,
        List <String> InStageExecutables,
        bool InServer,
        bool InCooked,
        bool InStageCrashReporter,
        bool InStage,
        bool InCookOnTheFly,
        bool InArchive,
        bool InProgram,
        bool IsClientInsteadOfNoEditor,
        bool InForceChunkManifests,
        bool bInUseWebsocketNetDriver = false
        )
    {
        bStageCrashReporter       = InStageCrashReporter;
        RawProjectPath            = RawProjectPathOrName;
        DedicatedServer           = InServer;
        LocalRoot                 = CommandUtils.CombinePaths(InLocalRoot);
        CookSourcePlatform        = InSourcePlatform;
        StageTargetPlatform       = InTargetPlatform;
        StageTargetConfigurations = new List <UnrealTargetConfiguration>(InTargetConfigurations);
        StageTargets              = new List <StageTarget>(InStageTargets);
        StageExecutables          = InStageExecutables;
        IsCodeBasedProject        = ProjectUtils.IsCodeBasedUProjectFile(RawProjectPath);
        ShortProjectName          = ProjectUtils.GetShortProjectName(RawProjectPath);
        Stage   = InStage;
        Archive = InArchive;
        bUseWebsocketNetDriver = bInUseWebsocketNetDriver;

        if (CookSourcePlatform != null && InCooked)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (CookSourcePlatform != null && InProgram)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(false, false);
        }
        else
        {
            CookPlatform = "";
        }

        if (StageTargetPlatform != null && InCooked)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (StageTargetPlatform != null && InProgram)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(false, false);
        }
        else
        {
            FinalCookPlatform = "";
        }

        PlatformDir = StageTargetPlatform.PlatformType.ToString();

        StageDirectory   = CommandUtils.CombinePaths(BaseStageDirectory, FinalCookPlatform);
        ArchiveDirectory = CommandUtils.CombinePaths(BaseArchiveDirectory, FinalCookPlatform);

        if (!CommandUtils.FileExists(RawProjectPath.FullName))
        {
            throw new AutomationException("Can't find uproject file {0}.", RawProjectPathOrName);
        }

        ProjectRoot = CommandUtils.CombinePaths(CommandUtils.GetDirectoryName(RawProjectPath.FullName));

        if (!CommandUtils.DirectoryExists(ProjectRoot))
        {
            throw new AutomationException("Project Directory {0} doesn't exist.", ProjectRoot);
        }

        RelativeProjectRootForStage = ShortProjectName;

        ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(RawProjectPath.FullName);
        CookSourceRuntimeRootDir  = RuntimeRootDir = LocalRoot;
        RuntimeProjectRootDir     = ProjectRoot;

        RelativeProjectRootForUnrealPak = CommandUtils.CombinePaths(RelativeProjectRootForStage).Replace("\\", "/");
        if (RelativeProjectRootForUnrealPak.StartsWith("/"))
        {
            RelativeProjectRootForUnrealPak = RelativeProjectRootForUnrealPak.Substring(1);
            RelativeProjectRootForStage     = RelativeProjectRootForStage.Substring(1);
        }

        SourceRelativeProjectRoot = RelativeProjectRootForStage; // for foreign projects this doesn't make much sense, but it turns into a noop on staging files
        if (ProjectRoot.StartsWith(LocalRoot, StringComparison.InvariantCultureIgnoreCase))
        {
            SourceRelativeProjectRoot = ProjectRoot.Substring(LocalRoot.Length);
        }
        if (SourceRelativeProjectRoot.StartsWith("/") || SourceRelativeProjectRoot.StartsWith("\\"))
        {
            SourceRelativeProjectRoot = SourceRelativeProjectRoot.Substring(1);
        }

        if (Stage)
        {
            CommandUtils.CreateDirectory(StageDirectory);
            StageProjectRoot = CommandUtils.CombinePaths(StageDirectory, RelativeProjectRootForStage);

            RuntimeRootDir            = StageDirectory;
            CookSourceRuntimeRootDir  = CommandUtils.CombinePaths(BaseStageDirectory, CookPlatform);
            RuntimeProjectRootDir     = StageProjectRoot;
            ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(UProjectCommandLineArgInternalRoot + RelativeProjectRootForStage + "/" + ShortProjectName + ".uproject");
        }
        if (Archive)
        {
            CommandUtils.CreateDirectory(ArchiveDirectory);
        }
        ProjectArgForCommandLines = ProjectArgForCommandLines.Replace("\\", "/");
        ProjectBinariesFolder     = CommandUtils.CombinePaths(ProjectUtils.GetClientProjectBinariesRootPath(RawProjectPath, TargetRules.TargetType.Game, IsCodeBasedProject), PlatformDir);

        // If we were configured to use manifests across the whole project, then this platform should use manifests.
        // Otherwise, read whether we are generating chunks from the ProjectPackagingSettings ini.
        if (InForceChunkManifests)
        {
            PlatformUsesChunkManifests = true;
        }
        else
        {
            ConfigHierarchy GameIni  = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, RawProjectPath.Directory, InTargetPlatform.PlatformType);
            String          IniPath  = "/Script/UnrealEd.ProjectPackagingSettings";
            bool            bSetting = false;
            if (GameIni.GetBool(IniPath, "bGenerateChunks", out bSetting))
            {
                PlatformUsesChunkManifests = bSetting;
            }
        }
    }
Exemplo n.º 16
0
        public static void LoadBundleConfig <TPlatformBundleSettings>(DirectoryReference ProjectDir, UnrealTargetPlatform Platform,
                                                                      out IReadOnlyDictionary <string, TPlatformBundleSettings> Bundles,
                                                                      Action <TPlatformBundleSettings, ConfigHierarchy, string> GetPlatformSettings)
            where TPlatformBundleSettings : BundleSettings, new()
        {
            var Results = new List <TPlatformBundleSettings>();

            ConfigHierarchy BundleConfig = ConfigCache.ReadHierarchy(ConfigHierarchyType.InstallBundle, ProjectDir, Platform);

            const string BundleDefinitionPrefix = "InstallBundleDefinition ";

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                if (!SectionName.StartsWith(BundleDefinitionPrefix))
                {
                    continue;
                }

                TPlatformBundleSettings Bundle = new TPlatformBundleSettings();
                Bundle.Name = SectionName.Substring(BundleDefinitionPrefix.Length);
                {
                    int Order;
                    if (BundleConfig.GetInt32(SectionName, "Order", out Order))
                    {
                        Bundle.Order = Order;
                    }
                    else
                    {
                        Bundle.Order = int.MaxValue;
                    }
                }
                {
                    List <string> Tags;
                    if (BundleConfig.GetArray(SectionName, "Tags", out Tags))
                    {
                        Bundle.Tags = Tags;
                    }
                    else
                    {
                        Bundle.Tags = new List <string>();
                    }
                }
                {
                    List <string> Dependencies;
                    if (BundleConfig.GetArray(SectionName, "Dependencies", out Dependencies))
                    {
                        Bundle.Dependencies = Dependencies;
                    }
                    else
                    {
                        Bundle.Dependencies = new List <string>();
                    }
                }
                {
                    List <string> FileRegex;
                    if (BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex))
                    {
                        Bundle.FileRegex = FileRegex;
                    }
                    else
                    {
                        Bundle.FileRegex = new List <string>();
                    }
                }
                {
                    bool bContainsShaderLibrary;
                    if (BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary))
                    {
                        Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                    }
                    else
                    {
                        Bundle.bContainsShaderLibrary = false;
                    }
                }

                GetPlatformSettings(Bundle, BundleConfig, BundleDefinitionPrefix + Bundle.Name);

                Results.Add(Bundle);
            }

            // Use OrderBy and not Sort because OrderBy is stable
            Bundles = Results.OrderBy(b => b.Order).ToDictionary(b => b.Name, b => b);
        }
Exemplo n.º 17
0
        public static void LoadBundleConfig <TPlatformBundleSettings>(DirectoryReference ProjectDir, UnrealTargetPlatform Platform,
                                                                      out List <TPlatformBundleSettings> Bundles,
                                                                      Action <TPlatformBundleSettings, ConfigHierarchy, string> GetPlatformSettings)
            where TPlatformBundleSettings : BundleSettings, new()
        {
            Bundles = new List <TPlatformBundleSettings>();

            ConfigHierarchy BundleConfig = ConfigCache.ReadHierarchy(ConfigHierarchyType.InstallBundle, ProjectDir, Platform);

            const string BundleDefinitionPrefix = "InstallBundleDefinition ";

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                if (!SectionName.StartsWith(BundleDefinitionPrefix))
                {
                    continue;
                }

                TPlatformBundleSettings Bundle = new TPlatformBundleSettings();
                Bundle.Name = SectionName.Substring(BundleDefinitionPrefix.Length);
                {
                    int Order;
                    if (BundleConfig.GetInt32(SectionName, "Order", out Order))
                    {
                        Bundle.Order = Order;
                    }
                    else
                    {
                        Bundle.Order = int.MaxValue;
                    }
                }
                {
                    string ExecFileName;
                    BundleConfig.GetString(SectionName, "ExecFileName", out ExecFileName);
                    Bundle.ExecFileName = ExecFileName;
                }
                {
                    List <string> Tags;
                    BundleConfig.GetArray(SectionName, "Tags", out Tags);
                    Bundle.Tags = Tags;
                }
                {
                    List <string> FileRegex;
                    BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex);
                    Bundle.FileRegex = FileRegex;
                }
                {
                    bool bContainsShaderLibrary;
                    BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary);
                    Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                }
                if (Bundle.Tags == null)
                {
                    Bundle.Tags = new List <string>();
                }

                GetPlatformSettings(Bundle, BundleConfig, BundleDefinitionPrefix + Bundle.Name);

                Bundles.Add(Bundle);
            }

            // Use OrderBy and not Sort because OrderBy is stable
            Bundles = Bundles.OrderBy(Bundle => Bundle.Order).ToList();
        }